Debugging Self-Relocating Programs - 2022.1 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2022-04-26
Version
2022.1 English

System debugger supports source level debugging of self-relocating programs such as U-boot. A self-relocating program is a program which relocates its own code and data sections during runtime. The debug information available in such files does not provide details about where the program sections have been relocated. For this reason, you must supply to the debugger the address where the program sections have been relocated. This can be done in two ways.

  1. Update the system debugger launch configuration to provide the address to which program sections are relocated.
    1. Select Debug As > Debug Configurations to launch the system debugger launch configuration.
    2. Click the Application view and select the application you wish to download.
    3. Select the This is a self-relocating application checkbox.
    4. Enter the address where all the program sections are to be relocated in the Relative address to which the program sections are relocated textbox.
    5. Launch the debug configuration. When the program sections are relocated during runtime, the debugger will have enough information to support source level debugging of the relocated sections.

    Note: This method is supported only when the Debug Type is set to Standalone' in the Target Setup view of the debug configuration.
  2. Alternatively, you can also use the memmap command in XSDB to provide the address where the program sections are relocated. memmap command in XSDB can be used to add symbol files to the debugger. This is useful for debugging the applications which are already running on the target. For example, boot from flash. In case of relocatable ELF files, you can use the -relocate-section-map option, to provide the relocation address.
    xsdb% targets 2
     1 APU
       2 ARM Cortex-A9 MPCore #0 (Suspended)
       3 ARM Cortex-A9 MPCore #1 (Suspended)
     4 xc7z020
    xsdb% targets 2
    xsdb% memmap -reloc 0x3bf37000 -file u-boot
    
    xsdb% stop
    Info: ARM Cortex-A9 MPCore #0 (target 2) Stopped at 0x3ff7b478 (Suspended)
    xsdb% bt
     0 0x3ff7b478 __udelay()+1005809800: lib/time.c, line 91
     1 0x3ff7b4ac udelay()+1005809696: lib/time.c, line 104
     2 0x3ff5d878 genphy_update_link()+1005809860: drivers/net/phy/phy.c, line 250
     3 0x3ff5df84 m88e1118_startup()+1005809712: drivers/net/phy/marvell.c, line 356
     4 0x3ff5d154 zynq_gem_init()+1005810192: drivers/net/zynq_gem.c, line 402
     5 0x3ff7dc58 eth_init()+1005809720: net/eth.c, line 886
     6 0x3ff7e0e4 net_loop()+1005809728: net/net.c, line 407
     7 0x3ff46330 netboot_common()+1005809972: common/cmd_net.c, line 230
     8 0x3ff46520 do_tftpb()+1005809708: common/cmd_net.c, line 33
     9 0x3ff5295c cmd_process()+1005809824: common/command.c, line 493
     10 0x3ff5295c cmd_process()+1005809824: common/command.c, line 493
     11 0x3ff3b710 run_list_real()+1005811444: common/cli_hush.c, line 1656
     12 0x3ff3b710 run_list_real()+1005811444: common/cli_hush.c, line 1656
     13 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     14 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     15 0x3ff3b008 parse_string_outer()+1005809872: common/cli_hush.c, line 3254
     16 0x3ff3b6b8 run_list_real()+1005811356: common/cli_hush.c, line 1617
     17 0x3ff3b6b8 run_list_real()+1005811356: common/cli_hush.c, line 1617
     18 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     19 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     20 0x3ff3afd0 parse_string_outer()+1005809816: common/cli_hush.c, line 3248
     21 0x3ff5140c do_run()+1005809740: common/cli.c, line 131
     22 0x3ff5295c cmd_process()+1005809824: common/command.c, line 493
     23 0x3ff5295c cmd_process()+1005809824: common/command.c, line 493
     24 0x3ff3b710 run_list_real()+1005811444: common/cli_hush.c, line 1656
     25 0x3ff3b710 run_list_real()+1005811444: common/cli_hush.c, line 1656
     26 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     27 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     28 0x3ff3b008 parse_string_outer()+1005809872: common/cli_hush.c, line 3254
     29 0x3ff3b6b8 run_list_real()+1005811356: common/cli_hush.c, line 1617
     30 0x3ff3b6b8 run_list_real()+1005811356: common/cli_hush.c, line 1617
     31 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     32 0x3ff3be3c parse_stream_outer()+1005811244: common/cli_hush.c, line 2003
     33 0x3ff3afd0 parse_string_outer()+1005809816: common/cli_hush.c, line 3248
     34 0x3ff39ab4 main_loop()+1005809724: common/main.c, line 85
     35 0x3ff3c4f4 run_main_loop()+1005809672: common/board_r.c, line 675
     36 0x3ff73b54 initcall_run_list()+1005809716: lib/initcall.c, line 27
     37 0x3ff3c66c board_init_r()+1005809676: common/board_r.c, line 908
     38 0x3ff3837c clbss_l()+1005809688: arch/arm/lib/crt0.S, line 174
     39 unknown-pc