Recent

Author Topic: [SOLVED] Update GDB  (Read 3090 times)

superc

  • Jr. Member
  • **
  • Posts: 89
[SOLVED] Update GDB
« on: April 28, 2021, 10:22:17 am »
Hello everyone,
 
I use Lazarus Version 2.0.12 svn rev 64769 and FPC 3.2.0; I'm start to converting a program from another ide lazarus (CT), with fpcupdeluxe I installed lazarus with OPM and I have installed many components smoothly; my Lazarus is 64 bit but i compile for Win32 and i386; my big problem is gdb: if i set  a breakpoint for an example on a resize of a form i receive a SIGSEGV and my application it closes unexpectedly. In gdb i use Dwarf2 with no optimization as in the guide, and i set in ide-option-debugger FixIncorrectStepOver = true and DisableLoadSymbolsForLibraries = true but same error. Version installed of gdb is 7.3.50,
if I update the gdb could i solve?
Thanks in advance.
« Last Edit: May 02, 2021, 10:03:54 pm by superc »

ccrause

  • Sr. Member
  • ****
  • Posts: 435
Re: Update GDB
« Reply #1 on: April 28, 2021, 02:12:26 pm »
Can you create, run and debug a new empty (or almost empty) project?

I don't have issues using gdb 7.2 that was installed with fpc 3.2 on Windows 10, (both 32 and 64 bit versions of fpc and gdb).

superc

  • Jr. Member
  • **
  • Posts: 89
Re: Update GDB
« Reply #2 on: April 28, 2021, 02:45:45 pm »
In a new simple program no problem, but now I've installed on virtual machine with fpcupdeluxe-i386-win32 lazarus the same version: after installed all packet same program on gdb in the same point no problem...
« Last Edit: April 28, 2021, 04:28:12 pm by superc »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7398
  • Debugger - SynEdit - and more
    • wiki
Re: Update GDB
« Reply #3 on: April 28, 2021, 09:02:32 pm »
Are you cross debugging? I.e. do you have a 64bit IDE, and compile to 32 bit, and try to debug the 32 bit project?

If so, try
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/GDB%2010.1%20mingw%20experimental/?upload_just_completed=true

It will give at least one annoying message during start up, may even give an "gdb internal error" (which you should be able to ignore), but it might work (I done a very quick and simple test, and if I did not mix anything up.... well).


If you are not cross debugging, go to the "alternative gdb" folder, matching your bitness (Windows 32 or 64 folder on sourceforge), and try gdb 8.2 or 8.3 whatever is avail.  (any NONE cygwin !)


More later.

--
Also since you come from CT, any reason not to use Lazarus 2.1/trunk?
After all CT is based on trunk.

Mind that all none cygwin builds will screw up if your environment (or command line args) contains utf8 outside the Latin range.


« Last Edit: April 28, 2021, 09:06:17 pm by Martin_fr »

superc

  • Jr. Member
  • **
  • Posts: 89
Re: Update GDB
« Reply #4 on: April 28, 2021, 10:07:04 pm »
Thanks,
I'm using an old version of CT (very old) and I want to convert it to a very stable version of Lazarus and i thought using this version of lazarus and fpc was the right choice for that purpose:
since the final program is 32-bit I could use the 32-bit version of lazarus, but I'll be happy to try your solution anyway. :)

superc

  • Jr. Member
  • **
  • Posts: 89
Re: Update GDB
« Reply #5 on: April 29, 2021, 09:13:21 am »
Hello, with new gdb for cross compile I riceive this blocking error:



af0815

  • Hero Member
  • *****
  • Posts: 702
Re: Update GDB
« Reply #6 on: April 29, 2021, 02:16:02 pm »
I use normally a Lazarus/FPC 32 Bit for 32 Bit Programms and a 64 Bit Version for 64 Bit Programms. With FPCUpdeluxe you can have installed this side by side, without any problem. You must only start with the correct starter produced by fpcupdeluxe.
regards
Andreas

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7398
  • Debugger - SynEdit - and more
    • wiki
Re: Update GDB
« Reply #7 on: April 29, 2021, 03:59:58 pm »
Let me double check I uploaded the correct version....

Couple of questions:

Please clarify, if indeed you do cross-debugging (64/32bit)?

What is shown be the "more" button?

Can you test with a simple empty form. Just an "OnFormCreate" procedure with "caption := '1';"  and a breakpoint on that line?

Ensure you are using "dwarf with sets" (project options).
Dwarf 3 will lead to crashes.

Also strictly optimization = none (level 0)
« Last Edit: April 29, 2021, 04:12:06 pm by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7398
  • Debugger - SynEdit - and more
    • wiki
Re: Update GDB
« Reply #8 on: April 29, 2021, 04:21:49 pm »
Some background:

The problem we are facing is that (IIRC) there was some change in the Windows API, few years back. (Hence the problem now also affects all older versions of Lazarus)

It had been possible, for Lazarus to start a 64bit or 32bit gdb, matching the target project. And that gdb could then debug away, and the IDE talk to that gdb.
But, gdb can not receive a "pause request" from the IDE while the app is running. The IDE however needs to send that request, when:
- the pause button is pressed
- blue gutter dots need to be loaded (source tab changed)
- a breakpoint gets added/removed/changed (except at start-up)
That is done by calling the Windows API. Gdb then gets a notification by Windows, which gdb handles.
But when a 64 bit process calls the debugging API for a 32 bit (WOW) process, then the signal's number changed. And gdb no longer understands it. And hence all cross debugging was suddenly broken.

In Lazarus trunk/2.1 there is code to start a 32bit helper process to call the windows API, and that will work.

In gdb 10, things got patched up in gdb. So gdb 10 should work. But gdb10 has some other issues (and it may be you a hitting one of them).

I have (for windows) more than a dozen 32bit gdb, and equally many 64bit gdb on my system, for testing.
Unfortunately I am very short on time for that testing.
I also have (thanks to a user on the forum) a patch to gdb, that may solve an unrelated issue. Again I need to find the time to test....


In Lazarus trunk, the helper app should allow debugging with a better tested version of gdb 8.2, or one of the cygwin builds (or eventually the patched one)

Still gdb in any version (tested from 6.7 to 10.1) has issues with fpc executables. Sometimes crashes, sometimes that it can not display the data.
Part of that are issues in gdb, some few cases are caused by fpc.

So we have a new debugger, no gdb involved: FpDebug / package LazDebuggerFp.
There is a version of it in 2.0.x, but for cross-bitness debugging you need trunk.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7398
  • Debugger - SynEdit - and more
    • wiki
Re: Update GDB
« Reply #9 on: April 29, 2021, 04:56:09 pm »
All that said: If you only compile for 32 bit, you can install the 32bit version of the IDE.

Then you can download gdb 8.2  https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Alternative%20GDB/GDB%208.2/
And that should work reasonable well.

Or you can install FpDebug in the 32 bit IDE, and that should be good too.

superc

  • Jr. Member
  • **
  • Posts: 89
Re: Update GDB
« Reply #10 on: April 30, 2021, 10:24:55 am »
All that said: If you only compile for 32 bit, you can install the 32bit version of the IDE.

Then you can download gdb 8.2  https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Alternative%20GDB/GDB%208.2/
And that should work reasonable well.

Or you can install FpDebug in the 32 bit IDE, and that should be good too.

actually, the gdb you recommended me on lazarus 32 bit works and also very well, thanks again

 

TinyPortal © 2005-2018