Recent

Author Topic: Debugger does not work with an old project  (Read 10340 times)

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Debugger does not work with an old project
« on: August 06, 2012, 01:57:47 pm »
I used to have a working project in 2010. I do not remember exact Lazarus version but I guess it was some LazarusCT SVN version actual at the time. Now I wanted to continue work on that project, and my Lazarus (CT 2.80, Laz 1.1 20120803, FPC 2.71 SVN 37429 CT, WinXP 2GB RAM, GDB 7.4.50.20120410 but it is the same if I put some older 7.x.xx GDB) does not let me debug the project showing weird exception messages (screenshots and project are attached). Running without IDE and/or debugger works fine. All other projects can be debugged without problems. It happens the same with 3 last Lazarus versions (all 2012) I have. I am getting desperate, so please help if you can.
« Last Edit: August 06, 2012, 02:04:57 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Debugger does not work with an old project
« Reply #1 on: August 06, 2012, 02:10:17 pm »
Missing piapi32.dll, so cannot run.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12423
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger does not work with an old project
« Reply #2 on: August 06, 2012, 02:58:02 pm »
I had a look at it....

First:
Highly recommended to switch off smart linking when using the debugger.
It doesn't seem to affect this particular case, but it is known to sometimes cause proplems.

2nd:
I tested on w32. The tests are limited to the step off gdb loading the exe (with symbols). I can not run it, as I do not have the dll.
However the problem appears to be in the step of loading the symbols (gdb itself crashes)

It appears to be independent of the gdb version.
- Using fpc 2.4.4 (w32) all gdb (6.7.5 to 7.4.2) crash
- Using fpc 2.6.0 (w32) all gdb (6.7.5 to 7.4.2) load the symbols fine
- I did not test 2.7.1

I do not know, if fpc produces incorrect symbol info or if it is gdb that is to blame. (may be worth alerting the fpc team)

3RD:
     I was able to solve it, by adding the option -Xe (external linker)

----
On an similar issue (does not apply / or at least I can not tell without having the dll)

gdb has been reported to also fail to load certain libs. That is also related to symbols.
GDB can be told not to attempt to read any symbols from libs. In the option add as "debugger_startup_options" the following "--eval-command="set auto-solib-add off""

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #3 on: August 06, 2012, 03:04:06 pm »
Missing piapi32.dll, so cannot run.
Thank you very much for trying. That DLL is commercial and from another company so I can not distribute it. I have just renamed it so the system can not find it on my pc, and I still get all the messages from the screenshots when I press F9 to start application from the Lazarus IDE, so you should still be able to replicate the problem I have. I get the system complaining for DLL only if I execute application directly without IDE, and if DLL is found application works without any problem. Could you please tell me do you get the same error messages as I do when executed with F9 from Lazarus IDE?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #4 on: August 06, 2012, 03:05:49 pm »
@Martin_fr:
Thank you so much for trying and for the hints. I will test to see if your workaround works and report here.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Debugger does not work with an old project
« Reply #5 on: August 06, 2012, 03:54:25 pm »
Could you please tell me do you get the same error messages as I do when executed with F9 from Lazarus IDE?
No, only your second error gdb-problem-002.png comes up, but you have twice more information in that.

First i get System error that "program cannot start because dll is missing", then Debugger error "debugger failed to get application's PID. This may be caused by missing debug info" (which isn't missing). Then i'm back to Lazarus again  ::)

I have SVN version of most recent FPC and Lazarus, and 32-bit Win7. I recompiled them both like 2 days ago.

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #6 on: August 06, 2012, 04:01:30 pm »
Here are testing results. Entering --eval-command="set auto-solib-add off" in Tools \ Options \ Debugger \ Debugger_Startup_Options does not have any effect in my case. Smart linking switched off also didn't have any effect (although I will try to remember mentioned hint for the future usage). Adding -Xe to empty edit field in Project \ Project options \ Compiler options \ Linking \ Options: (-k) with checked Pass options to linker did not have any effect either. Is that the right place to put this switch? I was not sure so I searched the wiki for an info where to put that switch but I couldn't find any info with my search words, and forum was of no help either, so I entered the switch there (probably wrong place).
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12423
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger does not work with an old project
« Reply #7 on: August 06, 2012, 04:03:50 pm »
Adding -Xe to empty edit field in Project \ Project options \ Compiler options \ Linking \ Options: (-k) with checked Pass options to linker did not have any effect either. Is that the right place to put this switch?

No,

In the tree (on the left) is an entry "Other", which has a big memo "Custom Options". That is where the -Xe goes

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #8 on: August 06, 2012, 04:06:48 pm »
Could you please tell me do you get the same error messages as I do when executed with F9 from Lazarus IDE?
No, only your second error gdb-problem-002.png comes up, but you have twice more information in that.

First i get System error that "program cannot start because dll is missing", then Debugger error "debugger failed to get application's PID. This may be caused by missing debug info" (which isn't missing). Then i'm back to Lazarus again  ::)
Thank you for your input. Strange that you see slightly different things. I will test all this on Win7-64 machine with Laz32 and see what happens.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #9 on: August 06, 2012, 04:11:10 pm »
Adding -Xe to empty edit field in Project \ Project options \ Compiler options \ Linking \ Options: (-k) with checked Pass options to linker did not have any effect either. Is that the right place to put this switch?

No,

In the tree (on the left) is an entry "Other", which has a big memo "Custom Options". That is where the -Xe goes
Oh, it works! I can debug now without problems. Thank you sooo much!!! :)
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12423
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger does not work with an old project
« Reply #10 on: August 06, 2012, 04:14:37 pm »
No, only your second error gdb-problem-002.png comes up, but you have twice more information in that.

First i get System error that "program cannot start because dll is missing", then Debugger error "debugger failed to get application's PID. This may be caused by missing debug info" (which isn't missing). Then i'm back to Lazarus again  ::)

I have SVN version of most recent FPC and Lazarus, and 32-bit Win7. I recompiled them both like 2 days ago.

If you get "dll missing" then the initial error did not happen on your system (gdb did not crash while reading symbols) So you get different errors.

That would mean, that at least for w32 the problem may be fixed in latest fpc trunk

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #11 on: August 06, 2012, 06:00:29 pm »
I do not know, if fpc produces incorrect symbol info or if it is gdb that is to blame. (may be worth alerting the fpc team)
Is this still valid? Should I report it as a bug? I haven't done it before but I am willing to try.
« Last Edit: August 06, 2012, 06:02:12 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12423
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger does not work with an old project
« Reply #12 on: August 06, 2012, 06:20:30 pm »
Is your 2.7.1 up to date?  If not update first.

If it still happens, then report.

I did drop a note on the mail list. Maybe some one sees it

avra

  • Hero Member
  • *****
  • Posts: 2592
    • Additional info
Re: Debugger does not work with an old project
« Reply #13 on: August 06, 2012, 06:37:48 pm »
Is your 2.7.1 up to date?  If not update first. If it still happens, then report.
Well, it is from CT 2.80 not older then a week (FPC 2.7.1 SVN 38083 - the SVN number in the first post is my mistake), and updating FPC will break something since CT has some modifications. I guess it is time for me to finally have an excuse to try FPCUP (the only way some other Lazarus can coexist with CT).

Quote
I did drop a note on the mail list. Maybe some one sees it
Thanks again.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

 

TinyPortal © 2005-2018