Questions tagged [gdb]

Use this tag for problems related to or involving GDB, the standard debugger for the GNU software system.

The GNU Debugger, usually called just GDB and named gdb as an executable file, is the standard debugger for the GNU software system. It is a portable debugger that runs on many Unix-like systems and Microsoft Windows variants. GDB works for many programming languages, including C, C++, D, Go, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, and Ada.

Related Resources

11325 questions
6
votes
2 answers

Understanding Stack Frames in C

I am trying to understand the stack frame in C, so I wrote a simple C code to analyze the stack frame. First of all the fun1() returns an address of a local variable which is initialized to 10 to ptr which leads to a warning but that's ok... If I…
Adarsh
  • 883
  • 7
  • 18
6
votes
1 answer

Can LLDB break on *(&function+offset)?

I'm used to using GDB and there is an equivalent function I am not able to find with LLDB. I would like to be able to place a breakpoint at a certain offset from the base address of a function. With GDB I can do: b *(&functionX+20) Is there a way…
Dpp
  • 1,926
  • 1
  • 18
  • 26
6
votes
1 answer

Tracing call stack in disassembled code

I am trying to debug a tricky core dump (from an -O2 optimized binary). // Caller Function void caller(Container* c) { std::list < Message*> msgs; if(!decoder.called(c->buf_, msgs)) { .... ..... } // Called…
Arunmu
  • 6,837
  • 1
  • 24
  • 46
6
votes
1 answer

gdb : what is a symbol-file used for debugging

I am badly confused with files generated during compilation and used for debugging. I know there two ways to store debugging info when compiling a code. One is to store the info in a separate file other than the executable (or object file) normally…
sali
  • 219
  • 4
  • 10
6
votes
1 answer

Flow control in GDB based on local variable existence

I'm trying to write a GDB script (legacy, not Python) that will print information on members of a local variable (a C or C++ struct), but only if that local variable exists. Something like: # 'magic' should be evaluate to "if 'info locals' has a…
Rob
  • 1,350
  • 12
  • 21
6
votes
2 answers

Are using a debugger and heavy usage of C++ templates incompatible in the long run?

I'm working on a project that uses a lot of templates and libraries like boost:: fusion and found myself struggling with an executable that, as of today, is 600MB and gdb needs 1.7 GB of memory to just load it, and a symbol lookup would make it use…
Gustavo
  • 195
  • 2
  • 11
6
votes
5 answers

gdb fails with error 193 when debugging MinGW-compiled code

This is shown when I try to debug my code with Eclipse: I then tried creating a simple Hello World program manually with Notepad++ and the command-line gcc. When I launched the gdb debugger this happened: (gdb) run Starting program: …
Pieter
  • 31,619
  • 76
  • 167
  • 242
6
votes
2 answers

How to assemble 16-bit asm code using NASM, then debug it in Linux, before making an executable in DOSBox

We've been asked to write 16-bit assembly code and assemble it to run in DOSBox. I know that 16-bit assembly code just differs from normal x86 assembly code in that it uses bits 16 and also 16-bit registers (ax, bx ,cx, ...). I tried searching on…
MDuh
  • 415
  • 1
  • 7
  • 19
6
votes
1 answer

How to debug a raw binary with gdb

I have a executable for an embedded device. It does not have header information that gdb recognizes, but instead uses a proprietary header specified by the vendor. I can analyse the file just fine using IDA-pro, but I'd like to run some code to…
Johan
  • 74,508
  • 24
  • 191
  • 319
6
votes
1 answer

Running code inside gdb debugger

Is it possible to run code inside gdb? For example, if I were debugging a .c file, and I wanted to get the strlen() of a character array at a particular point in time, I can't just type in strlen(str) into the buffer - it is an invalid command. What…
George Newton
  • 3,153
  • 7
  • 34
  • 49
6
votes
2 answers

Distributed software debug with gdb

I am currently developing a distributed software in C++ using linux which is executed in more than 20 nodes simultaneously. So one of the most challenging issue that I found is how to debug it. I heard that is possible to manage in a single gdb…
Vicente Bolea
  • 1,409
  • 16
  • 39
6
votes
1 answer

"not stripped" but "no debug symbols"

Can you explain the different results: $ file libc-2.8.so libc-2.8.so: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.10, with unknown capability 0x41000000 =…
Ran Regev
  • 361
  • 3
  • 13
6
votes
1 answer

Debugging with GDB Cannot Lookup D Program symbols

I have successfully built and installed Ian Buclaw's (ibuclaw) GDB branch on github on my Ubuntu 13.10 x86_64 with its default compiler GCC 4.8.1. I had to remove the file ld from the bin sub-directory otherwise DMD complains about a sysroot thing…
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
6
votes
2 answers

gdb freezing when print variables with tab completion

I compile the c++ project, which is not too large, about 6M binary. When I debug it and want to print some variable, I type the first two characters and press the Tab to complete. Then the gdb read symbols forever freezing. How can I solve this…
JunWangCas
  • 89
  • 1
  • 7
6
votes
1 answer

Get list of source files (and locations) from binary

I'm working in a linux distro. I'm writing a C/C++ program that requires a list of source files that a binary (executable) was compiled with. I compiled the binary using GCC with the -g flag, of course. Using gdb I found out the format of the binary…
gospes
  • 3,819
  • 1
  • 28
  • 31