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
50
votes
3 answers

start gdb using a pid

In general i see the process's pid which is running in the background and start dbx on that process using the command dbx -a similarly how could i do it using gdb?
Vijay
  • 65,327
  • 90
  • 227
  • 319
50
votes
10 answers

How to get a "codesigned" gdb on OSX?

Because I need a Python-enabled gdb, I installed another version via brew tap homebrew/dupes brew install gdb I want to use this gdb with Eclipse CDT, where I entered the path to the binary in the Debugging settings. However, launching a program…
clstaudt
  • 21,436
  • 45
  • 156
  • 239
49
votes
4 answers

View Both Assembly and C code

Do we have a way to view assembly and c code both using gdb. disassemble function_name shows only assembly, I was trying to find a way to easliy map c code to assembly. Thanks
Tectrendz
  • 1,354
  • 2
  • 17
  • 36
49
votes
9 answers

What is the difference between hardware and software breakpoints?

What is the difference between hardware and software breakpoints? Are hardware breakpoints are said to be faster than software breakpoints, if yes then how, and also then why would we need the software breakpoints at all?
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
49
votes
5 answers

How to dump data stored in objective-c object (NSArray or NSDictionary)

Forgive me for a potentially silly question here, but in other programming languages (scripting ones like PHP or Perl) it is often easy to dump everything contained within a variable. For instance, in PHP there are the var_dump() or print_r()…
jpm
  • 16,622
  • 34
  • 63
  • 66
49
votes
2 answers

How to save settings in gdb?

Does anyone know how to save gdb settings (like "set print pretty on" or "set print elements 0", both from here)? I don't want to set my configuration every time that I will use gdb :/ I searched in google and SO, but I found nothing.
coelhudo
  • 4,710
  • 7
  • 38
  • 57
48
votes
7 answers

Why am I getting the message "Single-stepping until exit . . . which has no line number information" in GDB?

I've compiled my C program using gcc 4.4.1 using the flag -g, but when I try to step through one of my functions in gdb version 7.0, I get the message: "Single stepping until exit from function _DictionaryTree_getNodeList, which has no line number…
Steven Oxley
  • 6,563
  • 6
  • 43
  • 55
48
votes
7 answers

How to load multiple symbol files in gdb

How to load multiple symbol files in gdb. I have a executable foo.out and loading a module bar.so. I have created two symbol files foo.symbol and bar.symbol. How to load both the files into gdb. # gdb --core core # (gdb) # (gdb) symbol-file…
Ibrar Ahmed
  • 1,039
  • 1
  • 13
  • 25
48
votes
5 answers

Program received signal SIGPIPE, Broken pipe

I write a client program based on posix sockets. The program creates multiple threads and is going to lock the server. But during debug in gdb time the program gives an info (error) (gdb) n Program received signal SIGPIPE, Broken pipe. [Switching…
user1886376
47
votes
3 answers

gdb doesn't work on macos High Sierra 10.13.3

I have installed gdb 8.1 with brew. I have codesign gdb also and .gdbinit as below: set startup-with-shell off. I have disabled SIP feature: $ csrutil status System Integrity Protection status: disabled. But gdb still doesn't work: #include…
lucky1928
  • 8,708
  • 10
  • 43
  • 92
47
votes
3 answers

Debugging Best Practices for C++ STL/Boost with gdb

Debugging with gdb, any c++ code that uses STL/boost is still a nightmare. Anyone who has used gdb with STL knows this. For example, see sample runs of some debugging sessions in code here. I am trying to reduce the pain by collecting tips. Can you…
amit kumar
  • 20,438
  • 23
  • 90
  • 126
47
votes
3 answers

How to debug a program that takes user input from stdin with GDB?

I have a program and I am trying to debug it using gdb. Inside the program I have methods that require the user to enter an input using stdin. How can I enter this input when I am in gdb? So that I can trace how my methods work?
FranXh
  • 4,481
  • 20
  • 59
  • 78
46
votes
7 answers

Unable to start debugging : The value of miDebuggerPath is invalid

I recently started working on vscode. I wanted to debug my C code. But the moment I am launching the debugger getting Error : Unable to start debugging. The value of miDebuggerPath is invalid. I have my gdb installed on wsl . It's path is…
46
votes
5 answers

How do I stop execution in GDB without a breakpoint?

How do I stop a GDB execution without a breakpoint?
anand
  • 617
  • 1
  • 5
  • 6
46
votes
1 answer

Debugging child process after fork (follow-fork-mode child configured)

I'm developing an application which the parent forks a child to handle certain tasks. I'm having an issue where I've configured gdb to follow-fork-mode child but after fork, after reaching a breakpoint, it sends a SIGTRAP but the child somehow…
ihsan
  • 551
  • 1
  • 5
  • 10