debugging threads

Heyendal, Carl CHeyendal@stanleyworks.com
Tue Mar 1 20:54:00 GMT 2011


(gdb) show libthread-db-search-path
Undefined show command: "libthread-db-search-path".  Try "help show".

Is this command not available in the crosstools-ng gdb debugger?

If not why are there libthread-db libs created? How do you get gdb to use them?

thanx
/carl h.


> -----Original Message-----
> From: Heyendal, Carl
> Sent: March 1, 2011 11:22 AM
> To: crossgcc@sourceware.org
> Subject: RE: debugging threads
> 
> I was able to resolve my issue.....almost.
> 
> Through trial and error I figured out that I had to set these commands
> in .gdbinit:
> 	set solib-absolute-prefix ......
> 	set solib-search-path .......
> 	handle SIG32 nostop noprint pass
> 	handle SIG33 nostop noprint pass
> 
> Once I did that I was able to set and reach breakpoints in threads, and
> was able to continue to successful completion.
> 
> However, for some reason Eclipse won't show me in the source when it
> reaches a breakpoint in a thread. However I can still continue to
> successful completion.
> 
> I still get gdb traces that indicate it doesn't know where it is when I
> hit the thread breakpoint (see 758,425 below):
> 	758,174 ~"[New Thread 334]\n"
> 	758,180 ~"[Switching to Thread 334]\n"
> 	758,197 15*stopped,reason="breakpoint-hit",bkptno="1",thread-
> id="2",frame={addr="0x000087c8",func="h\
> 	ello_thread_main",args=[],file="hello.c",fullname="/home/heyendal
> /build/projects/CM/hello/hello.c",l\
> 	ine="50"}
> 	758,198 (gdb)
> 	758,414 16-thread-select 1
> 	758,414 17-stack-info-depth 11
> 	758,425 16^done,new-thread-
> id="1",frame={level="0",addr="0x400365b8",func="??",args=[]}
> 	758,425 (gdb)
> 	758,443 17^done,depth="1"
> 	758,443 (gdb)
> 
> So this is obviously not a crosstools-ng issue so I will take this up
> elsewhere, or just use gdb directly.
> 
> /carl
> 
> 
> 
> > -----Original Message-----
> > From: crossgcc-owner@sourceware.org [mailto:crossgcc-
> > owner@sourceware.org] On Behalf Of Heyendal, Carl
> > Sent: February 28, 2011 3:12 PM
> > To: crossgcc@sourceware.org
> > Subject: debugging threads
> >
> > Hi,
> >
> > I'm having trouble debugging threads remotely with Eclipse/GDB.
> >
> > I can set breakpoints and step with Eclipse with no problems when I
> > only have one main loop, but as soon as I add a thread, set a break
> > point in the thread, and then step once after the breakpoint, GDB
> gets
> > confused and stops running....indicating this message: "Cannot find
> > bounds of current function". You can see this message at the bottom
> of
> > the GDB output below.
> >
> > When I run my small test app standalone without GDB, the app runs
> fine
> > to completion. So I'm assuming there's a problem with my libs when
> > debugging. I have double checked that I point to sys-root on the host
> > filesystem, and that the pthread lib is on both the host and the
> target
> > filesystems. Also, all the libs are NOT stripped.
> >
> > Note below that on line 456,245 when it hits a break point in the
> > thread it doesn't know what function it's in. Just before that
> however
> > when it hit the breakpoint, it did know that it was in the new thread
> > by name.
> >
> > I'm using crosstools-ng 1.5.2 which I know it's a bit old but it
> should
> > work.
> >
> > Appreciate any help.
> >
> > thanx
> > /carl h.
> >
> >
> >
> > 442,165 1source ~/.gdbinit
> > 442,166 &"source ~/.gdbinit\n"
> > 442,177 1^done
> > 442,177 (gdb)
> > 442,178 2-file-exec-and-symbols
> > /home/heyendal/build/projects/CM/hello/hello
> > 442,180 2^done
> > 442,180 (gdb)
> > 442,181 3-environment-cd /home/heyendal/build/projects/CM/hello
> > 442,181 3^done
> > 442,181 (gdb)
> > 442,186 4-gdb-set auto-solib-add on
> > 442,186 4^done
> > 442,186 (gdb)
> > 442,187 5-gdb-set solib-search-path /usr/local/xtools/arm-unknown-
> > linux-uclibcgnueabi/arm-unknown-li\
> > nux-uclibcgnueabi/sys-root/lib
> > 442,187 5^done
> > 442,187 (gdb)
> > 442,188 6-environment-directory
> /home/heyendal/build/projects/CM/hello
> > /home/heyendal/build/projects\
> > /CM/hello/.settings
> > 442,189 6^done,source-
> >
> path="/home/heyendal/build/projects/CM/hello:/home/heyendal/build/proje
> > cts/CM/\
> > hello/.settings:$cdir:$cwd"
> > 442,189 (gdb)
> > 442,190 7-target-select remote 192.168.52.167:5001
> > 442,203 ~"[New Thread 336]\n"
> > 442,222 7^connected,thread-
> >
> id="1",frame={addr="0x400009e0",func="_start",args=[],from="/usr/local/
> > xt\
> > ools/arm-unknown-linux-uclibcgnueabi/arm-unknown-linux-
> > uclibcgnueabi/sys-root/lib/ld-uClibc.so.0"}
> > 442,223 (gdb)
> > 442,224 8-break-insert -t main
> > 442,226
> >
> 8^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="
> > 0x000086e8",func="mai\
> >
> n",file="hello.c",fullname="/home/heyendal/build/projects/CM/hello/hell
> > o.c",line="21",times="0"}
> > 442,226 (gdb)
> > 442,228 9-exec-continue
> > 442,228 9^running
> > 442,230 (gdb)
> > 442,363 9*stopped,thread-
> >
> id="1",frame={addr="0x000086e8",func="main",args=[],file="hello.c",full
> > name\
> > ="/home/heyendal/build/projects/CM/hello/hello.c",line="21"}
> > 442,363 (gdb)
> > 442,382 10-thread-list-ids
> > 442,386 10^done,thread-ids={thread-id="1"},number-of-threads="1"
> > 442,387 (gdb)
> > 442,420 11-thread-select 1
> > 442,420 12-stack-info-depth 11
> > 442,422 11^done,new-thread-
> >
> id="1",frame={level="0",addr="0x000086e8",func="main",args=[],file="hel
> > lo\
> >
> .c",fullname="/home/heyendal/build/projects/CM/hello/hello.c",line="21"
> > }
> > 442,423 (gdb)
> > 442,423 12^done,depth="1"
> > 442,424 (gdb)
> > 442,425 13-stack-list-frames
> > 442,425
> >
> 13^done,stack=[frame={level="0",addr="0x000086e8",func="main",file="hel
> > lo.c",fullname="/home\
> > /heyendal/build/projects/CM/hello/hello.c",line="21"}]
> > 442,425 (gdb)
> > 442,628 14info threads
> > 442,629 &"info threads\n"
> > 442,651 ~"* 1 Thread 336  main () at hello.c:21\n"
> > 442,652 14^done
> > 442,652 (gdb)
> > 449,292 15-break-insert
> > /home/heyendal/build/projects/CM/hello/hello.c:48
> > 449,292
> >
> 15^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr
> > ="0x00008794",func="h\
> >
> ello_thread_main",file="hello.c",fullname="/home/heyendal/build/project
> > s/CM/hello/hello.c",line="48"\
> > ,times="0"}
> > 449,292 (gdb)
> > 450,969 16-exec-continue
> > 450,970 16^running
> > 450,973 (gdb)
> > 456,004 ~"[New Thread 338]\n"
> > 456,007 ~"[Switching to Thread 338]\n"
> > 456,020 16*stopped,reason="breakpoint-hit",bkptno="2",thread-
> > id="2",frame={addr="0x00008794",func="h\
> >
> ello_thread_main",args=[],file="hello.c",fullname="/home/heyendal/build
> > /projects/CM/hello/hello.c",l\
> > ine="48"}
> > 456,020 (gdb)
> > 456,229 17-thread-select 1
> > 456,230 18-stack-info-depth 11
> > 456,245 17^done,new-thread-
> > id="1",frame={level="0",addr="0x400365b8",func="??",args=[]}
> > 456,246 (gdb)
> > 456,267 18^done,depth="1"
> > 456,267 (gdb)
> > 493,200 19-exec-next 1
> > 493,201 19^running
> > 493,205 (gdb)
> > 493,205 &"Cannot find bounds of current function\n"
> > 493,205 19^error,msg="Cannot find bounds of current function"
> > 493,205 (gdb)
> >
> >
> > --
> > For unsubscribe information see http://sourceware.org/lists.html#faq
> >



--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list