Recent

Author Topic: Remote Debugger (Windows -> Linux)  (Read 6532 times)

marius.maximus

  • New Member
  • *
  • Posts: 31
Remote Debugger (Windows -> Linux)
« on: November 24, 2012, 10:25:39 pm »
Hi !

This is my simple modification for lazarus.
All changes are in file "GDBMIDebugger.pp"

This allow remote debug my application from windows.
My remote system is TEGRA II  "Linux For Tegra"  :)
I compile and debug drom XP

How Remote Debug
1)  target>  gdbserver host:2345 ./my_application

2) lazarus> Tools-options-Debuger ,
I  selected GDB from toolchain, in my case "arm-linux-gnueabihf-gdb.exe"

3) lazarus> Tools-options-Debuger
Debugger_Remote = TRUE
Debugger_Remote_Host = 'TARGET_HOSTNAME'
Debugger_Remote_Port = '2345'

At this momenty don't work PAUSE i BREAK execution :)


« Last Edit: November 24, 2012, 11:48:04 pm by marius.maximus »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5573
    • wiki
Re: Remote Debugger (Windows -> Linux)
« Reply #1 on: November 24, 2012, 10:30:37 pm »
I will have a look at it asap.

If it is ok, i will try and add it, to the IDE.


marius.maximus

  • New Member
  • *
  • Posts: 31
Re: Remote Debugger (Windows -> Linux)
« Reply #2 on: November 25, 2012, 12:03:05 am »
I tested it on Codetyphon 3.0

 Lazarus    1.1.0    Source from SVN 16-11-2012 Rev 39290
 FreePascal 2.7.1    Source from SVN 16-11-2012 Rev 23001
 GDB 7.5 GNU gdb (crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 7.5-2012.09
 Target board http://www.toradex.com/Products/Colibri/Modules/Colibri-T20-512

I think this metod should works with any platoform and combination for remote debug
windows -> windows
linux -> windows
linux -> linux
etc...
But I don't tested it



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5573
    • wiki
Re: Remote Debugger (Windows -> Linux)
« Reply #3 on: November 27, 2012, 02:34:37 am »
I committed it to the IDE.

I changed the code so the new stuff is a new debugger class.

To be able to select it in the IDE, add the new unit GDBMIServerDebugger tu the uses clause of ide\debugmanager.pas

It still needs some work before it should be there by default

- e.g. the target remote, is not re-initialized, if the connection was lost.
- not sure, if/how break/pause can be done (this problem already exists for the ssh-gdb-class. And it also means, no changes to breakpoints, while the app is running (since this requires the app to be paused and continued after)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5573
    • wiki
Re: Remote Debugger (Windows -> Linux)
« Reply #4 on: November 27, 2012, 03:10:46 am »
With gdbserver, this should be possible (tested outside the IDE):
http://sourceware.org/gdb/onlinedocs/gdb/Background-Execution.html

But it will be some work to implement. Though it can go in the base class, provided it is only triggered by the gdbserver class
« Last Edit: November 27, 2012, 03:56:32 am by Martin_fr »