Recent

Author Topic: Testers for GDB Based debugger / Windows / Lazarus SVN  (Read 2168 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7020
  • Debugger - SynEdit - and more
    • wiki
Testers for GDB Based debugger / Windows / Lazarus SVN
« on: March 28, 2021, 03:03:18 am »
Looking for testers for some updates to the GDB based debugger.

Anyone using Lazarus SVN on Windows (64 or 32 bit)

* Testing the current GDB  (includes users on all other OS - if gdb is used)
- please update to rev 64877 or later
Ensure all works as before.


* Testing the **NEW** GDB
- please update to rev 64877 or later
- Download the new version of GDB (and cygwin1.dll) from
  32Bit:  https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Alternative%20GDB/GDB%209.2/
  64Bit:  https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/GDB%209.2/

- Place GDB exe and cygwin1.dll in a new Folder.
- Tools > Options > Debugger Backend
  Choose the new gdb.exe

What are the changes.

The new version of GDB supports Unicode for
- Environment (any existing, as well as any env-var set under "Run > Run Param" can now contain Unicode)
- Command line arguments "Run > Run Param"
- Hopefully the Path of the current dir, and the exe name (though the latter is limited by what FPC can generate)
This does/should not affect inspecting variables, even if the contain Unicode.

All else should work as before.

Since the new gdb has a habit of showing directories as /cygdrive/c/path, the IDE now has code to correct that. Look out, if "/cygdrive/" is displayed anywhere by the debugger.

Thanks


MarkMLl

  • Hero Member
  • *****
  • Posts: 2400
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #1 on: March 28, 2021, 09:46:21 am »
Just upgraded to 64877 with FPC 3.2.0 on Debian 64-bit, will keep an eye open for anything unexpected.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ASerge

  • Hero Member
  • *****
  • Posts: 1765
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #2 on: March 28, 2021, 10:28:23 am »
Win64.
It looks like the TGDBMIDebuggerBase.ConvertToGDBPath function does something wrong in trunk.
TGDBMIDebuggerCommandStartDebugging.DoExecute do:
Code: Pascal  [Select][+][-]
  1.     if FTheDebugger.WorkingDir <> ''
  2.     then begin
  3.       // to workaround a possible bug in gdb, first set the workingdir to .
  4.       // otherwise on second run within the same gdb session the workingdir
  5.       // is set to c:\windows
  6.       ExecuteCommand('-environment-cd %s', ['.'], []);
  7.       ExecuteCommand('-environment-cd %s', [FTheDebugger.ConvertToGDBPath(FTheDebugger.WorkingDir, cgptCurDir)], [cfCheckError]);
  8.     end;
The first ExecuteCommand is executed successfully. Second in release 2.0.12 executed successfully, but in trunk 64877 issues '-environment-cd' without path. As result GDB stop with error. From log:
Code: Text  [Select][+][-]
  1. (gdb)
  2. <-environment-cd .>
  3. ^done
  4. (gdb)
  5. <-environment-cd >
  6. ^error,msg="-environment-cd: Usage DIRECTORY"
  7. (gdb)
  8. <kill>

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7020
  • Debugger - SynEdit - and more
    • wiki
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #3 on: March 28, 2021, 03:26:30 pm »
Indeed, uninitialized var.

Fixed in 64880

MarkMLl

  • Hero Member
  • *****
  • Posts: 2400
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #4 on: March 28, 2021, 05:39:02 pm »
Indeed, uninitialized var.

Fixed in 64880

Same problem on Debian, fixed as you expected.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Red_prig

  • Newbie
  • Posts: 2
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #5 on: April 16, 2021, 08:58:42 pm »
Why use cygwin at all if cross compilation works well? In addition, the 10th version of the gdb has already been released. Here are the scripts for cross-compilation not difficult at all:
https://github.com/red-prig/cross-build/tree/master/gdb-9.2
https://github.com/red-prig/cross-build/tree/master/gdb-10.1

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7020
  • Debugger - SynEdit - and more
    • wiki
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #6 on: April 16, 2021, 09:41:36 pm »
GDB 10.1 compiled for windows causes an error. It hits an assertion when the IDE send "ptype shortstring" (or maybe it was "whatis shortstring").

The IDE sends a few test "ptype" at startup, to gather some info it needs to deal with different behaviours by gdb/fpc/debug-info variations. So this error happens even before the debugging starts.
I changed the IDE not to send this, but there may be other data, that may hit this new assertion.

Therefore for now its 9.2.


cygwin:

This is the only way to build gdb (without modifying it) to support Unicode environment and command line args to the debugged app..

GDB build without cygwin do not support Unicode environment (I checked that in the gdb source).
Also IIRC they do not support unicode for command line args (that one is from testing /trial and error).

This limitation can cause debugging to fail, if some environment (even just the defaults / does not have to be set by the IDE) would have none a-z letters (like a path including the username, if that username has special chars).

Well, the old 7.3.5 64bit gdb was none cygwin. And did not cause the problem. This was because that gdb would not set any custom environment at all. But that means "run parameters" env would not work.

The cygwin builds deal with that.

That said, the IDE supports none cygwin builds too, if you can live with not having Unicode in the env.
But for packaging into the installer, the gdb should support this.
Hence I would like test results with that cygwin build. So issues will be known before it is added to a release.




Red_prig

  • Newbie
  • Posts: 2
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #7 on: April 16, 2021, 10:39:36 pm »
Well, I understand, maybe I'll try to modify the gdb for correct environment support.
And if honestly I just do not like cygwin.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9225
  • FPC developer.
Re: Testers for GDB Based debugger / Windows / Lazarus SVN
« Reply #8 on: April 16, 2021, 10:40:05 pm »
The problem with delivering a cygwin dll is that it conflicts with an existing cygwin install. IIRC the dlls  communicate over a shared memory area.

 

TinyPortal © 2005-2018