🌐
OnlineGDB
onlinegdb.com
GDB online Debugger | Compiler - Code, Compile, Run, Debug online C, C++
Online GDB is online compiler and debugger for C/C++. You can compile, run and debug code with gdb online. Using gcc/g++ as compiler and gdb as debugger. Currently C and C++ languages are supported.
Online C
OnlineGDB is online IDE with c compiler. Quick and easy way to compile c program online. It supports gcc compiler for c.
Online C++
OnlineGDB is online IDE with C++ compiler. Quick and easy way to compiler c++ program online. It supports g++ compiler for c++.
Java
OnlineGDB is online IDE with java compiler. Quick and easy way to run java program online.
Python
OnlineGDB is online IDE with python compiler. Quick and easy way to compile python program online. It supports python3.
🌐
X
x.com › gdb
Greg Brockman (@gdb) / X
July 2, 2010 - Click to Follow gdb · Greg Brockman · @gdb · President & Co-Founder · @OpenAI · gregbrockman.comJoined July 2010 · 32 Following · 866.6K Followers · Greg Brockman · @gdb · · · Nov 17, 2023 · Sam and I are shocked and saddened by ...
Discussions

Online GDB doesn't work as expected?
Through some checking on godbolt , it appears OP is using a GCC with version 6.3 or older. What you are essentially asking is, why does GCC, at a given version, decide to reserve 48-bytes on the stack for what appears to only be 32-bytes worth of data (using 8 bytes for the int). My answer: I don't know. Could be a bug, could be bad optimization, could be oversight, could be for some other reason or no reason at all. Using GCC version 7.1 or newer results in the function reserving 32-bytes on the stack as you would expect. More on reddit.com
🌐 r/C_Programming
4
2
December 2, 2021
performance - Why won't my program run in GDB online compiler/debugger or Visual Studio C++ 2019 - Stack Overflow
I just finished writing this code and am ready to start debugging and testing. However, when I try to run it in GDB the console remains blank. After letting it sit for five minutes nothing is appea... More on stackoverflow.com
🌐 stackoverflow.com
c - Why strcmp doesn't work in Online GDB compiler? - Stack Overflow
Also, the name "Online GDB" implies that you have access to a debugger. Please use it to step through the code line by line to check what happens, while monitoring variables and their values. Splitting up complex expressions and saving their result to temporary variables also helps seeing what's going on. ... GDB has nothing to do with the working of functions of the standard library. Do you mean the compiler ... More on stackoverflow.com
🌐 stackoverflow.com
Why does online GDB c++ compiler while debugging my code suddenly stops? - Stack Overflow
Long run you’ll probably be better off getting tools like this running locally, i.e. on your own computer. If you like GDB, you can get it via WSL on Windows; if you want to try a GUI debugger, Visual Studio Community has an excellent debugger for Windows. More on stackoverflow.com
🌐 stackoverflow.com
🌐
SWISH
swish.swi-prolog.org
SWISH -- SWI-Prolog for SHaring
We cannot provide a description for this page right now
🌐
LogicMojo
logicmojo.com › online-gdb-compiler
Online GDB Compiler By Logicmojo
It is the world's first online IDE with an integrated gdb debugger that allows debugging. It does not demand the download and installation of any software on your pc. A useful web tool for coders who enjoy coding online. Platform that is dependable and does not collapse unexpectedly. Find difficult bugs in your with onlineGDB's super debugging ability. You can code, compile, run, and debug online from any device and from any location.
🌐
CodeChef
codechef.com › ide
Online Compiler & IDE for Python, C++, C, Java, Rust - CodeChef
Compile & run your code with the CodeChef online IDE. Our online compiler supports multiple programming languages like Python, C++, C, JavaScript, Rust, Go, Kotlin, and many more.
🌐
Landing.Jobs
landing.jobs › home › an intermediate guide to debugging c code with online gdb c compilers
An intermediate guide to debugging C code with online GDB C compilers - Landing.Jobs
February 16, 2023 - It allows you to code, compile, run, and debug online from anywhere, with any device. Online GDB has a user-friendly interface, and it supports several standard libraries and features such as breakpoints, variable watches, and automatic code ...
Find elsewhere
🌐
Compiler Explorer
godbolt.org
Compiler Explorer
Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.
🌐
Programiz
programiz.com › c-programming › online-compiler
Online C Compiler - Programiz
Write and run your C programming code using our online compiler. Enjoy additional features like code sharing, dark mode, and support for multiple languages.
🌐
x64dbg
x64dbg.com
x64dbg
An open-source x64/x32 debugger for windows.
🌐
Reddit
reddit.com › r/c_programming › online gdb doesn't work as expected?
r/C_Programming on Reddit: Online GDB doesn't work as expected?
December 2, 2021 -

I am posting this both on r/Assembly_Language and here. I think the topic involves both fairly strongly.

So, I am going to do a presentation involving buffer overflows and I learned some basic Assembly because of that (more specifically the function prologue). I plan on learning Assembly for real and have installed SASM, but for now I just know basic C. I need help reading something.

In one of my sources (https://www.tenouk.com/Bufferoverflowc/Bufferoverflow4.html), this guy does disass in his vulnerable function in order to show that sub has allocated more space than he declared (4 vs 20).

This is his code:

#include <unistd.h>

 

void Test()

{

   char buff[4];

   printf("Some input: ");

   gets(buff);

   puts(buff);

}

 

int main(int argc, char *argv[ ])

{

   Test();

   return 0;

}

And this is the output of disass Test:

0x080483d0 <Test+0>:    push   %ebp

0x080483d1 <Test+1>:    mov    %esp, %ebp

0x080483d3 <Test+3>:    sub    $0x8, %esp

0x080483d6 <Test+6>:    sub    $0xc, %esp

Buff is 4 bytes and 20 bytes are "freed" on the stack. But when I try to do the same with a relatively more complicated function (I hope commentary is enough for the language gap):

#include <stdio.h>
#include <string.h>
#include <locale.h>     
#include <stdlib.h>        

void senha(){      
 char senha[10];           
    char senhareal[10]="dddddd";      
    int teste = 0;    
    char resposta[3]; 
    
    printf("\n\n\n\n-----------------------------SISTEMA NUCLEAR DA OTAN------------------------------------ \n\n\n\n");     
    
    
    printf("DIGITE SUA SENHA: ");
    gets(senha);


    if(0 == strncmp(senha, senhareal, 20))
    {
         printf ("\nSenha correta! \n");
         teste = 1;    
    }
    
    
    else
    {
        printf ("\nSENHA INCORRETA! \n");
    }


    if(teste)
    {
        printf ("\nO usuário agora controla a instalação! Deseja destruir o Brasil? \n");     
        gets(resposta); 
    }
            }

int main(){               
    system("color 03");
	setlocale(LC_ALL, "Portuguese"); 
    senha();  

    return 0;
}

I get this:

0x0000555555555209 <+0>: endbr64
0x000055555555520d <+4>: push %rbp
0x000055555555520e <+5>: mov %rsp,%rbp
0x0000555555555211 <+8>: sub $0x30,%rsp
0x0000555555555215 <+12>: mov %fs:0x28,%rax
0x000055555555521e <+21>: mov %rax,-0x8(%rbp)

No matter my input. So why does Online GDB consistently subtract 48 bytes? What are the instructions following sub and do they apply at all to what I am trying to do? Is it possible to know what's going on in that specific platform? Finally, am I unable to replicate what this person did with my code?

I tested the code of my source in Online GDB as well. It consistently subtracts 16 bytes.

🌐
MyCompiler
mycompiler.io
myCompiler - An online IDE for C, C++, Java, Python, Go, NodeJS and other languages
Run your favourite programming languages online with myCompiler. Simple and easy to use IDE where you can edit, compile and run your code in the programming language of your choice
Top answer
1 of 2
3

Whoops you have an infinite loop here

//This creates a LCV for the do loop below and sets it equal to 0.

int y = 0;

//This do loop generates the random number.
do
{
    //This generates a random time seed.
    srand(time(0));

    //This generates a random number between 1 and 99.
    ran = rand() % 100;

    //This while controls the do loop.
}while (y != 9);

y is initialized to 0 and you are looping while y!=9. And that is just the first error, there might be more.


Bug #2

int z = 1;
//This makes the program only create a random number the first pass through the loop.
if (z < 2)
{
    //This runs the random number generator function.
    return randomgen();

    //This sets the result of the function as the random number.
    randnum = randomgen();

    //This sets the random number to the current number.
    num = randnum;
}

After fixing infinite loop in randomgen(), You are immediately returning...

2 of 2
1

you have two problems in your code: the first one is that you have infinite loop in randomgen() function the condition in check against y - y != 9 but the value never update

int randomgen() 
{
    //This creates a variable to store the random number.
    int ran;

    //This creates a LCV for the do loop below and sets it equal to 0.
    int y = 0;

    //This do loop generates the random number.
    do
    {
        //This generates a random time seed.
        srand(time(0));

        //This generates a random number between 1 and 99.
        ran = rand() % 100;

        //This while controls the do loop.
    }while (y != 9);

    //This returns the random number for use in the rest of the program.
    return ran;
}

and the second one is even if you pass the loop in the function you exit main right away because the call to the function randomgen() is with return

if (z < 2)
{
    //This runs the random number generator function.
    return randomgen(); <-- **second problome**

    //This sets the result of the function as the random number.
    randnum = randomgen();

    //This sets the random number to the current number.
    num = randnum;
}
🌐
Stack Overflow
stackoverflow.com › questions › 75880897 › why-does-online-gdb-c-compiler-while-debugging-my-code-suddenly-stops
Why does online GDB c++ compiler while debugging my code suddenly stops? - Stack Overflow
Long run you’ll probably be better off getting tools like this running locally, i.e. on your own computer. If you like GDB, you can get it via WSL on Windows; if you want to try a GUI debugger, Visual Studio Community has an excellent debugger ...
🌐
TutorialsPoint
tutorialspoint.com › compilers › online-html-editor.htm
Online HTML Editor & IDE - Write, Edit & Preview HTML Code
Professional HTML editor with live preview, syntax highlighting, and CSS/JavaScript support. Build and test web pages online with no setup required.
🌐
YouTube
youtube.com › @Onlinegdb
Online GDB Debugger - YouTube
www.onlinegdb.com : An online compiler and debugger Lets you code, compile, run and debug online at ease. Supported programming languages: C, C++ Debugger: gdb, GNU debugger