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
1 answer

How can I examine in gdb a variable that has the same name as its type

I'm debugging an existing C library with gdb 7.4 I'm trying to examine a variable which, unfortunately, was declared with the same name as its type: extern const enum rtx_class rtx_class[NUM_RTX_CODE]; Now I just can't find a way to examine this…
Amir Gonnen
  • 3,525
  • 4
  • 32
  • 61
6
votes
1 answer

Understanding some C++ coding practice

I am currently trying to understand how the following code (http://pastebin.com/zTHUrmyx) works, my approach is currently compiling the software in debug and using gdb to step through the code. However, I'm running into the problem that 'step' does…
Jesse RJ
  • 217
  • 4
  • 17
6
votes
3 answers

Print Current Statement in GDB

Each time I step with n it prints out the next statement to be executed. How do I see the next statement to be executed, as if I had typed n, but without actually stepping the code? Currently I am using where, and this gives me the line number of…
user1157123
6
votes
1 answer

gdb debug remote core dump

I have a server written in C++ crashing in the production environment to which I have no direct access to. The crash generates a huge core dump ~34G which I cannot copy locally. I need to analyze the core dump but don't know how it can be done…
user1444800
  • 115
  • 3
  • 6
6
votes
1 answer

GDB remote debugging with valgrind

If I remote debug using gdb I connect to the gdbserver using target remote host:2345 If I debug memory errors with valgrind and gdb (to break on invalid memory access) I use target remote | vgdb (after starting valgrind --track-origins=yes…
highsciguy
  • 2,569
  • 3
  • 34
  • 59
6
votes
2 answers

Duplicated memory management symbols in libc.so and ld-linux.so

Some preamble It seems that malloc, calloc, realloc and free are all replicated in ld-linux.so and libc.so . As I understand it, that is done by the dynamic loader to take care of memory management within ld-linux.so before libc.so is loaded and…
fons
  • 4,905
  • 4
  • 29
  • 49
6
votes
2 answers

Configure Qt Creator to work with GDB

I have both GDB and CDB in my machine. My Qt creator is using the CDB for debugging. I tried to point to the GDB path, but it doesn't work. How do I set Qt Creator to debug using GDB?
Arun
6
votes
2 answers

How to let GDB continue until the program enters another function?

Say I am in A() and A() calls B(). I just entered A() and I want the program to run until I am in B(). It doesn't have to be a specific function B(). I just want my program to pause whenever it enters a new function. Is there a way to do that?
user1861088
  • 1,683
  • 2
  • 15
  • 17
6
votes
1 answer

How to set a breakpoint on a python function in gdb

I sometime use gdb to debug python scripts (CPython of course). It is useful typically to debug core dumps (and when it involves c extension modules). A basic question is how to set breakpoint on a python function in gdb. Say I've a python script…
amit
  • 10,612
  • 11
  • 61
  • 60
6
votes
2 answers

How to debug memory issues in embedded application

I'm new to embedded programming but I have to debug a quite complex application running on an embedded platform. I use GDB through a JTAG interface. My program crashes at some point in an unexpected way. I suppose this happens due to some memory…
Šatov
  • 323
  • 3
  • 9
6
votes
1 answer

how to exit the wh mode in gdb

The 'wh' mode in gdb is not working very well for me. When I dump some data the command window and the program text window gets overlapped and it looks quite messy. I want to exit the wh mode without quitting the debugger and without killing the…
A. K.
  • 34,395
  • 15
  • 52
  • 89
6
votes
3 answers

Arithmetic Exception in gdb, but I'm not dividing by zero?

I've been getting a Floating point exception (core dumped) error in my C++ program, and gdb shows that the problem is on a line that performs modulo division: Program received signal SIGFPE, Arithmetic exception. [Switching to Thread 0x7ffff6804700…
crognale
  • 171
  • 1
  • 1
  • 6
6
votes
3 answers

Using gdb -i=mi integration in emacs 24

I'm checking out a segfault in one of our apps. A short time after starting the app, the main gdb status bar changes to: (Debugger:run [signal-received]) A (gdb) prompt appears but the contents of all other windows remain unchanged (empty). …
Richard Corden
  • 21,389
  • 8
  • 58
  • 85
6
votes
1 answer

c++ new operator takes lots of memory (67MB) via libstdc++

I have some issues with the new operator in libstdc++. I wrote a program in C++ and had some problems with the memory management. After having debugged with gdb to determine what is eating up my ram I got the following for info proc mappings Mapped…
6
votes
4 answers

Get instruction pointer of running application on Unix

Is there a way to get the instruction pointer of a running application Unix? I have a running process (C++) and want to get its current location, and thereafter in GDB (on a different machine) map the location to source location ('list' command).
LK__
  • 6,515
  • 5
  • 34
  • 53