gdb

How to use gdb command list to print a function's parameter and return value without pausing?

I want to see which parameter and return value to a function. I use gdb breakpoint command list (gdb command script) as follow: int foo(int) (gdb) break foo (gdb) print $r0 (gdb) finish (gdb) print $r0 (gdb) continue (gdb) end But it print only the parameter. I got the reason from here GDB Breakpoint command lists Any other com...

Source code not showing while debugging in XCode, only assembly

Is there any reason why XCode would fail to show the source code for a specific file while debugging? I have a breakpoint in the file which xcode hits correctly, but all I see is assembly. More annoyingly, this problem only shows up for one specific file (a regular .m file), but no other file. None of my co-workers have this problem, so ...

GDB and shared object libraries with SIGILL

I am trying to debug programs on an ARM target device with GDB and GDB seems to be acting odd with regards to ld-linux.so.3. It's a simple program that just printf("Hello World"). Approximately half the time, gdb it will run and the other half jump to this error after typing run: Program received signal SIGILL, Illegal instruction. 0x2...

GDB 6.3 gives "Cannot access memory at address 0x<32bitval>" when stepping through code

I'm using the gdb debugger to step through my code to verify my logic for sample inputs, but I'm getting this error whenever i'm trying to read the value of any variable/structure/STL object (using print). However, when I'm printing the contents of the address (which gdb allegedly cannot access), I'm reading back the value properly. Any ...

Remote GDB debugging

I've just spent a whole day trying to find a way to enable gdb debugging from QtCreater or Eclipse. I learned that there are basically two approaches to launch the target application: using ssh (ssh host gdb) using gdbserver I was able to use both approaches to launch gdb remotely and start the application. However, GDB never reponds...

Debugging arm-elf C code using Zylin in Eclipse CDT

Hi everyone, I'm using Eclipse CDT with Zylin embedded debug (native) and arm-elf-gdb 6.6 on OS X 10.5.8. I've got an OCD debugger connecting to a board with an ARM processor. Eclipse is able to stop at the first breakpoint and gather variables from memory, but any subsequent breakpoints or single-steps fail. I can set breakpoints ok w...

gdb and GPS: Cannot set a breakpoint on a function or procedure that is part of a protected type Ada object.

I've got a protected object that presents functions and procedures in its interface. In gdb, when I set a bp on the first line of one of those, I get odd results. Here's a snippet from my gdb console: (gdb) (gdb) b database-access_manager.adb:20001 Breakpoint 3 at 0x1a10588: file y:/svs/central_switch/controller/database/ database-ac...

Do you debug C++ code in VIM? How?

The question is to all you people, who use VIM to develop C++ apps. There was a period in my life, which can be described as 'I hate VIM!!!'..'VIM is nice!' However, having grown up mostly on MS Dev IDE, I've got used to those F5-F11 shortcuts when debugging code, watch window, call stack and the main code - all visible vithout need to ...

GDB: unable to read symbols

When trying to run my iOS app on a device, I get the following from GDB, and resulting in my app exiting just right after it started so I never get the chance to debug it. Anyone knows what I'm doing wrong or what I can do to fix it? GNU gdb 6.3.50-20050815 (Apple version gdb-1470) (Thu May 27 05:54:06 UTC 2010) Copyright 2004 Free Soft...

a simple boss-worker model using pthreads

Hi, I'm an amateur programmer that's experimenting using pthreads, to see to what extent a multi-threaded program can lead to efficiencies in a rather long computation I'm working on. The computation runs through a std::list< string > object, popping the first element of the list off, and farming it out to a thread that computes somet...

Input redirection in gdb (MinGW)

I'm trying to get gdb to run programs with input redirection to stdin. For example, without gdb I would run a program like this: prog < input.txt Now in gdb, the usual way to do this is run < input.txt. However, it doesn't work for me and when doing this nothing gets redirected into stdin. I'm using Windows with MinGW. What could be ...

gdb\bfd: get child variable address or size or offset

Hi, I'm using gdb and libbfd to retrieve global variables information from an elf file and show it. I can get the following data from libbfd: Global Variable name, address and size. I retrieve the type of the variables and its children using gdb and gdb\MI (ptype, whatis, -var-create & -var-list-children). How can I get the address\siz...

analysis of core file

hi I'm using Linux redhat 3, can someone explain how is that possible that i am able to analyze with gdb , a core dump generated in Linux redhat 5 ? not that i complaint :) but i need to be sure this will always work... ? EDIT: the shared libraries are the same version, so no worries about that, they are placed in a shaerd storage ...

Strange "No such file or directory" error in cuda-gdb

Hello, I already asked this question in the nvidia forum but never got an answer link. Every time I try to step into a kernel I get a similar error message to this: __device_stub__Z10bitreversePj (__par0=0x110000) at /tmp/tmpxft_00005d4b_00000000-1_bitreverse.cudafe1.stub.c:10 10 /tmp/tmpxft_00005d4b_00000000-1_bitreverse.cudafe1....

gdb and strncmp, register value stored?

Below is my code (test.c): #include <stdio.h> #include <string.h> int main(int argc, char **argv) { char passwd[] = "pass"; if (argc < 2) { printf("usage: %s <given-password>\n", argv[0]); return 0; } if (!strncmp(passwd, argv[1],4)) { printf("Green light!\n"); return 1; } printf("Red light!\n"...

Detect if gdb is running

Hello! I'd like to detect from an application wether gdb is running. The standard way would be the following: if (ptrace(PTRACE_TRACEME, 0, NULL, 0) == -1) printf("traced!\n"); In this case ptrace returns an error if the current process is traced (i.e. running it with gdb or attaching to it). But there is a serious problem with th...

How to run R script with gdb attached?

I have an R script that's usually started from the command line with arguments: ./script.R --width=10 It uses Rscript as interpreter: #!/usr/bin/env Rscript Unfortunately it gives me a segmentation fault when it executes my compiled C code in R using .C("compiled_function"). So how can I run my R script with the gdb debugger atta...

How to look variable at a pointer location in GDB ?

[ipad application] error message at console -[CFSet release]: message sent to deallocated instance 0xbdd9930 * Above is the exception in GDB console, in my iPad Application, I want to see what variable or object is getting released how to do that ? ...

GDB can't access mmap()'d kernel allocated memory?

I'm running into an issue with GDB and some buffers allocated in kernel space. The buffers are allocated by a kernel module that is supposed to allocate contiguous blocks of memory, and then memory mapped into userspace via a mmap() call. GDB, however, can't seem to access these blocks at any time. For example, after hitting a breakpo...

GDB: Watchpoint a fixed address.

For my current embedded application I am trying to put GDB watch point at a fixed memory address. As an example, my application updates the following address: 0x10793ad0. In order to be sure which part of the code is corrupting the value, I tried watch 0x10793ad0 Even though GDB does not print any error after this, it is not able to ...