Can't debug: assert error with gdb (no problem without)
I'm sorry if the title is really criptic, but I don't know how to phrase my problem.
I know I can't really ask for a solution, and I normally wouldn't but this is really escaping my abilities.
Antefacts.
I developed a program using the zeromq messaging library.
I got to a point where the program works and then started going multithreading: moving a message poller outside of the main thread.
This is supported by the library.
So I devised my thread, passed it a pointer to some parameters (including the pointer to the zmq context) and went ahead.
The Problem
The code in the child thread is the same code I had in the parent, save for the facts that functions parameters are stored in a structure that gets passed to the child.
I followed every function in the child and the parameters are correct.
The code does even work (as it should) when run normally, but hangs with an assert when run in debug.
I tried following every function I could, built the library with debug symbols, using gdb from the console...
I got nothing useful.
I still don't understand why it fails with the debugger attached, and why it runs without.
The culprit code is the following
from pgm_socket.cpp:301
And here are a couple gdb outputs
There is supposedly no way (and no reason) to jump from line 301 to 376, yet it happens.
After that there is a
that triggers the assert that kills my code.
And I'm banging my head over this without so much as a hope of understanding what to do.
I can't really hope for a solution with this, but at least a suggestion as to how to proceed.
My code (if anyone really wanted to check it out) on github is under the project "saettang".
, I can post the code no problem, this is the smallest minimal example iI couldd devise.
(android won't let me paste the code... I'll have to get to my computer.
Although even when I'll be able to show you the code, you'll still need the library cited above http://github.com/erupter/saettang
What value do pgm_error->domain and pgm_error->code have?
No matter how I compiled the relative library, the values are optimized out.
I tried explicitly configuring with -O0 but to no avail.
Here is my minimal test code.
It requires the Zmqcpp library found in my github project, as well as ZeroMQ library 3.2.2 compiled with pgm support.
If you literally cut&paste the msgsubscriber inside the main thread, obviously modifying the passed parameters, you can both run and debug the code.
As it is you can't.
warning: Source file is more recent than executable.
Not really, I had modified the phrasing of the if to see if gdb behaved any differently. It didn't.
Quote:
Originally Posted by jim mcnamara
Just because gdb shows line #1 of a multiline construct does not mean that line #1 of your if block is the problem.
If you actually want to debug it, break the if's into singletons(this is logical decompostion to monads, so by a theorem by Courcelle):
That's not exactly the problem: the if gives way to a goto statement.
But if any of the conditions triggered the conditional to go fordward, gdb ought to show the call to the goto instruction... at least for what I know.
It instead shows the program as jumping directly to the first line after the goto label.
If then it isn't so, I'll separate the various ifs.
I tried your suggestion anyway.
And here is the output of gdb, i interleaved the step instructions with info locals to show the value of do_this
As you can see up to the last instruction do_this is zero, yet the jump happens anyway.
Some background:
The application normally runs on an embedded platform. Currently, for development purposes, I have the rootfs located @ /exports and the target is communicating over NFS. That way I can make a change on my local system, save the application @ /exports, and run the altered... (4 Replies)
Hi,
Can anyone explain this please..... This is on AIX with GDB (tried a few versions). It only happens when program compiled in 64 bit and only with static variables....
A simple test program...
### snip
#include <stdio.h>
main() {
static int n;
n = 6;
printf("hello %d\n", n);... (0 Replies)
I have added some code in my file.
I have created executable rpm file of our code and also I have created debuginfo and debugsource files and installed all three.
But when I debug in gdb I see the the code changes in soucre file. But the break point does not hit at that place as if it did not... (1 Reply)
I hope this is the right thread - not sure if it belongs in the Linux forum. Anyway, I'm having an issue with ddd and gdb. When using ddd to run gdb, there are extra parameters being appended, and my program is picking them up.
I'm running on Ubuntu 11.04...
Here's my command line entry -
... (1 Reply)
Hi All
I know How to attach a process to beubg it .But for my application I am using client as well server.Both are two separate process .Suppose I need to debug both .How to attach both of them together .Or I have to attach them separetly .
Suppose client process id is 1325 and server is... (2 Replies)
Hi all,
(gdb) target remote 192.168.185.196:1389
Remote debugging using 192.168.185.196:1389
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x2fbd0800 in ?? ()
(gdb) l
1 ... (0 Replies)
I created one file (test.cpp)and complied it and get the executable file(test) and run it.It is giving the out put but when I am trying to debug that executable.I am getting the error --
please tell me the solutions??
Thanks in advance ..... (2 Replies)
If an executalbe file has several parameters, gdb can not pass parameters correctly. Let us see:
run:
./executablefile1 agr1 arg2 arg3
debug:
gdb executablefile1
run executalbefile1 arg1 arg2 arg3
then argv : executablefile1
argv : executablefile
argv : arg1
... (3 Replies)
I have to compile gnu-gdb 6.7 on HP-UX 11.11 with /usr/local/pa64/bin/gcc 64-bit compiler, but I'm having some problems during "make":
ser-tcp.c: In function `net_open':
ser-tcp.c:207: warning: passing arg 5 of `getsockopt' from incompatible pointer type
make: *** Error 1
make: Leaving... (8 Replies)
Hi,
I don't know if this is HP-UX specific, but I'll take my chances with this forum. ;)
I'm using WDB 5.7 on HP Itanium 11.23.
'file' on my executable shows:
ELF-32 executable object file - IA64
The problem is with viewing the contents of the variables.
Following is a sequence that... (0 Replies)