[yocto] Debug with gdbserver
Darren Hart
dvhart at linux.intel.com
Wed Aug 1 09:22:28 PDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/31/2012 11:15 PM, Martin Jansa wrote:
> On Tue, Jul 31, 2012 at 08:47:47PM -0700, Darren Hart wrote:
>>
>>
>> On 07/31/2012 08:13 PM, Khem Raj wrote:
>>>
>>> On Jul 31, 2012, at 7:46 PM, Darren Hart
>>> <dvhart at linux.intel.com> wrote:
>>>
>>>> I am trying to debug a userpsace application that misbehaves
>>>> under poky-tiny. My current approach is use gdbserver on the
>>>> target and attach to the offending process, then connect to
>>>> it on the client using the yocto-built native gdb for the
>>>> target.
>>>>
>>>> I can easily add gdbserver to the target image, and can
>>>> successfully connect it to the process:
>>>>
>>>> # From the target (qemux86) root shell: # dropbearkey -t rsa
>>>> -f ./rsa # dropbear -r ./rsa # DBPID=$(ps | grep dropbear |
>>>> head -n1 | cut -f4 -d ' ') # gdbserver 127.0.0.1:1234
>>>> --attach $DBPID
>>>>
>>>> Now on the host machine (amd64) I want to: $ gdb???? (gdb)
>>>> target extended-remote 127.0.0.1:1234
>>>>
>>>> Which package do I need to build to get the appropriate gdb
>>>> for the host to remote debug processes on the target?
>>>
>>> bake cross-gdb for your arch and use it same way as above
>>
>> ERROR: Nothing PROVIDES 'cross-gdb'
>>
>> gdb-cross maybe?
>>
>> Ah that gets a lot farther... and then do_compile fails.
>>
>> | libgdb.a(python.o): In function `gdbpy_target_wide_charset': |
>> python.c:(.text+0x1c7): undefined reference to
>> `PyUnicodeUCS4_Decode'
>>
>> And a lot more similar to that. I'm doing this on poky-tiny (so
>> a minimal target libc... shouldn't impact native bits though
>> right?
>
> http://patchwork.openembedded.org/patch/33345/
Excellent, that gets things building.
Now I'm trying to use it and getting a timeout. I'm investigating, but
if anyone has run into this already and can save me the time, I'd
appreciate it.
I start qemu with:
$ qemu -kernel
/build/poky/master/qemux86_SZ60LW/tmp/deploy/images/bzImage-qemux86.bin
- -initrd
/build/poky/master/qemux86_SZ60LW/tmp/deploy/images/core-image-minimal-qemux86.cpio.gz
- -nographic -append "console=ttyS0 root=/dev/ram0" -redir tcp:1234::1234
Then run the following on the target:
# dropbearkey -t rsa -f ./rsa
# dropbear -r ./rsa
# DBPID=$(ps | grep dropbear | head -n1 | cut -f4 -d ' ')
# gdbserver 127.0.0.1:1234 --attach $DBPID
...
Attached; pid = 41
Listening on port 1234
Then from the host:
$ nmap localhost
...
1234/tcp open hotline
....
$ i586-poky-linux-gdb
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux --target=i586-poky-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target extended-remote 127.0.0.1:1234
Remote debugging using 127.0.0.1:1234
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Remote communication error. Target disconnected.: Connection reset by
peer.
- --
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJQGVfEAAoJEKbMaAwKp364Ug8H/0yXaF/jqZdrl3XEnM0mT4Ef
gvTIEQ4yAr015Ra2TV9kTUEqb0tnKR1chfZDveEmlBf84ZUsnArFvUseaCMQ1sz6
0lG5iAdeY6Cpo4UKPmpxgLCCMo3nEUIULvA4XrsTakvEgUH4DhssmgEOTOi/aaQ3
Fc9YtpUvXjC63eyRNqYk5sEMWzEVMSxbRHUegllGrsK+eeacEYoA1/TFFiK0c6lH
cLL/mZsnbzPFh9a1SteR1D9YC7tmrooGyaWBz/zZ8UYNfTlP5JfsQA/GZHc6wmWn
h6Ml9l9DdnNQxXX8Ff6nyEYgc1714u8OEl/Wno6wwJdCh9U9OvxfRC5KxMKkMWg=
=yC5/
-----END PGP SIGNATURE-----
More information about the yocto
mailing list