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

GDB crashes at start (internal error: follow_die_offset)

I have a small C++ project under Linux. When I try to debug the executable with gdb I get the following error: ../../gdb/dwarf2read.c:16760: internal-error: follow_die_offset: Assertion 'dwarf2_per_objfile->reading_partial_symbols' failed. A problem…
user1304680
  • 700
  • 2
  • 5
  • 18
6
votes
2 answers

Why does access to an unmapped location not generate a hardware exception (Microblaze)

I want to write my code that will handle TLB misses on the Microblaze and through that, of course, the page tables etc. This is all being done on OVPsim. As I am learning as I go I wrote this little piece of assembly to reference an unmapped…
adrianmcmenamin
  • 1,081
  • 1
  • 15
  • 44
6
votes
2 answers

How to get backtrace information from exception in googletest?

I'm trying to do some semi test driven design, and occasionally when I implement a new feature, it will have an exception somewhere. All gtest tells me is what the exception is, and does not give me any backtrace information. If I run gdb --args …
eengineer
  • 177
  • 2
  • 9
6
votes
1 answer

GDB pretty-printing: returning string from a children()'s iterator, but displayed as a char[]

I have a handy class that I use to allow me to easily add a set of "summariser" functions to a GDB pretty printer (for example, a Rect class could have an [Area] field, computed by Python). it then prints all the existing children as well, so you…
Inductiveload
  • 6,094
  • 4
  • 29
  • 55
6
votes
7 answers

Why is gdb requiring root permission to debug user programs?

I have been using gdb quite successfully for a while, but I recently upgraded my version of Ubuntu, and now it seems that I can only get gdb to successfully run my program if I run as root. That is, ~ % gdb -q sleep -ex 'run 60' Reading symbols…
Donna
  • 1,390
  • 1
  • 14
  • 30
6
votes
3 answers

How to debug gdb with itself

I have gdb installed on my machine. Today I have compiled another version of gdb that is running fine. Now I want to debug this new gdb using my older gdb. Please guide me in this regard. How can I know that how gdb reads symbols from the provided…
sbunny
  • 433
  • 6
  • 25
6
votes
2 answers

Continue after SIGNAL with a python script in gdb

I am trying to generate some output on segmentation faults (and other signals) with a python script in gdb. The script looks like this: import gdb def event_handler(event): gdb.execute("set scheduler-locking on") # this is needed to avoid…
Alex
  • 871
  • 7
  • 23
6
votes
3 answers

Getting libstdc++-v3/python

I am trying to download libstdc++-v3/python to enable pretty printing of stl containers. However, my provider returns: svn: Unknown hostname 'gcc.gnu.org' error. This is the command: svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python Is…
vehomzzz
  • 42,832
  • 72
  • 186
  • 216
6
votes
0 answers

GDB on Mavericks doesn't work when connecting via ssh

I have a brew version of gdb installed on Mavericks. It is codesigned and I can debug without issue when connected locally: $ gdb myprog GNU gdb (GDB) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later…
Greg
  • 111
  • 5
6
votes
3 answers

Accessing program information that gdb sees in C++

I have a program written in C++, on Linux, compiled with -g. When I run it under gdb, I can 1) set breakpoints 2) at those breakpoints, print out variables 3) see the stackframe 4) given a variable that's a structure, print out parts of the…
anon
  • 41,035
  • 53
  • 197
  • 293
6
votes
1 answer

Linux effect of ptrace TRACEME call

I have the following code. It simply calls ptrace(PTRACE_TRACEME) before going into an infinite loop. I have two issues: After executing the binary, I can't attach with gdb even if I am root. With ptrace(PTRACE_TRACEME), I can't terminate the…
daehee
  • 5,047
  • 7
  • 44
  • 70
6
votes
2 answers

0xfbad8001 Magic Number in backtrace

I am looking at the following backtrace of a program I am debugging in GDB: Thread 7 (Thread 3983): #0 0xf7737430 in __kernel_vsyscall () #1 0x41b85412 in __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S:142 #2 …
Digital Trauma
  • 15,475
  • 3
  • 51
  • 83
6
votes
4 answers

block output of debugged program (gdb)

I have a program and want to debug it in gdb. Will I see usual program output? How can I enable/disable this output, leaving only gdb messages.
osgx
  • 90,338
  • 53
  • 357
  • 513
6
votes
2 answers

Print values out of a Fortran polymorphic derived data type in GDB

I am trying to debug the following code using gdb (GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) and gfortran (gcc-Version 4.6.3). If I start gdb and step through the subroutine fun, I want to print the variables of the derived type "mytype"…
6
votes
3 answers

Anti-debugging: gdb does not write 0xcc byte for breakpoints. Any idea why?

I am learning some anti-debugging techniques on Linux and found a snippet of code for checking 0xcc byte in memory to detect the breakpoints in gdb. Here is that code: if ((*(volatile unsigned *)((unsigned)foo + 3) & 0xff) == 0xcc) { …
user1726119
  • 381
  • 2
  • 5
  • 16