[LLVMdev] Customize Standard C Library Using LLVM (to support llvm backend optimization)
Chao Yan
yanchao2012 at gmail.com
Wed Mar 11 18:45:13 PDT 2015
2015-03-11 16:53 GMT-05:00 Jonathan Roelofs <jonathan at codesourcery.com>:
> 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.
>
> I do something roughly like this (this is from memory, so the actual
> commands might be slightly different. ymmv):
>
> $ cat hw.c
> #include <stdio.h>
> int main() { printf("hello world!\n"); }
> $ clang -target arm-none-eabi -march=armv4t hw.c -T generic-hosted.ld
> $ qemu-system-arm -semihosting -M integratorcp -cpu arm1026 -kernel
> a.out -s -S -g 1234 &
> $ arm-none-eabi-gdb
> (gdb) target remote localhost:1234
> (gdb) file a.out
> (gdb) break main
> (gdb) r
> (gdb) c
> hello world!
> (gdb) q
>
I learn a lot from this, thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150311/e3bcff3a/attachment.html>
More information about the llvm-dev
mailing list