<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi all,<br>
    <br>
    With some investigation, there is an example to explain how to do
    remote debug.<br>
    <br>
    Also file [YOCTO #9481] for document.<br>
    <br>
    Hi Andreas,<br>
    <br>
    Would you please have a look the example, to see if it could fit
    your case.<br>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    Example:<br>
    <br>
    1. Build a image with gdbserver and gzip installed. The gzip<br>
       is the debug binary. Append the following to local.conf<br>
    ...<br>
    IMAGE_INSTALL_append = " gdbserver gzip"<br>
    ...<br>
    <br>
    $ bitbake core-image-sato<br>
    <br>
    2. Build gdb-cross for remote debug on host<br>
    <br>
    $ bitbake gdb-cross-i586<br>
    <br>
    3. start qemu<br>
    <br>
    $ runqemu qemux86 core-image-sato<br>
    <br>
    4. On host side, create symlink /usr/src/debug to<br>
       ${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS} which the<br>
       location of sources is /usr/src/debug.<br>
    <br>
    $ ln -snf /TOPDIR/tmp/work/i586-poky-linux /usr/src/debug<br>
    <br>
    5. On target side, ipaddr is 128.224.163.187,<br>
       run gdbserver to debug "gzip -h"<br>
    <br>
    root@qemux86-64:~# gdbserver localhost:1024 gzip -h<br>
    Process gzip created; pid = 530<br>
    Listening on port 1024<br>
    <br>
    6. On host side, enter gzip's devshell<br>
    $ bitbake -cdevshell gzip<br>
    <br>
    7. On host side, run gdb-cross to remote debug gzip<br>
    <br>
    gzip-1.6# i586-poky-linux-gdb ../build/gzip<br>
    <br>
    8. Use path ${STAGING_DIR_HOST} as the system root for<br>
       the program being debugged. Any absolute shared<br>
       library paths will be prefixed with path;<br>
    <br>
    (gdb) set sysroot /TOPDIR/tmp/sysroots/qemux86<br>
    <br>
    <br>
    9. Start remote target, set break point at help()<br>
    <br>
    (gdb) target remote 128.224.163.187:1024<br>
    (gdb) break gzip.c:325<br>
    (gdb) info break<br>
    Num     Type           Disp Enb Address            What<br>
    1       breakpoint     keep y   0x0000000000401ec1 in main at
    /usr/src/debug/gzip/1.6-r0/gzip-1.6/gzip.c:325<br>
    (gdb) c<br>
    Continuing.<br>
    <br>
    Breakpoint 1, main (argc=2, argv=0x7fffffffeca8) at
    /usr/src/debug/gzip/1.6-r0/gzip-1.6/gzip.c:465<br>
    465                 help(); do_exit(OK); break;<br>
    (gdb) list<br>
    460             case 'd':<br>
    461                 decompress = 1; break;<br>
    462             case 'f':<br>
    463                 force++; break;<br>
    464             case 'h': case 'H':<br>
    465                 help(); do_exit(OK); break;<br>
    466             case 'k':<br>
    467                 keep = 1; break;<br>
    468             case 'l':<br>
    469                 list = decompress = to_stdout = 1; break;<br>
    (gdb) c<br>
    Continuing.<br>
    [Inferior 1 (process 1246) exited normally]<br>
    <br>
    <br>
    10. On target side, get output of "gzip -h"<br>
    [snip]<br>
    Remote debugging from host 128.224.153.74<br>
    Usage: gzip [OPTION]... [FILE]...<br>
    Compress or uncompress FILEs (by default, compress FILES in-place).<br>
    <br>
    Mandatory arguments to long options are mandatory for short options
    too.<br>
    <br>
      -c, --stdout      write on standard output, keep original files
    unchanged<br>
      -d, --decompress  decompress<br>
      -f, --force       force overwrite of output file and compress
    links<br>
      -h, --help        give this help<br>
      -k, --keep        keep (don't delete) input files<br>
      -l, --list        list compressed file contents<br>
      -L, --license     display software license<br>
      -n, --no-name     do not save or restore the original name and
    time stamp<br>
      -N, --name        save or restore the original name and time stamp<br>
      -q, --quiet       suppress all warnings<br>
      -r, --recursive   operate recursively on directories<br>
      -S, --suffix=SUF  use suffix SUF on compressed files<br>
      -t, --test        test compressed file integrity<br>
      -v, --verbose     verbose mode<br>
      -V, --version     display version number<br>
      -1, --fast        compress faster<br>
      -9, --best        compress better<br>
    <br>
    With no FILE, or when FILE is -, read standard input.<br>
    <br>
    Report bugs to <a class="moz-txt-link-rfc2396E" href="mailto:bug-gzip@gnu.org">&lt;bug-gzip@gnu.org&gt;</a>.<br>
    <br>
    Child exited with status 0<br>
    GDBserver exiting<br>
    [snip]<br>
    <br>
    //Hongxu<br>
    <br>
  </body>
</html>