gdb

No Local Variable or Arguments in Xcode 3.2/iOS 4?

I've updated a project to Xcode 3.2 and the iOS 4 SDK, and now, I don't get any local variables or arguments in gdb. I've confirmed that Debug Information Format is (still) set to "DWARF with dSYM File," the compiler is GCC 4.2 (no LLVM or Clang), and GCC_OPTIMIZATION_LEVEL is 0. Any thoughts about what I might be doing wrong? ...

How can I make gdb save the command history?

How can I set up gdb so that it saves the command history? When starting a new gdb session I'd like to use the arrow up keys to access the commands of the previous sessions. ...

finding type of function arguments with gdb

I'm working on reversing some private functions in CoreTelephony for iPhone. Reversing objC is no biggie, but I can find the type of the arguments for example of _CTServerConnectionCreate. if I break at _CTServerConnectionCreate and use "info args" it will fail because no symbol table info is available :( If I switch to that frame and us...

save gdb display to a variable

Is there a way to store the output of the last command in gdb to a string? What I would like to do is store the address information of selected machine level instructions. Redirecting the output is not a solution as it would generate too much output. A simulator would also be a solution, but I'd like to see if it would be possible with g...

How attach code to a running iphone app.

Hi, I am trying to fix a random hang in my iphone app. I could not regenerate the hang from launching it from the xcode. Is their any way to attach xcode debugger, as soon as I detect the hang? (I can attach it to 'instruments') but it did not much help. ...

gdb stops with too many watchpoints when there is only one

Hi, Do you know any other reasons why a watchpoint could not be inserted other than too many hardware breakpoints/watchpoints? I have the following debug session: GNU gdb (GDB) 7.1 ... (gdb) watch itrap_t_beg[1][222] Hardware watchpoint 1: itrap_t_beg[1][222] (gdb) cont Continuing. ... Hardware watchpoint 1: itrap_t_beg[1][222] ... (...

Why is GDB so slow when I type I try to print an invalid symbol?

When I execute in GDB: p some_nonexistant_variable_name GDB takes minutes (sometimes) to report that it can't find the the variable in scope. Additionally when I type: p some_variable_that_is_in_scope->toString() it takes forever...sometimes. Not sure why. I'm using UBuntu 10.04, running GDB through Emacs 23. Any ideas? ...

how to convert bytes to a string in gdb

i have a word written like 0x46697273 how i can read symbols in gdb console ? ...

How do I debug code that segfaults unless run through gdb?

That's a single threaded code. In particular: ahocorasick Python extension module (easy_install ahocorasick). I isolated the problem to a trivial example: import ahocorasick t = ahocorasick.KeywordTree() t.add("a") When I run it in gdb, all is fine, same happens when I enter these instructions into Python CLI. However, when I try to...

Debugging using emacs

Hello, GNU Emacs 23.2.1 GCC 4.4.4 I am using gdb-many-windows to debug. I am just wondering is there anything better? At the moment I am debugging a linked-list. The list is not that big. However, it would be nice to see all the elements' values. Instead of having to 'print sorted_queue->next->seconds' all the time. The watch comm...

Xcode debug with iPhone app is slow and laggy

I am debugging an iPhone app I'm writing in Xcode, but sometimes now the debugger (which is GDB) slows a lot (doing a step-by-step debugging) and becomes unresponsive sometimes (the icons for stepping-in, stepping-over, stepping-out are not clickable), after sometimes it gets back to normal and continues and other times it stay like that...

Why does gdb tell me a pointer is 4 bytes on x86-64?

Seen with gdb on openSUSE, CentOS, Fedora, and Ubuntu: This gdb was configured as "x86_64-unknown-linux-gnu". (gdb) p sizeof(void *) $1 = 4 (gdb) p sizeof(long) $2 = 4 Why is gdb giving me the wrong answers on all of my 64-bit systems? ...

Can gdb automatically attach a process on a SIGSEGV

Hi, I have a faulty program that when execute receive a SIGSEGV. I can use gdb like this: $ gdb ./prog But I would prefer that gdb catch the SIGSEGV from prog and attach it automatically. $ ./prog Segmentation Fault (gdb) ... Is there a way to do that? Thanks ...

GDB breakpoints confused after a function call?

I have a program that depends on an external shared library, but after a function inside the library gets executed I lose the ability to use breakpoints. I can break and step like normal up until I execute this function, but afterwards it is finished it never breaks. It won't even break on main if I try and use start for the second ti...

Help required with pthreads debugging

Hi, I have a server-client program in which there are multiple threads in both the server and client. There are variable number of clients and servers (like 3 servers (replicas), 10 clients). I am debugging a source file in this program. I think there is some kind of deadlock, possibly the following: A mutex lock is already held by a se...

what does "BUS_ADRALN - Invalid address alignment" error means?

We are on HPUX and my code is in C++. We am getting "BUS_ADRALN - Invalid address alignment" in my executable on a function call. What does this error means? Same function is working many times then suddenly its giving core dump. in GDB when i try to print the object values it says not in context. Any clue where to check? Thanks in Adv...

Watch content of stl vector via gdb

Hi there! I've got a stl vector of custom class objects defined in a global namespace (yeah, evil, I know). Now I would like to set a watchpoint in gdb to monitor possible changes in a (public) member variable for a certain element of this vector. Something like: watch custom_namespace::vec[123].aVariable If I do this, then gdb (Vers...

XCode debugger hangs on breakpoints

Hi, I'm debugging a project for iOS 4.0 (simulator) in XCode 3.2.3, and all of a sudden the debugger just stopped working on me. It will hit the first breakpoint and freeze. It will not respond to single stepping, continuing, pausing, etc. I know I'm not the first person to complain about the XCode debugger, so does anyone have any sor...

Can gdb make a function pointer point to another location?

I'll explain: Let's say I'm interested in replacing the rand() function used by a certain application. So I attach gdb to this process and make it load my custom shared library (which has a customized rand() function): call (int) dlopen("path_to_library/asdf.so") This would place the customized rand() function inside the process' m...

Program runs with gdb but does't run with ./ProgramName

I am writing an editor in assembly 64bit mode in linux.It runs correctly when I debug the program in GDB but it does not run correctly when I run it normally it means it has runtime errors when I use ./programName . ...