gdb

Using tui option of GDB

Hi All, I am currently working with NS-2(A network Simulator) and I wanted to use the tui option of gdb such that i can view the course code while debugging. (Just like Visual studio) As of now the source window is blank when i run "gdb -tui" . However I can see the file when i do a "list" in gdb, but I am not able to make it go autom...

printing ip addresses using gdb

I am debugging a networking code and want to print ip addresses which are declared as int32. when i print it using gdb print command, i get some values which is not much meaningful. How can i possibly print them in meaningful format? ...

gdb 7.0, signal SIGCONT doesn't break from a pause() call.

I'd built a version of gdb 7.0 for myself after being pointed to a new feature, and happened to have that in my path still. Attempting to step through some new code, I'd added a pause() call, expecting to be able to get out like so: (gdb) b 5048 Breakpoint 1 at 0x2b1811b25052: file testca.C, line 5048. (gdb) signal SIGCONT Continuing ...

making gdb evaluate a multi-line or compound if statement all at once

Up until I started using Arch linux a couple of weeks ago, gdb would evaluate multi-line if statements atomically. So for a condition like this: 39523 if ((RM != NULL) && 39524 (RM->DefaultC != NULL) && 39525 (MSched.RemapC != NULL) && 39526 (RM->DefaultC->FType != mqftRouting) && 39527 (RM->DefaultC != MSche...

gdb backtrace and pthread_cond_wait()

This is on a Redhat EL5 machine w/ a 2.6.18-164.2.1.el5 x86_64 kernel using gcc 4.1.2 and gdb 7.0. When I run my application with gdb and break in while it's running, several of my threads show the following call stack when I do a backtrace: #0 0x000000000051d7da in pthread_cond_wait () #1 0x0000000100000000 in ?? () #2 0x0000000000...

gdb works from command line, but not from script

If I execute each line of this script in console gdb it works as expected (except for detach hanging, but I can work around that.) However, if I save it to a script file and run gdb with the -x option it hangs on the [Visor install] line. It would be nice to know why it's doing this, or even just a hacky workaround for it. The script: ...

gdb - print multiple variables with one command

Hi I want to execute the very simple command print var1, var2, var3, var4 in gdb to examine the values of the vars from time to time. I don't want to use display because it clutters up my view. How can I do this? Right now all I can do is p var1 p var2 p var3 p var4 Worse, when I want to do it again, I have to do all four comm...

GDB gets activated automatically and has 100% CPU activity

Hi, I'm using Debian x64 2.6.26 to host a server application we've written in C++. Sometimes GDB gets activated on its own and it uses 100% CPU time giving no room for other processes to run. The GDB version is 6.8-debian. I don't know why this happens and how may i prevent this. It seems that it only happens when out server application...

GDB can't load dll

I am running windows 7 x64. I recently just set up mingw and gdb on my system. While it appears the debugger works every time I load a app into it I get the following error. Error: dll starting at 0x771c0000 not found. Anyone know what is up with this? ...

NS_INLINE and Xcode debugger

Single stepping through code that uses any of the NS_INLINE functions from NSGeometry.h causes the debugger to lose sync with the current instruction pointer, making debugging the routines very difficult. I've tried #undef NS_INLINE at the top of my implementation file,#define NS_INLINE in the precompiled header, looking for pragmas, co...

Show current instruction in gdb

I'm doing some assembly-level debugging in gdb. Is there a way to get gdb to show me the current assembly instruction in the same way that it shows the current source line? The default output after every command looks like this: 0x0001433f 990 Foo::bar(p); This gives me the address of the current instruction, but I have t...

Peter's GDB Tutorial

About 2 months ago, I found this incredibly great gdb tutorial written by Peter Jay Salzman. It used to be accessible here, but I think the site has gone down for a couple of months now. I found it on archive.org, and wanted to mirror it. I tried wget, HTTPTrack to no avail, they both errored out. Googling didn't reveal much either. ...

Set a file wide breakpoint in gdb

Hello everyone, I'm trying to understand how a piece of code is working. I've enabled a breakpoint for a function, but it looks like it never gets hit. So, I'd like to break whenever ANY function within this class is invoked. Is this possible? Thanks! ...

search for source code location in gdb

When I run gdb with a debug binary(gdb binary name).. I dunno where is the source code for that debug binary is present... But I can set the breakpoint in main and debug the code with correct src code.. I dunno from where the gdb is taking the source code from ... The source code is not present in CWD.... how to find from which location ...

How to make gdb run a user-defined function (defined in .gdbinit) everytime it starts ?

I have a set of basic breakpoints defined in a user-defined fn setup in my .gdbinit. So, every time i start gdb, I have to execute that fn. to set all my brkpoints , before I start debugging. Can I configure my .gdbinit so that whenever it starts , it first executes my user-defined fn setup ? ...

Mac OS X Debug Error

On startup of my application with gdb, I am getting weird errors that look like: unable to read unknown load command 0x22 The whole trace looks something like this: [Session started at 2009-12-17 10:28:24 -0500.] GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009) Copyright 2004 Free Software Foundation, In...

Restoring program state from a core file

Is it possible, under any circumstances, to restore the state of a program to what it was during the generation of a core file? The reason I ask is that in order to take advantage of gdb's ability to execute functions and so forth you need to have a running instance. Surely it should be possible to produce a mock process of the same exe...

[C++] Error linking with C++

I've try to compile this code: #include <iostream> #include <cstdlib> using namespace std; #define ARRAY_TAM 2 typedef int (*operacion)(int, int); typedef const char* (*Pfchar)(); int suma(int, int); int resta(int, int); const char* descrSuma(); const char* descrResta(); const char* simbSuma(); const char* simbResta(); class OP { ...

DDD debugger: save A command history between sessions

I noticed that my command history remains only during the current session, and once I re-start ddd, say with the same process, it starts with a clean slate. Is there way I can force the latest history to persist/reload. I couldn't find any relevant options in Edit-> Preference/GDB sessions. I am using GNU DDD 3.3.9 (i386-redhat-linux...

gdb doesn't print debugging info

hello, when i run the core file in gdb, gdb doesn't show where the error is coming from or what line in the application that causes the problem. i'm using the compiler options -g -DDEBUG -D_DEBUG, but it doesnt seem help. Any help would be appreciated, thanks. ...