GDB Remote Qemu-arm Debugging

Source: Internet
Author: User

Compile C as a running file for arm instructions

/usr/bin/arm-linux-gnueabi-g++ Hello.cpp

Cat Hello.cpp #include <stdio.h>void crash () {     char *a=0;    *a=0;} int main () {        printf ("Hello world\n");        Crash ();        printf ("After crash\n"); }


Execute the error directly. Because host is a Linux x86

$./a.out
-bash:./a.out:cannot Execute binary file


Need to be executed with qemu-arm, the result is expected

Qemu-arm-l/usr/arm-linux-gnueabi/a.out

Hello World

Qemu:uncaught Target signal (segmentation fault)-core dumped
Segmentation fault (core dumped)


Remote debugging (The key is to add the-G parameter, specify port as 1235)

qemu-arm-g 1235 -l/usr/arm-linux-gnueabi/a.out

GDB running with linux-x86 does not print symbol

(GDB) Target remote:1235remote debugging using:1235 (GDB) Ccontinuing.program received signal SIGSEGV, segmentation fault .0x00000000 in?? () (GDB) bt#0  0x00000000 in?? () Cannot access memory at address 0x0 (GDB) File/home/payne/hello/a.outa program is being debugged already. Is you sure the file of want to? (Y or N) yreading symbols from/home/payne/hello/a.out ... (No debugging symbols found) ... done. (GDB) bt#0  

You suspect that you want to use arm GDB

See http://mazhijing.blog.51cto.com/215535/40759. Compiled arm GDB, after running to crash ()

Qemu-arm-l  /usr/arm-linux-gnueabi/  /gdb (gdb) target remote:1235remote debugging Using:1235warning:can not P Arse XML target description; XML support is disabled at compile time0x40801c40 in?? (GDB) File/home/payne/hello/a.outa program is being debugged already. Is you sure the file of want to?

(Y or N) yreading symbols from/home/payne/hello/a.out ... (No debugging symbols found) ... done. (GDB) Ccontinuing.program received signal SIGSEGV, segmentation fault.0x0000841e in Crash () () (GDB)


Conclusion:

Does arm's gdbserver, just can use arm's gdb?






GDB Remote Qemu-arm Debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.