* * *

Author Topic: Cross-debug for ARM: GDB Don't run.  (Read 433 times)

JFT

  • Newbie
  • Posts: 3
Cross-debug for ARM: GDB Don't run.
« on: August 01, 2017, 02:42:02 pm »
Hello,

For several years I developed a linux embedded software, with Lazarus windows for an x86 target.
For the debug, I use GDB/gdbserver and everything works perfectly.

Today, I need to migrate my embedded linux software to an ARM target. This is an ARMv7.
The cross-compilation part happens smoothly, but impossible to run GDB.
For cross-compilation and GDB, I use the tools LINARO: https://releases.linaro.org/componen...nux-gnueabihf/

I put the gdbserver into my target, and correctly position the path to the debugger in Lazarus windows to "arm-linux-gnueabihf-gdb.exe"
I starts the debug, the network connection is correct, the application starts on the target and at the IDE Lazarus the info (debugging ...) appears as well as the red rectangle ... But no action is possible.
Even a breakpoint set before starting the debug is not taken into account.

The same GDB/gdbserver work fine, when I use the GDB command line.

- Development OS Windows 8.1
- Lazarus windows 1.6.2
- FPC 3.0.0
- Target OS Linux 4.9.30
- Target CPU ARMv7
- GDB 7.12.1

Thank you for your help

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4352
    • wiki
Re: Cross-debug for ARM: GDB Don't run.
« Reply #1 on: August 01, 2017, 03:16:25 pm »
1) You did change the debugger settings in the IDE to "GNU remote debugger (gdbserver)" ?
I assume you did, because if not it would be hard to supply the settings.
http://wiki.lazarus.freepascal.org/Remote_Debugging#Using_gdbserver

2) Logfile ?
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

JFT

  • Newbie
  • Posts: 3
Re: Cross-debug for ARM: GDB Don't run.
« Reply #2 on: August 01, 2017, 05:07:50 pm »
Thank you for your reply

1) Yes, the debugger setting is "GNU remote debugger (gdbserver)".
2) I create the Logfile, but I don't understand the error.    Can you help me in understanding:
Quote
  << TCmdLineDebugger.ReadLn "^running"
  << TCmdLineDebugger.ReadLn "*running,thread-id="all""
  << TCmdLineDebugger.ReadLn "(gdb) "
  << TCmdLineDebugger.ReadLn "~"Reading /lib/libpthread.so.0 from remote target...\n""
  << TCmdLineDebugger.ReadLn "=library-loaded,id="/lib/libpthread.so.0",target-name="/lib/libpthread.so.0",host-name="target:/lib/libpthread.so.0",symbols-loaded="0",thread-group="i1""
  << TCmdLineDebugger.ReadLn "~"Reading /lib/libdl.so.2 from remote target...\n""
  << TCmdLineDebugger.ReadLn "=library-loaded,id="/lib/libdl.so.2",target-name="/lib/libdl.so.2",host-name="target:/lib/libdl.so.2",symbols-loaded="0",thread-group="i1""
  << TCmdLineDebugger.ReadLn "~"Reading /lib/libc.so.6 from remote target...\n""
  << TCmdLineDebugger.ReadLn "=library-loaded,id="/lib/libc.so.6",target-name="/lib/libc.so.6",host-name="target:/lib/libc.so.6",symbols-loaded="0",thread-group="i1""
  << TCmdLineDebugger.ReadLn "=breakpoint-modified,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00010624",func="main",file="K4ARMTst.lpr",fullname="C:\\K2...
  << TCmdLineDebugger.ReadLn "=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00010624",func="main",file="K4ARMTst.lpr",fullname="C:\\K2...
  << TCmdLineDebugger.ReadLn "=breakpoint-modified,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00010624",func="main",file="K4ARMTst.lpr",fullname="C:\\K2...
  << TCmdLineDebugger.ReadLn "~"\n""
  << TCmdLineDebugger.ReadLn "~"Breakpoint 2, main () at K4ARMTst.lpr:5\n""
  << TCmdLineDebugger.ReadLn "~"5\tbegin\n""
  << TCmdLineDebugger.ReadLn "*stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame={addr="0x00010624",func="main",args=[],file="K4ARMTst.lpr",fullname="C:\\K2...
  >> TCmdLineDebugger.SendCmdLn "-break-delete 2"
  << TCmdLineDebugger.ReadLn "^done"
  << TCmdLineDebugger.ReadLn "(gdb) "
  >> TCmdLineDebugger.SendCmdLn "-break-delete 3"
  << TCmdLineDebugger.ReadLn "^done"
  << TCmdLineDebugger.ReadLn "(gdb) "
  >> TCmdLineDebugger.SendCmdLn "-break-delete 4"
  << TCmdLineDebugger.ReadLn "^done"
  << TCmdLineDebugger.ReadLn "(gdb) "
  DebuggerState: Setting to dsRun, from dsStop
    TGDBMIThreads: >>ENTER: TGDBMIThreads.DoStateChange  New-State=dsRun
    TGDBMIThreads: <<EXIT: TGDBMIThreads.DoStateChange
...
    DebugDataMonitor: >>ENTER: TSnapshotManager.DoStateChange  New-State=Run
    DebugDataMonitor: <<EXIT: TSnapshotManager.DoStateChange
  DebuggerState: Finished dsRun
  >> TCmdLineDebugger.SendCmdLn "info program"
  << TCmdLineDebugger.ReadLn "&"info program\n""
  << TCmdLineDebugger.ReadLn "~"Debugging a target over a serial line.\n""
  << TCmdLineDebugger.ReadLn "~"Program stopped at 0x10624.\n""
  << TCmdLineDebugger.ReadLn "~"It stopped at a breakpoint that has since been deleted.\n""
  << TCmdLineDebugger.ReadLn "~"It stopped at a breakpoint that has since been deleted.\n""
  << TCmdLineDebugger.ReadLn "~"Type \"info stack\" or \"info registers\" for more information.\n""
  << TCmdLineDebugger.ReadLn "^done"
  << TCmdLineDebugger.ReadLn "(gdb) "
  >> TCmdLineDebugger.SendCmdLn "info pid"
  << TCmdLineDebugger.ReadLn "&"info pid\n""
  << TCmdLineDebugger.ReadLn "&"Undefined info command: \"pid\".  Try \"help info\".\n""
  << TCmdLineDebugger.ReadLn "^error,msg="Undefined info command: \"pid\".  Try \"help info\".""
  << TCmdLineDebugger.ReadLn "(gdb) "
  >> TCmdLineDebugger.SendCmdLn "info threads"
  << TCmdLineDebugger.ReadLn "&"info threads\n""
  << TCmdLineDebugger.ReadLn "~"  Id   Target Id         Frame \n""
  << TCmdLineDebugger.ReadLn "~"* 1    Thread 218.218 \"REDYtst.K4ELF\" main () at K4ARMTst.lpr:5\n""
  << TCmdLineDebugger.ReadLn "^done"
  << TCmdLineDebugger.ReadLn "(gdb) "
  DebuggerState: Setting to dsError, from dsRun
    TGDBMIThreads: >>ENTER: TGDBMIThreads.DoStateChange  New-State=dsError
    TGDBMIThreads: <<EXIT: TGDBMIThreads.DoStateChange
...
    TGDBMIWatches: >>ENTER: TGDBMIWatches.DoStateChange  New-State=dsError
    TGDBMIWatches: <<EXIT: TGDBMIWatches.DoStateChange
    TIdeWatchesMonitor: >>ENTER: TIdeWatchesMonitor.DoStateChange  New-State=dsError
    TIdeWatchesMonitor: <<EXIT: TIdeWatchesMonitor.DoStateChange
    Canceling: "TGDBMIServerDebuggerCommandStartDebugging: ContinueCommand= TGDBMIDebuggerCommandExecute: -exec-continue"
    >> TCmdLineDebugger.SendCmdLn "kill"
    DebugDataMonitor: >>ENTER: TSnapshotManager.DoStateChange  New-State=Error
    DebugDataMonitor: <<EXIT: TSnapshotManager.DoStateChange
    WARNING: obsolete call to RecreateWnd for TDbgFeedbackDlg
    Warning: TWinControl.DestroyHandle DbgFeedbackDlg:TDbgFeedbackDlg Handle not Allocated
  DebuggerState: Finished dsError
Exec done
Leaving Queue with count: 0 Recurse-Count=0 State=dsError
Canceling: "TGDBMIServerDebuggerCommandStartDebugging: ContinueCommand= <none>"
DebuggerState: Setting to dsNone, from dsError
  TGDBMIThreads: >>ENTER: TGDBMIThreads.DoStateChange  New-State=dsNone
  TGDBMIThreads: <<EXIT: TGDBMIThreads.DoStateChange
  TIdeThreadsMonitor: >>ENTER: TIdeThreadsMonitor.DoStateChange  New-State=dsNone

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4352
    • wiki
Re: Cross-debug for ARM: GDB Don't run.
« Reply #3 on: August 01, 2017, 08:04:51 pm »
Looks like https://bugs.freepascal.org/view.php?id=0031386

This is fixed in Lazarus 1.8 RC3. So you need to update.

Alternatively an older gdb version may work (or not).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4352
    • wiki
Re: Cross-debug for ARM: GDB Don't run.
« Reply #4 on: August 01, 2017, 08:06:11 pm »
Actually it may even be in 1.6.4

JFT

  • Newbie
  • Posts: 3
Re: Cross-debug for ARM: GDB Don't run.
« Reply #5 on: August 03, 2017, 10:39:20 am »
Hello Martin_Fr,

Lazarus v1.6.4 solves the problem.
Thank you very much for your quick help.  :)

JFT

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus