gdb

Remote programming and debugging

Hi there, I have to program a C/C++ application. I have windows and linux (ubuntu 9.04) in my machine, and can program in both of them (via gcc/code blocks/vim,etc). The problem is that the executable is going to be run in a Unix (not linux) machine (will have access to it in about 20 days). My Team Leader doesn´t want all of the code...

problem debugging with Code::Blocks on Ubuntu using gdb

Hi! I just started programming C++, first in ms Visual c++, then in Code::Blocks. The problem is that on my computer, running Ubuntu, Code::Blocks "out of the box" does not debug, even the default "hello world", it just skips all breakpoints and finishes the program. I have a virtualized Windows machine using Sun's VirtualBox and the ...

Breakpoints out of nowhere when debgging with gdb, inside ntdll

Hello all, I made a very simple program which automates some things for me.I wrote it in c++ and it runs on Windows. While debugging it with GDB from inside the Codeblocks IDE , I get many breakpoints out of nowhere. I have no idea what might be causing this problem. The breakpoints seem to be related with memory issues ... since when I...

Ubuntu desktop development environment (GNU tools)

I am setting up a Linux development machine (Ubuntu 9.0.x). I want to know the best development environment for a C++ developer on Ubuntu - giving my background (see below). 5 years+ C++ 5 years Visual Studio Not much experience using GNU tools (GCC, GDB, make, etc.) 6 months or so of using Emacs at university (about 8 years ago!) - ...

gdb detaching after fork from child process - disable?

Getting this message inside gdb. I know its not an error or anything. I also did pagination so thats not an issue. Is there any way to suppress this message? ...

How can I truncate the mangled C++ identifiers shown by GDB's disassemble command?

GDB's disassemble command is nice for short C identifiers, e.g. main. For long, mangled C++ identifiers the verbosity is overkill. For example, using icpc I see results like (gdb) disassemble 0x49de2f 0x49de5b Dump of assembler code from 0x49de2f to 0x49de5b: 0x000000000049de2f <_ZN5pecos8suzerain16fftw_multi_array6detail18c2c_buffer_p...

Debugging C++ from core files with GDB

GDB seems to always just work for C programs, but for C++ I often get these cryptic stacks: (gdb) bt #0 0x08055fa4 in std::runtime_error::what () #1 0x080576c8 in std::runtime_error::what () #2 0x08057dda in std::runtime_error::what () #3 0x080580d2 in std::runtime_error::what () #4 0x08058662 in std::runtime_error::what () #5 0x0...

What caused the mysterious duplicate entry in my stack?

I'm investigating a deadlock bug. I took a core with gcore, and found that one of my functions seems to have called itself - even though it does not make a recursive function call. Here's a fragment of the stack from gdb: Thread 18 (Thread 4035926944 (LWP 23449)): #0 0xffffe410 in __kernel_vsyscall () #1 0x005133de in __lll_mutex_loc...

Quick way to find what thread asserted in gdb?

When my Cocoa app hits an assertion in the code, gdb gives me a prompt as expected, but it's never (ok, rarely) in the right thread. I know I can use Xcode's GUI debugger and it makes it a little less painful, but I'm thinking there has to be a gdb command line trick I don't know. Is there an easier way of finding the thread that asse...

Debugging unit test in C using check

I'm trying to use check unit testing framework for my C application. But I can't use the debugger (gdb) with it because of two points: first, check use some complex macros (START_TEST et END_TEST) and the debugger has trouble to put a breakpoint in my code between these two macros (in fact, I can put a software breakpoint but It is ne...

How to "watch" a C++ dynamic array using gdb?

Consider the following example: int size = 10, *kk = new int[size]; for (int i = 0; i < size; i++) { kk[i] = i; } delete [] kk; How can I add a watch for the whole array? I can add a watch one by one (kk[0],*kk[1]*...), but since I know the array's length is there a way to do it automatically? I mean something like kk[0..size-1]...

How can I debug St9bad_alloc failures in gdb in C?

I have a program failing with: terminate called after throwing an instance of 'std::bad_alloc' what(): St9bad_alloc I imagine it's something to do with malloc/free, but I don't know which one. What breakpoint can I in gdb set that will break on the error so that I can view a stack trace? The program is a combination of C and C++,...

debugging templates with GDB

Hi all. My gdb is GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh). And I can't debug templates. Can anybody help me? How can I debug templates with this debugger? Thanks. ...

ddd hangs on start

When I start ddd, it seems hang waiting for gdb. Here is the tail end of output ddd --trace: # Saving session in "/home/kbrandt/.ddd/sessions/106d7eb3d567f23b01125736049734486400000041300582/init"... # Saving session in "/home/kbrandt/.ddd/sessions/106d7eb3d567f23b01125736049734486400000041300582/init"...done. 2009.11.04 13:48:17 <- "...

debugging a thread process using gdb/dbx

This might be genuine question but i am asking here since i was out of any clue when i was asked this question in an interview. how could we debug a thread which was created by another thread? let's say there is a main process and it calles the function pthread_create to create a thread process which is not joinable and that means both ...

Debugging shared libraries remotely with gdb/gdbserver

My question is about remote debugging an application on an embedded arm processor using gdb/gdbserver. I can debug the application itself, but the application dynamically links to a shared library which implements an in house communications protocol. I want to be able to set breakpoints within the shared library functions so try to fig...

Multi-threaded debugging tutorial for GDB and C

Does anybody know of a good GDB (or other Linux debugger) tutorial for debugging multi-threaded C code? I'm looking for one that includes simple examples. ...

Inspect Bison's $$ variable with GDB

If I set a breakpoint in a Bison .y file, is there a way I can inspect the contents of $$ pseudo variable at that breakpoint? ...

DDD Alternative that also Draws Pretty Pictures of Data Structures

Is there anything other than DDD that will draw diagrams of my data structures like DDD does that runs on Linux? ddd is okay and runs, just kind of has an old klunky feeling to it, just wanted to explore alternatives if there are any. The top part with the grid of this image is what I am talking about: ...

Which version of m4 does the author of Debugging with GDB use?

I am trying to learn how to debug programs with gdb following Debugging with GDB.The first chapter of this book present a sample seesion to debug programs.My question is where could I get this buggy verion of m4?I want to redo this sample debug seession. thanks. ...