How do I detect in my program that it's being run under a debugger? I am aware that this seems to indicate that I try to do something I shouldn't, and that is too messy. I think it is an interesting question tho. Specifically, is there a way to do it in a POSIX environment? For example using sigaction (2) to detect that some handler ...
Hello!
Using gdb, I have encountered a strange issue: there is a method which appears three times:
(gdb) b Logger::Logger
[0] cancel
[1] all
[2] Logger at src/Logger.cpp:52
[3] Logger at src/Logger.cpp:52
[4] Logger at src/Logger.cpp:52
From the fact that all three instances are on line 552 of the file Logger.cpp, it can be deduced, ...
So, as soon as I hit a breakpoint in some thread, is it possible to halt other threads until I continue?
...
I am debugging a Cocoa application using xcode-gdb. I am at a break point and I want view the value of some Cocoa constants (ie NSControlKeyMask) and to do some test with the values in the current stackframe. Specifically I am in - (void) keyDown:(NSEvent *) e , and I have done set $mf = (int)[e modifierFlags] on the gdb prompt. Now ...
Hi everyone,
I need to debug an objective-c program.
When setting a breakpoint on main() function , I've got:
Reading symbols from /usr/bin/pbcopy...done.
(gdb) break main
Function "main" not defined.
Invoking "start" from reply the same error.
I suspect the way of doing things is different on max os x ?
What is the equivalent with o...
I have big system that make my system crash hard. When I boot up, I don't even have
a coredump. If I log every line that
get executed until my system goes down. I will find that evil code.
Can I log every source code line in GDB to a file?
UPDATE:
ok, I found the bug. It was nasty. The application I started did not
take the system d...
Can anyone recommend a good cheat sheet for gbd? I'm experienced with windbg commands, I'm looking for gdb equivalents for lml (list loaded modules), ~*k (all threads stack), ba (break on access), dt (dump type), dv (dump frame variables), sxe (set up SEH handler) etc.
I understand there won't be a 1 to 1 equivalent, but I just need a co...
Is there an equivalent in dbg/cocoa/apple word for the Microsoft public symbol server and windbg (http://msdl.microsoft.com/download/symbols)? So basically 1) does gdb support the concept of a symbol server and 2) does apple supply a public URL for their own public symbols?
...
Consider a tail recursive factorial implementation in C:
#include <stdio.h>
unsigned long long factorial(unsigned long long fact_so_far, unsigned long long count, unsigned long long max_count){
if (max_count==0 || max_count==1 || count >= max_count)
return fact_so_far;
else
{
printf("%llu %p \n", count, &factorial);
...
For debugging php code I use MacGDBp but it has its quirks: it shows only the top frame variables of the stack, it sometimes refuses to display any variable at all and last version has decorates the source text with non ascii characters.
Is there any alternative that is native OS X? (ie. not Eclipse, I can't stand it).
...
Hi,
I am going to start up gdb from python.
For example:
prog.shell.py:
#do lots of things
#
#
p.subprocess.Popen("gdb --args myprog", shell=True, stdin=sys.stdin, stdout=sys.stdout)
But the gdb is not invoked as I expected, the interaction with gdb is broken. I have also tried os.system(), but it still doesnt work....
I have a core dump sitting on disk, created by an app that failed an assert and aborted. The app was compiled in debug mode on Linux/g++. I suspect that in the stack frame at the top of the stack, my this object has been delete'd (I think this is no longer a valid ptr). However it could take days or longer to reproduce this abort.
Is th...
I found examples on how to debug your unit test in Cocoa or the ADC page here.
But I can't get the debugging to work for an iPhone app target. I can get the tests up and running and they are run during the build, but what I need is to debug the tests for some of the more complex failures.
...
The following code creates me an array of all my contacts in my address book by first name and last name. The problem is, I have one contact that keeps showing up with an empty first name and last name. I can't find that contact in my actual address book. Can anyone suggest how to debug this to figure out the source of the mystery ghost ...
I wrote a very simple Qt program here:
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QTableView table(&frame);
table.resize(100, 100);
table.show();
return app.exec();
}
And when I try to set a breakpoint where the table gets clicked, I get this error from gdb:
(gdb) symbol-file /usr/lib/libQt...
Hello all,
I have one binary and one shared library.
The shared library is compiled with:
all:
g++ -g -shared -fpic $(SOURCES) -o libmisc.so
the binary is compiled with:
LIBS=-L../../misc/src
LDFLAGS=-lmisc
all:
g++ -g -o mainx $(INCLUDE) $(SOURCE) $(LIBS) $(LDFLAGS)
I set in ~/.bashrc
export LD_LIBRARY_PATH=/mnt/sda5/Programming/m...
Hey Guys,
I recently discovered that you can set breakpoints in Xcode that will print to the console and auto-continue -- meaning you can insert log statements without having to write NSLog() calls and recompile (on-the-fly logging, woot).
Only problem is that it seems to be a little limited in what you can display when doing a log.
It...
In a kde3 game called ksirtet (a tetris clone) when playing against a computer the human player cannot move the tetris piece left/right. I'm trying to fix it but cannot debug in gdb. After the line "kapp->exec()" gdb stops responding, the game runs and I cannot input any command do gdb to see what's going on. So the question is about deb...
I'm trying to get accustomed to using Emacs for building and debugging, although I'm having some difficulties. My biggest problem right now is that I need to be in (e.g. have a file open in) the root directory to make -k my applications and I need to be in the binaries directory to run gdb MyApp.
Is it futile to try to get Ctrl+Shift+B ...
I've been doing some work on an unfamiliar codebase that uses UChar* as strings. Uchars are defined as follows (at least according to gdb)
(gdb) ptype UChar
type = short unsigned int
However, when I try to print these in gdb, I just get the address. I can also index into the pointer and retrieve the values of each character.
Is there...