Difference between revisions of "GDB"

From ArmadeusWiki
Jump to: navigation, search
m (Debugging directly on target)
(gdb on target do not depend (exclusively) on NFS)
Line 36: Line 36:
  
 
==Debugging directly on your APF (may require more memory)==
 
==Debugging directly on your APF (may require more memory)==
You have to build gdb for the target and have a working NFS link between your target and your host.<br>
+
* You have to build gdb for the target:
On target launch GDB from your NFS mount:
+
<pre class="host">
 +
$ make menuconfig
 +
</pre>
 +
<pre class="config">
 +
Toolchain  --->
 +
        *** Gdb Options ***
 +
    [*] Build gdb debugger for the Target
 +
</pre>
 +
<pre class="host">
 +
$ make
 +
</pre>
 +
Then you can either reflash your rootfs, or copy ''$ARMADEUS_ROOTFS_DIR/bin/gdb'' to your board, to a SD or to a NFS export.
 +
 
 +
* After installation, launch gdb on your APF:
 
<pre class="apf">
 
<pre class="apf">
  # /mnt/host/gdb your_prog
+
  # gdb your_prog
 
</pre>
 
</pre>
 
If you need argument passing:
 
If you need argument passing:
 
<pre class="apf">
 
<pre class="apf">
  # /mnt/host/gdb --args your_prog your_args
+
  # gdb --args your_prog your_args
 
</pre>
 
</pre>
 
To debug a Core dump:
 
To debug a Core dump:
 
<pre class="apf">
 
<pre class="apf">
  # /mnt/host/gdb your_prog -c your_core_file
+
  # gdb your_prog -c your_core_file
 
</pre>
 
</pre>
  

Revision as of 18:06, 18 March 2009

On this page you will find all you need to debug your userspace applications running on your Armadeus board.

First of all, be sure to have installed the Toolchain. During Buildroot's Cross Compiler configuration be sure to have choosen following options:

Toolchain  ---> Build gdb server for the Target
Toolchain  ---> Build gdb for the Host

and optionally:

Toolchain  ---> Build gdb debugger for the Target

Compile your program with debug symbols

Use -g option of gcc:

 $ make shell_env
 $ . armadeus_env.sh
 $ export PATH=$PATH:$ARMADEUS_TOOLCHAIN_PATH
 $ arm-linux-gcc -g -o hello hello.c

Debugging a program running on your APF, from your Host, through Ethernet

  • On the target launch your program like that:
 # gdbserver 192.168.0.2:2345 program [args]

192.168.0.2 is the IP address of your Host and 2345 the port number to use (examples).

  • On your Host launch:
 []$ arm-linux-gdb program
 (gdb) set solib-absolute-prefix ./buildroot/build_armv4t/staging_dir/
 (gdb) target remote 192.168.0.10:2345

192.168.0.10 is the address of your target

only continue (c) can be used to start the program, because it is already running when you launch GDB on your host.

Core dump analysis doesn't seem to work in this use case !!

Debugging directly on your APF (may require more memory)

  • You have to build gdb for the target:
 $ make menuconfig
Toolchain  --->
        *** Gdb Options ***
    [*] Build gdb debugger for the Target
 $ make

Then you can either reflash your rootfs, or copy $ARMADEUS_ROOTFS_DIR/bin/gdb to your board, to a SD or to a NFS export.

  • After installation, launch gdb on your APF:
 # gdb your_prog

If you need argument passing:

 # gdb --args your_prog your_args

To debug a Core dump:

 # gdb your_prog -c your_core_file

Links

Other languages:

English Flag.svg English  •  French Flag.svg Français