<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2015-03-11 16:53 GMT-05:00 Jonathan Roelofs <span dir="ltr"><<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":re" class="a3s" style="overflow:hidden">gdb doesn't know how to run your program because gdb only knows how to run programs natively. You need to run it in qemu, and attach gdb to that, then debug as if you were debugging natively.<br>
<br>
I do something roughly like this (this is from memory, so the actual commands might be slightly different. ymmv):<br>
<br>
$ cat hw.c<br>
#include <stdio.h><br>
int main() { printf("hello world!\n"); }<br>
$ clang -target arm-none-eabi -march=armv4t hw.c -T generic-hosted.ld<br>
$ qemu-system-arm -semihosting -M integratorcp -cpu arm1026 -kernel a.out -s -S -g 1234 &<br>
$ arm-none-eabi-gdb<br>
(gdb) target remote localhost:1234<br>
(gdb) file a.out<br>
(gdb) break main<br>
(gdb) r<br>
(gdb) c<br>
hello world!<br>
(gdb) q</div></blockquote></div><br>I learn a lot from this, thanks! </div></div>