From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.windriver.com (mail.windriver.com [147.11.1.11]) by mail.openembedded.org (Postfix) with ESMTP id AC83060722 for ; Tue, 19 Apr 2016 12:59:59 +0000 (UTC) Received: from ALA-HCB.corp.ad.wrs.com (ala-hcb.corp.ad.wrs.com [147.11.189.41]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id u3JCxwS6002181 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 19 Apr 2016 05:59:58 -0700 (PDT) Received: from [128.224.162.159] (128.224.162.159) by ALA-HCB.corp.ad.wrs.com (147.11.189.41) with Microsoft SMTP Server id 14.3.248.2; Tue, 19 Apr 2016 05:59:57 -0700 To: Mark Hatle , =?UTF-8?Q?Andreas_M=c3=bcller?= References: <62a9bef209d903048c1095d90387384115eb6fd5.1459147231.git.hongxu.jia@windriver.com> <571496CC.8010607@windriver.com> <57149B89.2090607@windriver.com> <5714A30A.9000204@windriver.com> <5714AA1E.9020505@windriver.com> <5714DC35.7040206@windriver.com> <5715DF5B.5030406@windriver.com> <57162516.7000009@windriver.com> From: Hongxu Jia Message-ID: <57162BC9.4010708@windriver.com> Date: Tue, 19 Apr 2016 20:59:53 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <57162516.7000009@windriver.com> Cc: Patches and discussions about the oe-core layer Subject: Re: [PATCH 01/17] conf/bitbake.conf package.bbclass: fix dbg package not contain sources while -fdebug-prefix-map used X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 13:00:00 -0000 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit On 04/19/2016 08:31 PM, Mark Hatle wrote: > On 4/19/16 2:33 AM, Hongxu Jia wrote: >> Hi all, >> >> With some investigation, there is an example to explain how to do remote debug. >> >> Also file [YOCTO #9481] for document. >> >> Hi Andreas, >> >> Would you please have a look the example, to see if it could fit your case. >> >> Example: >> >> 1. Build a image with gdbserver and gzip installed. The gzip >> is the debug binary. Append the following to local.conf >> ... >> IMAGE_INSTALL_append = " gdbserver gzip" >> ... >> >> $ bitbake core-image-sato >> >> 2. Build gdb-cross for remote debug on host >> >> $ bitbake gdb-cross-i586 >> >> 3. start qemu >> >> $ runqemu qemux86 core-image-sato >> >> 4. On host side, create symlink /usr/src/debug to >> ${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS} which the >> location of sources is /usr/src/debug. >> >> $ ln -snf /TOPDIR/tmp/work/i586-poky-linux /usr/src/debug > This is incorrect. On the host you use the combination of: > > (gdb) set sysroot > (gdb) set substitute-path /usr/src/debug /usr/src/debug > Yes! Yours is more reasonable. It is verified on my case: 4. On host side, Set a substitution rule for finding source files. Replace /usr/src/debug with ${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS} (gdb) set substitute-path /usr/src/debug /TOPDIR/tmp/work/i586-poky-linux //Hongxu >> 5. On target side, ipaddr is 128.224.163.187, >> run gdbserver to debug "gzip -h" >> >> root@qemux86-64:~# gdbserver localhost:1024 gzip -h >> Process gzip created; pid = 530 >> Listening on port 1024 >> >> 6. On host side, enter gzip's devshell >> $ bitbake -cdevshell gzip >> >> 7. On host side, run gdb-cross to remote debug gzip >> >> gzip-1.6# i586-poky-linux-gdb ../build/gzip >> >> 8. Use path ${STAGING_DIR_HOST} as the system root for >> the program being debugged. Any absolute shared >> library paths will be prefixed with path; >> >> (gdb) set sysroot /TOPDIR/tmp/sysroots/qemux86 >> >> >> 9. Start remote target, set break point at help() >> >> (gdb) target remote 128.224.163.187:1024 >> (gdb) break gzip.c:325 >> (gdb) info break >> Num Type Disp Enb Address What >> 1 breakpoint keep y 0x0000000000401ec1 in main at >> /usr/src/debug/gzip/1.6-r0/gzip-1.6/gzip.c:325 >> (gdb) c >> Continuing. >> >> Breakpoint 1, main (argc=2, argv=0x7fffffffeca8) at >> /usr/src/debug/gzip/1.6-r0/gzip-1.6/gzip.c:465 >> 465 help(); do_exit(OK); break; >> (gdb) list >> 460 case 'd': >> 461 decompress = 1; break; >> 462 case 'f': >> 463 force++; break; >> 464 case 'h': case 'H': >> 465 help(); do_exit(OK); break; >> 466 case 'k': >> 467 keep = 1; break; >> 468 case 'l': >> 469 list = decompress = to_stdout = 1; break; >> (gdb) c >> Continuing. >> [Inferior 1 (process 1246) exited normally] >> >> >> 10. On target side, get output of "gzip -h" >> [snip] >> Remote debugging from host 128.224.153.74 >> Usage: gzip [OPTION]... [FILE]... >> Compress or uncompress FILEs (by default, compress FILES in-place). >> >> Mandatory arguments to long options are mandatory for short options too. >> >> -c, --stdout write on standard output, keep original files unchanged >> -d, --decompress decompress >> -f, --force force overwrite of output file and compress links >> -h, --help give this help >> -k, --keep keep (don't delete) input files >> -l, --list list compressed file contents >> -L, --license display software license >> -n, --no-name do not save or restore the original name and time stamp >> -N, --name save or restore the original name and time stamp >> -q, --quiet suppress all warnings >> -r, --recursive operate recursively on directories >> -S, --suffix=SUF use suffix SUF on compressed files >> -t, --test test compressed file integrity >> -v, --verbose verbose mode >> -V, --version display version number >> -1, --fast compress faster >> -9, --best compress better >> >> With no FILE, or when FILE is -, read standard input. >> >> Report bugs to . >> >> Child exited with status 0 >> GDBserver exiting >> [snip] >> >> //Hongxu >>