Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Nov 2000 01:33:21 +1000 (EST)
From:      andrew@ugh.net.au
To:        freebsd-hackers@freebsd.org
Subject:   gdb & threaded application
Message-ID:  <Pine.BSF.4.21.0011060126430.35048-100000@starbug.ugh.net.au>

next in thread | raw e-mail | index | archive | help
Hi,

I have a program compiled with -pthread and I'm trying to use gdb to debug
it. I run the program in one window and then try to attach to it from
another. I have put a sleep 10 in the program so I can catch it before it
enters the section I want to debug. This is what I get:

Attaching to program: /usr/home/andrew/work/msgs2/msgs, process 10063
Reading symbols from /usr/lib/libc_r.so.4...done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
0x280b7368 in _thread_sys_poll () from /usr/lib/libc_r.so.4
(gdb) n
Single stepping until exit from function _thread_sys_poll, 
which has no line number information.
0x280b674f in _thread_kern_sched_state_unlock () from /usr/lib/libc_r.so.4
(gdb) n
Single stepping until exit from function _thread_kern_sched_state_unlock, 
which has no line number information.
0x280b5f99 in _thread_kern_sched () from /usr/lib/libc_r.so.4
(gdb) n
Single stepping until exit from function _thread_kern_sched, 
which has no line number information.
0x28078a70 in _init () from /usr/lib/libc_r.so.4
(gdb) n
Single stepping until exit from function _init, 
which has no line number information.
Error accessing memory address 0x158: Bad address.
(gdb) n
Single stepping until exit from function _thread_kern_sched, 
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x280b591f in _thread_kern_sched () from /usr/lib/libc_r.so.4
(gdb) q
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /usr/home/andrew/work/msgs2/msgs, process 10063,
thread 1
ptrace: No such process.
(gdb)

To get out of gdb I need to suspend and kill it. Now this certainly isn't
the behaviour I get when running it without the debuger. I haven't spawned
any threads at this point.

Any ideas what I'm doing wrong?

Thanks,

Andrew



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0011060126430.35048-100000>