2010-02-12 03:55:13     gdbserver bf537

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

2010-02-12 03:55:13     gdbserver bf537

Louis Ruch (SOUTH AFRICA)

Message: 86028   

 

Hey all,

 

I am running a BF537 and I am trying to debug using the GDBSERVER asterisk.  I first stop the asterisk program then start it up with the gdbserver command.  I then connect to this via the command line from another linux PC, as well as via eclipse on a windows PC.  It works perfectly until i actually get into the CLI of asterisks, at which point I an no longer step in the code.  I assume it must be a threading problem.  At the begging of the program in the linux PC I see that it does not find a number of library's.  I have placed these library's in the /lib folder of the linux PC and on the BF it is also present.  But it still cannot find them and still gives the same problem.

 

As you can see at the very end of the load asterisk opens up the CLI> where i can type and enter commands but I cannot step in the code.  On the windows PC I placed a break point where it gives the error "command not found" I have confirmed this is the correct point by changing the code to print "SUCKER" at the end of the error message.  But it never gets to this break point even though it clearly gets there (since the text is displayed on the screen)

 

Please see the attached output from the BF537 and linux PC.

 

Kind regards,

 

Paladin

 

blackfinOUTPUT.txt

asteriskLoad.txt

QuoteReplyEditDelete

 

 

2010-02-12 03:58:53     Re: gdbserver bf537

Mike Frysinger (UNITED STATES)

Message: 86029   

 

please read the documentation wrt shared libs:

  docs.blackfin.uclinux.org/doku.php?id=debuggers#debugging_dynamic_object_libraries

QuoteReplyEditDelete

 

 

2010-02-15 02:57:51     Re: gdbserver bf537

Louis Ruch (SOUTH AFRICA)

Message: 86087   

 

Hey Mike,

 

Thanks for the reply, busy reading that document now - will give it a try.

 

Just to check so I will need to make sure all those libraries that gave errors are compiled with the "-shared -mfdpic -g -ldl" flags.  I also checked that I need to do the following:

 

set solib-search-path

 

Will give it a try now and let you know how it goes.

QuoteReplyEditDelete

 

 

2010-02-15 03:05:59     Re: gdbserver bf537

Louis Ruch (SOUTH AFRICA)

Message: 86088   

 

Hey Mike,

 

So first thing I noticed when i tried setting the solib-search-path is the following error.  I tried a number of different option also tried to set the absolute path (gave the same error)

 

 

 

paladin@ubuntu:~$ bfin-linux-uclibc-gdb /home/paladin/astfin/build_stamp537/asterisk-1.4.21.2/main/asterisk

 

GNU gdb 6.6

 

Copyright (C) 2006 Free Software Foundation, Inc.

 

GDB is free software, covered by the GNU General Public License, and you are

 

welcome to change it and/or distribute copies of it under certain conditions.

 

Type "show copying" to see the conditions.

 

There is absolutely no warranty for GDB.  Type "show warranty" for details.

 

This GDB was configured as "--host=i686-pc-linux-gnu --target=bfin-linux-uclibc"...

 

(gdb) set solib-search-path /lib

 

Unable to load the executable's loadmap.

 

(gdb) set solib-absolute-prefix /notreal

 

Unable to load the executable's loadmap.

 

(gdb) set solib-absolute-prefix notreal

 

Unable to load the executable's loadmap.

 

QuoteReplyEditDelete

 

 

2010-02-15 09:16:22     Re: gdbserver bf537

Louis Ruch (SOUTH AFRICA)

Message: 86111   

 

So I have been playing around for a while now - not exactly sure the problem is with compiling the shared libraries with the correct flags.  Perhaps it is, but from how I see it (perhaps) I am wrong, I just need to application (and GDB) to find these shared libraries because then it will be able to step into threads (I assume from the pthread lib). 

 

Do I need to setup the flags in pthread itself.  I am not sure if when I build uclinux it recompiles libpthread or if it just uses the pre-built one?

 

What I also find strange is that even though I put the libfile on both my host PC and blackfin board (in /lib/) it still gives the error: "no such file or directory" even though it is there, why is this?  As you can see with my above post changing the solib-search-path doesn't seem to work.

 

 

 

Thanks,

QuoteReplyEditDelete

 

 

2010-02-15 09:39:10     Re: gdbserver bf537

Jayakumar Ananthakrishnan (INDIA)

Message: 86112   

 

Hi Louis,

 

I am no expert in uClinux, but when I saw your previous post

 

(gdb) set solib-search-path /lib

 

Unable to load the executable's loadmap.

 

Just want to tip you off with a suggestion. Try to establish the connection with the remote target before you set the solib path

 

i.e target remote <remote target ip addr>:<port no.>

QuoteReplyEditDelete

 

 

2010-02-15 10:01:26     Re: gdbserver bf537

Louis Ruch (SOUTH AFRICA)

Message: 86113   

 

Sigh,

 

What I find very strange is that I never actually tried that. It is such a little change to make.  Thanks for that it works now - will test it out properly tomorrow and let you all know,

 

Thanks a lot,

 

Interesting in the documentation (setting the path is before running the application and connecting to it):

 

    Don't forget to set GDB environment variable solib-search-path to the library folders, where libdl.so and libusertest.so can be found.

 

    (gdb) set solib-search-path /library-directory/

 

    In case there are multiple library paths to be searched:

    (To be safe you need to set solib-absolute-prefix to some non-exist directory so GDB only use solib-search-path).

 

    (gdb) set solib-absulute-prefix /non_exist_dir

    (gdb) set solib-search-path /home/test/toolchain/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib:/home/test/kernel/uclinux-dist/staging/usr/lib

    (gdb) info sharedlibrary

    From        To          Syms Read   Shared Object Library

    0x00248c78  0x00269b34  Yes         /home/test/kernel/uclinux-dist/staging/usr/lib/libeXosip2.so.4

    0x00c88310  0x00c8834c  Yes         /home/test/toolchain/bfin-linux-uclibc/bfin-linux-uclibc/runtime/lib/libresolv.so.0

    0x02628490  0x02682ae4  Yes         /home/test/kernel/uclinux-dist/staging/usr/lib/libasound.so.2

 

    Run application on target board and connect gdb to it.

Attachments

Outcomes