This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Porting gdb to Cyclops64
Guys, thanks again for all your help. My target is reporting events in a
sane order in stop mode now but I've run into a snag.
While debugging the following program:
#include <stdio.h> /* line 1 */
void foo(int *a) { /* line 2 */
*a = 9; /* line 3 */
} /* line 4 */
int main() { /* line 5 */
int a=0; /* line 6 */
foo(&a); /* line 7 */
printf("%d\n",a); /* line 8 */
return 0; /* line 9 */
}
I set a breakpoint at line 7. All threads hit that breakpoint. I stepped
thread 1 and continued the other threads.
[Switching to Thread 1]
Breakpoint 1, main () at step.c:7
7 foo(&a); /* line 7 */
(gdb) s
[Switching to Thread 2]
Breakpoint 1, main () at step.c:7
7 foo(&a); /* line 7 */
(gdb) c
Continuing.
[Switching to Thread 3]
... etc.
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1]
0x0000000080800274 in main () at step.c:7
7 foo(&a); /* line 7 */
I switched back to thread 1 and step again:
(gdb) s
foo (a=0x41103ae8) at step.c:3
3 *a = 9; /* line 3 */
(gdb)
I step one more time and gdb switches to thread 2. Why is that?
(gdb) s
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 2]
foo (a=0x41803ae8) at step.c:3
3 *a = 9; /* line 3 */
It turns out that when I stepped to line 3 (the second step) gdb
actually set a breakpoint at line 3. This might be because 'foo' has
been inlined. Then gdb told my target to continue all "vCont;c". All
threads hit the breakpoint, but only thread 1 should have.
I don't know how it's supposed to work, but gdb could have sent
"vCont;c:1". Or gdb could have single stepped until it reached the
correct address (obviously not the preferred method). How can I correct
this?
Thanks,
Brian