2010-03-26 09:42:36     gdbserver

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-03-26 09:42:36     gdbserver

Filip Vanalme (BELGIUM)

Message: 87737   

 

We have a multi-threaded application. I would like to debug it with gdb. Therefore, I start gdbserver on our board and use Eclipse's debugging environment. I can set a breakpoint and let the application run till that breakpoint. Up to there, everything is working fine. However, when I try to continue the program, it looks like it don't want to continue. I don't see any warnings or error condition. I think it has something to do with the fact that it is a multi-threaded application. Should I set an option somewhere to be able to debug multi-threaded applications ?

TranslateQuoteReplyEditDelete

 

 

2010-03-26 10:09:14     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87738   

 

We have a multi-threaded application. I would like to debug it with gdb. Therefore, I start gdbserver on our board and use Eclipse's debugging environment. I can set a breakpoint and let the application run till that breakpoint. Up to there, everything is working fine. However, when I try to continue the program, it looks like it don't want to continue. I don't see any warnings or error condition. I think it has something to do with the fact that it is a multi-threaded application. Should I set an option somewhere to be able to debug multi-threaded applications ?

 

---

 

Sorry, mistake, I do see an error : when I stop within a thread and want to step, I have this error : "Cannot find bounds of function". In Eclipse, it looks like the application is running again (the red 'terminate' button is available), but nothing happens. I think none of the threads is running.

 

When stopped in the thread, I would expect to see the "Variables" in the appropriate pane, but it remains empty...

TranslateQuoteReplyEditDelete

 

 

2010-03-26 10:38:02     Re: gdbserver

Robin Getz (UNITED STATES)

Message: 87739   

 

Filip:

 

Just to eliminate one thing - if you do it in gdb (no Eclipse) do you have the same issue?

 

-Robin

QuoteReplyEditDelete

 

 

2010-03-29 03:51:39     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87791   

 

I think I have the same behaviour with native gdb. I can set a breakpoint in a certain function within a thread. Gdb effectively breaks when entering the function. But when I do a 'step', it gives "Cannot find bounds of current function". Whe I do 'continue', it shows "Continuing.", but as far as I can see, any of the threads are running.

TranslateQuoteReplyEditDelete

 

 

2010-03-29 04:50:06     Re: gdbserver

Karthikeyan Jeevanandam (INDIA)

Message: 87793    Hi ,

 

Did you gave the below in gdb prompt before running ?

handle SIG32 nostop noprint pass

set solib-absolute-prefix <uclibc path

 

Example for second line

set solib-absolute-prefix

/opt/uClinux2009RC1/bfin-linux-uclibc/bfin-linux-uclibc/runtime

QuoteReplyEditDelete

 

 

2010-03-29 05:43:03     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87794   

 

I already had "handle SIG32 nostop" but not "solib...".

I tried "set solib-absolute-prefix /opt/uClinux/bfin-uclinux/bfin-uclinux/runtime", but I get this response : "Unable to load the executable's loadmap"

It looks like everything is working well as long as I'm in the main thread. i.e. first I stop at 'main' and there I still can step without any problem. I think the problem occurs once a number of threads are started or when I try to break in a thread (not the main thread).

 

(I start my gdb client with the command "bfin-uclinux-gdb MyApp.gdb". I suppose this is correct ?)

TranslateQuoteReplyEditDelete

 

 

2010-03-29 05:59:45     Re: gdbserver

Karthikeyan Jeevanandam (INDIA)

Message: 87795    We run the GDB in the below manner

 

bfin-linux-uclibc-gdb ./<executable name

 

Also,

We give the below command after connecting to target i.e, after givng

the command "target remote <IP>:<Port number>"

set solib-absolute-prefix /opt/uClinux/bfin-uclinux/bfin-uclinux/runtime

 

 

We used to get "Unable to load the executable's loadmap" only when we

give the "solib" command before connecting to the target

QuoteReplyEditDelete

 

 

2010-03-29 07:10:52     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87796   

 

When I do the "set solib..." command after "target remote...", then indeed, I get no error. So this part looks OK. But...my problem remains. When stopping in a thread, I can't 'step' or 'continue'.

TranslateQuoteReplyEditDelete

 

 

2010-03-31 09:40:03     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87923   

 

Anyone any ideas ? Doc available on debugging multi-thread application with gdb ?

TranslateQuoteReplyEditDelete

 

 

2010-04-01 00:19:39     Re: gdbserver

Sonic Zhang (CHINA)

Message: 87947   

 

You may check the GNU gdb document at   www.gnu.org/software/gdb/documentation/

QuoteReplyEditDelete

 

 

2010-04-01 11:16:22     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87987   

 

Because I still have problems using gdbserver, I tried to debug with an ICEBear debug tool (via USB). But there too...problems...

 

The gdbproxy seems to connect well to the board. When executing the command "target remote :2000" from within the gdb debugger, I get "Unable to load the executable's loadmap.". And gdb terminates the connection. What is gdb missing here ?

I run gdb from within the root of my application's tree, where all files should be available I think (.map, .gdb, stripped binary,...).

Or is it missing something on the board side ?

TranslateQuoteReplyEditDelete

 

 

2010-04-01 11:24:37     Re: gdbserver

Robin Getz (UNITED STATES)

Message: 87988   

 

Filip:

 

You can't debug userspace with an ICE.

 

Is that what you are trying to do?

QuoteReplyEditDelete

 

 

2010-04-01 11:40:01     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 87990   

 

That's indeed what I try to do. I'm a little surprised... So, the only way to debug my userspace application on the board is using gdbserver ? Correct ?

TranslateQuoteReplyEditDelete

 

 

2010-04-01 13:52:30     Re: gdbserver

Robin Getz (UNITED STATES)

Message: 87994   

 

Filip:

 

Correct - that is they way it works on any platform. Only the kernel knows where it relocated userspace to - and the only way to find out (mostly) is to use the ptrace interface the kernel exposes. The only way (mostly) to do that is with gdbserver.

 

-Robin

QuoteReplyEditDelete

 

 

2010-04-02 02:10:53     Re: gdbserver

Filip Vanalme (BELGIUM)

Message: 88001   

 

That doesn't look good... not able to debug application with ICEBear/JTAG and gdbserver also causing problems when debugging within threads... shall I stick to "printf' debugging...?

TranslateQuoteReplyEditDelete

Attachments

    Outcomes