コマンドラインでのデバッグ - 2022.1 日本語

Vitis 統合ソフトウェア プラットフォームの資料: エンベデッド ソフトウェア開発 (UG1400)

Document ID
UG1400
Release Date
2022-04-26
Version
2022.1 日本語
コマンドラインで GDB を使用して単一のプロセッサ コアをデバッグするのは簡単ですが、ほかのコアをデバッグする場合は、いくつかの追加手順が必要です。
  1. ボードが接続されているマシンで ハードウェア サーバー を起動します。どのプロセッサ アーキテクチャでも、GDB サーバー は上記のポートで起動されます。
  2. ターミナル (たとえば A64 アプリケーションをデバッグする場合は $XILINX_VITS/gnu/aarch64/lin/aarch64-none/bin/aarch64-none-elf-gdb) から GDBを 起動します。
  3. target extended コマンドを使用して GDB サーバーに接続します (例: tar ext :3001)。複数のコアをデバッグするには、target extended コマンドが必要です。
  4. 使用可能なターゲットのリストを表示するには、monitor ps コマンドを実行します。ハードウェア サーバーでは、monitor コマンドを拡張し、利用可能なターゲットがリストできるようになっています。
  5. 2 番目のコアをデバッグするには、それを下位に追加して接続します。
  6. ほかのコアをデバッグするには、前のコアの接続を解除し、前の手順を繰り返します。次のコードは、この手順の完全な例です。
    注記: GDB で使用する前に、プロセッサ コアを停止または実行状態にしておく必要があります。GDB を使用する前に、たとえば XSDB などを使って、リセットをクリアしておいてください。
    # connect to gdbserver
    (gdb) tar ext xhdbfarmrki7:3001
    Remote debugging using xhdbfarmrki7:3001
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
    0x00000000ffff0000 in ?? ()
     
    # view available targets
    (gdb) mon ps
    1: Cortex-A53 #0 (Reset Catch)
    2: Cortex-A53 #1 (Reset Catch)
    3: Cortex-A53 #2 (Reset Catch)
    4: Cortex-A53 #3 (Reset Catch)
     
    # add other cores (2, 3, and 4) as inferiors
    (gdb) add-infe
    [New inferior 2]
    Added inferior 2
    (gdb) add-infe
    [New inferior 3]
    Added inferior 3
    (gdb) add-infe
    [New inferior 4]
    Added inferior 4
     
    # switch to inferior 2
    (gdb) infe 2
    [Switching to inferior 2 [<null>] (<noexec>)]
     
    # attach to 2nd core
    (gdb) attach 2
    Attaching to process 2
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
    0x00000000ffff0000 in ?? ()
     
    # detach before connecting to other cores
    (gdb) detach
    Detaching from program: , process 2
    [Inferior 2 (process 2) detached]
     
    # 3rd core
    (gdb) infe 3
    [Switching to inferior 3 [<null>] (<noexec>)]
    (gdb) attach 3
    Attaching to process 3
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
     
    Thread 2.1 stopped.
    0x0000000000000000 in ?? ()
    (gdb) detach
    Detaching from program: , process 3
    [Inferior 2 (process 3) detached]
     
    # 4th core
    (gdb) infe 4
    [Switching to inferior 3 [<null>] (<noexec>)]
    (gdb) attach 4
    Attaching to process 4
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
     
    Thread 2.1 stopped.
    0x0000000000000110 in ?? ()