Skip to contentSkip to conversation

doc: sandbox: Add a note of disabling LTO when using gdb

PATCH In review Bin Meng 2 participants 2 messages May 17, 2022 – May 26, 2022

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 doc: sandbox: Add a note of disabling LTO when using gdb

Image created by LTO is not friendly to debugger, let's document this.

---

 doc/arch/sandbox.rst | 2 ++
 1 file changed, 2 insertions(+)
doc/arch/sandbox.rst +2 -0
index 246ab5b380..19167d22fb 100644
@@ -477,6 +477,8 @@ board_init_f() and board_init_r().
 
 This approach can be used on normal boards as well as sandbox.
 
+When debugging with gdb, it's better to disable Link Timer Optimizations
+(CONFIG_LTO = n).
 
 SDL_CONFIG
 ----------
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Bin Meng

Image created by LTO is not friendly to debugger, let's document this.

---

  doc/arch/sandbox.rst | 2 ++
  1 file changed, 2 insertions(+)
doc/arch/sandbox.rst +0 -0
index 246ab5b380..19167d22fb 100644

doc/arch/sandbox.rst board_init_f() and board_init_r(). · line 481

Quoted 5 lines
doc/arch/sandbox.rst +2 -0
@@ -477,6 +477,8 @@ board_init_f() and board_init_r().
 
  This approach can be used on normal boards as well as sandbox.
 
+When debugging with gdb, it's better to disable Link Timer Optimizations
+(CONFIG_LTO = n).

CC_OPTIMIZE_FOR_DEBUG should be mentioned here too.

I will add this when merging.

Should CC_OPTIMIZE_FOR_DEBUG disable LTO?

The usefulness of LTO=n, CC_OPTIMIZE_FOR_DEBUG=y for debugging is not sandbox specific but applies to QEMU and JTAG debugging too.

I think the section "Debugging the init sequence" should not live on a page that is sandbox specific. Instead we should add a new page on debugging U-Boot.

Quoted 3 lines
doc/arch/sandbox.rst +0 -0
  SDL_CONFIG
  ----------