|
|
Subscribe / Log in / New account

BPF in GCC

BPF in GCC

Posted Nov 8, 2021 23:37 UTC (Mon) by evanovan (guest, #155222)
Parent article: BPF in GCC

What are the requirements to debug BPF code as far as gdb / clang / llvm / gcc versions ?

I tried and these are the results.

getting latest GDB :
$ git clone git://sourceware.org/git/binutils-gdb.git
$ cd binutils-gdb
$ ./configure bpf
$ make

-----------------------------------

using gcc/g++ version (gcc version 11.1.0 (Ubuntu 11.1.0-1ubuntu1~18.04.1) )
command : gcc -ggdb -O2 -Wall -c hello_world.c -o hello_world.o ( debug symbols GETS generated )

./gdb/gdb <hello_world.o>
(gdb) target sim
(gdb) sim memory-size 4Mb
(gdb) load
(gdb) run

setting breakpoints and hitting them work
you CAN'T step
you CAN'T print "info registers" or print variables

continue or step crashes gdb and core dump

----------------------------------------------

using clang / llvm ( clang version 10.0.0-4ubuntu1~18.04.2)
command : clang -g -O2 -target bpf -c hello_world.c ( no debug symbols gets generated )

no debugging with no symbols

Please advise and share your experience


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds