Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Debugging on DaVinci using GHS Multi

From Texas Instruments Wiki
Jump to: navigation, search

Debugging DM6446 using GHS Multi

This topic discusses the main ways of using GHS Multi for debugging code on the DM6446. Obviously this is not meant to be an exhaustive discussion of all possible features in Multi (there are users guide for this purpose!). The purpose of this page is to give users the minimum amount they need to know to get their debug session up and running, given specific setups. This is also the place to post any tips and tricks found while using this debugger.

Debugging ARM side user-space application in Windows, using run-mode debugging

Setup used:

  • DVEVM setup with ethernet connection and serial terminal access.
  • GHS Multi 4.3.1 for Windows or above.
  • Development done in a RedHat-based vmware image.

The key in doing source level debugging is to make sure the build is done at the same location as where the executable is launched. In other words, if the executable encodedecode is launched from /home/user/demo, the executable must have been built at that location on the host /home/user/workdir/filesys/home/user/demo(i.e. it could not be exported to that location after the build is done). This is so that the relative paths to the source files stay the same from where the executable is run.

1. Start linuxserv running on the target

target $ cd /home/user/demo
target $ ./linuxserv -server 3112 -many_view_thread_debugging -target_root_dir v:\\workdir\\filesys

V:\ is the samba mount of /home/user in the vmware image on the Windows debug host machine. The last argument is set based on the assumption that the root file system nfs-mounted by the Linux target is located at /home/user/workdir/filesys, which corresponds to v:\workdir\filesys on the samba mount.

The -many_view_thread_debugging flag is optional and is useful to have Multi open an extra "control window" every time a POSIX thread is created by the application.

Note! If your application requires kernel modules to be loaded beforehand (e.g. by running loadmodules.sh on the DVEVM), it is a good idea to do this first before starting linuxserv.

2. Start Multi.

3. Hit the button Connect to Target -> Connect....

4. Create a new connection method using the button on the side. Use connection method linuxserv.

5. Enter in the following on LinuxServ Connection Editor:

  • Connect for: Download
  • Target IP Address (this should be the ip of your Linux target obtained by executing /sbin/ifconfig at the target prompt)
  • Target port: 3112

6. After hitting ok, hit connect from the Connection Chooser.

7. Open a command prompt in Windows, change directory to v:\workdir\filesys\home\user\demo (location of the executable is on the samba mount), and type the following after replacing 'encodedecode' with the name of your executable:

cmd $ c:/ghs/davinci431/dblink --scan_source -auto_translate encodedecode

8. Select Launch Debugger->Open Debugger from Multi Launcher.

9. Select the ARM side executable you are trying to debug through the samba mount. Hit debug.

10. Type the following at the MULTI command line prompt:

MULTI> sourceroot remap /home/user v:/

to inform Multi of the setup of your samba mount.

11. Hit F10 to step to the next line. The source of main() should appear if it hasn't already done so.

12. As you run, individual thread windows will pop up and cause the processor to halt. Simply run all threads again to continue execution. If you wish to bring up a function in a thread window, use the e functionName command to display functionName. Note that when a thread window comes up, the code is halted at the beginning of the stub associated with pthread creation. To run to the function associated with the thread, simply set a breakpoint at the beginning of that function and run to it.

Debugging ARM side kernel-space application in Windows, using freeze-mode debugging

Setup used:

  • DVEVM setup with ethernet connection and serial terminal access.
  • GHS Multi 4.3.1 for Windows or above.
  • Development done in a RedHat-based vmware image.
  • GHS Probe - Make sure you install the probe using the CD provided and configure it with the settings in the Quick Start Guide's appendix using a serial connection.

1. Before you start, it is recommended to first samba mount your linux host on your windows host where Multi is installed. Map this to V:.

2. Follow the quick start guide by first rebuilding the kernel. In order to use dblink to translate vmlinux, use the Windows cmd prompt to run c:\ghs\davinci431\dblink.exe --scan_source -auto_translate vmlinux in the directory where the file vmlinux is located. Make sure you select USB connection when configuring mpserv (not Ethernet as shown in the Quick Start Guide).

3. When you try to connect, it is possible that a window pops up and say that there was a timeout. In this case, hit terminate and retry. You should be able to connect and bring up a Debug window on the 2nd try.

4. After you attached to the application, halt the processor. Go under File->Debug Program and select your vmlinux file. This will load all kernel symbols.

5. Type the following at the MULTI command line prompt:

MULTI> sourceroot remap \home\user v:

to inform Multi of the setup of your samba mount.

6. Use Browse->Procedures to select the function you'd like to set a breakpoint on.