Differences
This shows you the differences between two versions of the page.
| |
buildroot [2022/02/24 11:34] – created damien | buildroot [2022/02/24 11:48] (current) – add Remote debug section damien |
---|
====== Buildroot SDK ====== | ====== Buildroot ====== |
| |
| ===== Buildroot SDK ===== |
| |
It is the ''host'' directory generated in the ''output'' directory of //Buildroot//. | It is the ''host'' directory generated in the ''output'' directory of //Buildroot//. |
<code>find . -type f -name "*cmake*" -exec sed -i 's/</orig/absolute/path/to/output/host>/</new/absolute/path/to/output/host>/g' {} + | <code>find . -type f -name "*cmake*" -exec sed -i 's/</orig/absolute/path/to/output/host>/</new/absolute/path/to/output/host>/g' {} + |
</code> | </code> |
| |
| ===== Remote debug ===== |
| |
| - enable ''gdbserver'' in your Buildroot configuration (''BR2_PACKAGE_GDB_SERVER''), rebuild your config and flash it to your target (note: you can also just transfer the ''gdbserver'' binary to your target through ''ssh'') |
| - on your target, launch your executable with ''gdbserver'':<code> |
| # gdbserver <your_executable> [its_arguments] |
| </code> |
| - on your host PC, from your buildroot's config ''output'' directory, run the ''gdb'' of your toolchain:<code> |
| $ host/bin/<toolchain_prefix>-gdb # (e.g. host/bin/aarch64-linux-gnu-gdb) |
| </code> |
| - load the debug symbols from your ''staging'' environment:<code> |
| (gdb) set sysroot staging |
| </code> |
| - connect ''gdb'' to ''gdbserver'' over the network:<code> |
| (gdb) target remote <target_ip>:3000 (3000 is the default port) |
| </code> |
| - start the execution of your executable:<code> |
| (gdb) cont |
| </code> |
| |
| From ''gdb'' you can execute step-by-step if you want, but the most interesting is probably that you can retrieve the stacktrace after a segfault, using<code> |
| (gdb) bt |
| </code> |
| |
| You can also connect to gdbserver from you IDE, if necessary. |