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

How does GDB determine the bottom of the stack?

Background: I'm allocating my own machine contexts and stacks with the getcontext(3) / makecontext(3) / setcontext(3) (ucontext.h; SUSv2, POSIX.1-2001) family of functions. When I use gdb (version 6.1.1) to examine a stack while the thread is in one…
Conrad Meyer
  • 2,851
  • 21
  • 24
5
votes
2 answers

GDB attaching to a process where executable is deleted

I have running process but it's executable file has got deleted. If I try to attach gdb I got following error /home/vivek/binary/releases/20120328101511/bin/app.exe (deleted): No such file or directory. How can I attach gdb to this process…
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186
5
votes
1 answer

android ndk-gdb fails to load symbols

Using android-ndk-r7b/samples/hello-jni as a debugging starting point, I built the jni with ndk-build V=1 NDK_DEBUG=1 rm -f ./libs/armeabi/lib*.so ./libs/armeabi-v7a/lib*.so ./libs/x86/lib*.so rm -f ./libs/armeabi/gdbserver…
Paul
  • 217
  • 3
  • 12
5
votes
1 answer

using getopt with gdb

have just incorporated getopt into my main() func getopt sets the global variable optarg for each call stepping through main() with gdb, after getopt() call optarg is always NULL (e.g. (gdb) p optarg) yet printf("%s\n", optarg) outputs the cmd line…
bph
  • 10,728
  • 15
  • 60
  • 135
5
votes
1 answer

How can I insert a time string into a GDB log?

I recently discovered that you can set breakpoints in Xcode that will print to the console and auto-continue -- meaning you can insert log statements without having to write NSLog() calls and recompile (on-the-fly logging, woot). Only problem is…
Jasarien
  • 58,279
  • 31
  • 157
  • 188
5
votes
2 answers

How to debug functions in a dynamic library loaded with LD_PRELOAD with gdb?

I'm trying to debug some functions in a dynamic shared library libexecHook.so. This library is preloaded setting LD_PRELOAD in order to intercept and rewrite some calls to execve() and friends. For debugging purposes I have built gmake with symbols.…
Marko
  • 128
  • 1
  • 9
5
votes
2 answers

putting breakpoint in a file using "rbreak filename.c:." doesn't work

I want to put breakpoint on all functions of a file. I came across this link : http://sourceware.org/gdb/download/onlinedocs/gdb/Set-Breaks.html#Set-Breaks It suggest the use of rbreak command for this purpose. When i use "rbreak ." , it works fine…
mezda
  • 3,537
  • 6
  • 30
  • 37
5
votes
2 answers

Get memory in use from core dump

I have a core dump file generated by a c++ program. I suspect the reason it crashed is because it was running out of memory. Is there a way the get the amount of memory in use from the core file using gdb (or any other way)?
Isac
  • 2,058
  • 16
  • 23
5
votes
1 answer

How does one approximate virtual memory used (VSZ) using a core dump and gdb on Linux?

I'm writing a tool for core dump analysis and one thing I'd like to print is an estimate of how much virtual memory the process was using at the time of the dump. These core dumps could be due to crashes or could be manually taken using gcore (e.g.…
user379184
  • 51
  • 2
5
votes
2 answers

How does backtrace work?

#include using namespace std; class dummyA { int x; public: dummyA () { x = 0; } void test () { x++; } }; int main () { cout << "\nG'Morning"; …
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
5
votes
6 answers

How do I find segmentation fault from multiple files using GDB

I have been asked in an interview how can you debug segmentation fault in C program using GDB. I told them we can compile our program with -g option so as it add debugging information to binary file and can read core dump file but then interviewer…
Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199
5
votes
1 answer

What is a heuristic fencepost?

And why does gdb seem to "hit" it?
Michael Pryor
  • 25,046
  • 18
  • 72
  • 90
5
votes
3 answers

Disassembling running kernel

I tried running gdb to disassemble the kernel and tried running: root@debian:/home/jestinjoy# gdb /usr/src/linux-2.6.38.8/vmlinux GNU gdb (GDB) 7.0.1-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later…
user567879
  • 5,139
  • 20
  • 71
  • 105
5
votes
1 answer

Can I list all VTable pointers from a core dump?

I have a core dump of a C++ program which was built and run with the GNU toolchain. I can reproduce the executable maybe. How can I find a list of all the vtable pointers, by class name?
Andres Jaan Tack
  • 22,566
  • 11
  • 59
  • 78
5
votes
1 answer

How to stop program in gdb at writing to a particular file known by its name

How can I set a breakpoint in gdb to stop program at every write to a particular file known by its name?
agnonchik
  • 53
  • 3
1 2 3
99
100