gdb

how does gdb work?

I want to know how does gdb work internally. e.g. I know a brief idea that it makes use of ptrace() system call to monitor traced program. But I want to know how it handles signals, how it inserts new code, and other such fabulous things it does. ...

Break on debug message in GDB

Is it possible to have GDB break each time it receives a debug log message? ...

What does the second column in the gdb stack trace mean?

I have a stack trace that looks like this: #3 0x00007fffde86c206 in GetMedia (p_ml=0xb91560, id=<value optimized out>, select=ML_MEDIA, reload=<value optimized out>) at ../../../modules/media_library/sql_media_library.c:1170 #4 0x00007fffde86a7d0 in GetInputItemFromMedia (p_ml=0xb91560, i_media=12276000) at ../../../modules/media_libr...

gdb print inconsistency

I have some code int main(int argc, char* key[] ) { cout << strlen(key[1]) << endl; cout show 4. now using gdb (gdb)print strlen(key[1]) shows -147660784 What is the reason for this difference? ...

Debug 32 bit application with gdb in 64 bit environment

Hi all; Is there any specific step required to debug 32 bit application with 64 bit gdb under 64 bit O.S. Normally I use -m32 switch for gcc, is there something like for gdb? ...

gdb debugging arm app. under windows

Hi i want to debug my programms which are cross compiled on windows for arm architecture by using the codesourcery gcc. I have the following things debugging: sam-ice jtag/jlink debugger arm-none-eabi-gdb when i use the command line inteface arm-none-eabi-gdb programm.elf i cannot run the programm under windows. under eclipse i get so...

Core dump file not generated on segmentation fault

Hello, I am trying to debug a segmentation fault caused by my C program using gdb. A core dump file is not automatically generated when i run my program,and i have to run the command ulimit -c unlimited for a core file to be generated on the next run. Why is a core dump file not generated automatically and why do i have to run the ulimi...

Debugging MacOSX Cocoa applications with command line gdb (without XCode)

I use a cross platform toolkit which wraps Objective-C so i do not/can not use XCode. Just the pure command line and plain old makefiles. I compile my source code with "gcc -Wall -g -O0 " but when running it under gdb control i do not get the stack frames or valid source code lines. First: What can i do to get this work. Second: How ca...

how to list class methods in gdb?

I've been googling for this and checking through the gdb manual but can't seem to find an answer to what I'm trying to do. Is there a way to get gdb to print out a listing of all the methods for a given class type? The print command only seems to show the data members and fields, none of the methods are displayed for it. Additionally, ...

gdb: how does it get the information of the executable?

We can set breakpoint at a func, hence gdb knows the entrance and exit address of a certain function. But how does it get this information? Does it uses DWARF or readelf for the executable, if yes, how? Thanks ...

how to setup breakpoint in gdb with shared library function

I have problem with gdb, it wasn't stop in one function. Can you explain why and how to stop program after calling strcpy? grzes@trampek:~/poligon$ gdb ./char_array2 GNU gdb (GDB) 7.2 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt; This is free software:...

GDB Quirks with Thread Process

I am debugging a process with multiple threads in GDB. I compiled the sole source file with the -g flag. However, while running in GDB, the following scenario occurs: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7fe2b70 (LWP 2604)] 0x00000011 in ?? () Prior to the switch, the particular thread executes...

Shouldn't Xcode/gdb load the ~/.gdbinit file on launch?

I have a ~/.gdbinit file which is loosely based on http://stackoverflow.com/questions/1237830/how-do-i-set-these-break-points-in-gdbinit. Allegedly, gdb is supposed to source ~/.gdbinit when it launches. However, it's not loading mine - I have to stop at an existing breakpoint and type in 'source ~/.gdbinit', and then it loads it. Is ...

Is it possible to do hot code swapping in C ?

this en.wikipedia.org/wiki/Hot_swapping#cite_note-1 says that VS can do it with the help of its debugger. Does gdb provide a similar functionality ? this is the closest i could find, but doesn't seem to be ready to be used: http://www.aitdspace.gr/xmlui/handle/123456789/219 dlopen/dlsym/dlclose are also close, but will not work for ...

Eclipse CDT Debugging (An External Process) and Finding Its Source Code

When I attempt to debug a external process with Eclipse CDT, I'm able to attach to it, but I cannot get the debug configuration to find the original C source. When I launch the debugger with the process running within Eclipse, I can get the debugger to find the source code. It is only when attaching to an external process that CDT doesn...

GDB-based Debugger: configuration for specific GDB?

Hi All, I am developing embedded software for an ARM-based target. The target software is compiled/linked using gcc (arm-none-eabi) and debugged using GDB (arm-none-eabi). The tool-chain has been successfully validated. To easy debugging of software I would like to use a graphical debugger interfaces based on GDB. The candidates are DDD...

C++ specific debugging tricks with gdb

What are some of your favorite tricks to debug C++ programs with gdb ? Interested in all tricks but also how you call methods (which may be virtual) on objects from within gdb inspecting STL objects (pretty printing them) preventing gdb from going into STL code with continue dealing with inlining, threads, tcmalloc (or custom allocat...

Strange SEGFAULTS using fprintf

I'm having a very tough time debugging a multi-threaded C application that I've made a few changes to. I've been unable to use GDB to help identify the issue(see below code for more info). The following code is from one of the tasks that is opened in its own thread. I've snipped out most of the code following the problem. void tskPr...

Codeblocks debugger stopping in all Assimp Library Functions

0 00000000 __Static_initialization_and_destruction_0(__initialize_p=1,__priority=65535) 1 0054F273 global constructors keyed t _ZN6Assimp18ObjFileMtlImporterC2ERSt6vectorIcSaIcEERKSsPNS_7ObjFile5ModelE() 2 00553B62 __do_global_ctros() 3 00000000 0x00401095 in __mingw_CRTStartup() 4 00000000 0x00401148 in mainCRTStartup() I'm using...

Why do I get missing DLL errors debugging my Fortran code using GDB on Windows 7 64-bit (using Eclipse/Photran/Cygwin)?

My setup is as follows: OS: Windows 7 Home Premium 64-bit Eclipse: Helios 3.6.1 64-bit with CDT and Photran Java SE Runtime Environment: 1.6.0_21 Java Hotspot: 64-bit Server VM (build 17.0-b17, mixed mode) Cygwin 1.7.2 (32-bit) My initial test Fortran application simply prints 'Hello World!' and exits. The code builds and runs fin...