Recent

Author Topic: External debug info fails on Windows  (Read 4405 times)

Seenkao

  • Sr. Member
  • ****
  • Posts: 261
External debug info fails on Windows
« on: July 09, 2021, 03:02:48 am »
Всем привет!
Надеюсь информация, которую я оставлю,  будет полезной. Хотя в последующих версиях Lazarus, она может уже решена.

Использую Lazarus 2.0.10 r63526 (устанавливал посредством FPCUPDeluxe).

Операционная система Windows 7 64 (в Linux не наблюдалось, и в Windows 32 не наблюдалось).

Нативное приложение (не используя LCL!!! Лично я занимаюсь ZenGL). Периодически, при попытке отладки (используя внешний файл отладки) - сама отладка может быть полностью проигнорирована. Как будь-то ни каких точек останова не существует.

Лично я найду способ отладить подобные случаи.

Google translate:
Hello everyone!
I hope the information I leave will be helpful. Although in future versions of Lazarus, it may already have been resolved.

I'm using Lazarus 2.0.10 r63526 (installed via FPCUPDeluxe).

Operating system Windows 7 64 (not observed in Linux, and not observed in Windows 32).

Native application (not using LCL !!! Personally, I use ZenGL). Periodically, when trying to debug (using an external debug file) - the debugging itself can be completely ignored. Breakpoints are ignored.

Personally, I will find a way to debug cases like this.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7507
  • Debugger - SynEdit - and more
    • wiki
Re: External debug info fails on Windows
« Reply #1 on: July 09, 2021, 12:54:32 pm »
Hello.

I guess you use the default debugger?
Menu: Tools > Options > Debugger: "GNU Debugger (GDB)"

If you switch between "gdb" and "FpDebug", then be sure to use "gdb". "FpDebug" does not support external debug info at all.


To debug the issue.

Compile your IDE with the define DBG_WITH_DEBUGGER_DEBUG
That is pass -dDBG_WITH_DEBUGGER_DEBUG to the compiler

Go to Tools > Configure build lazarus
and add the option.
Rebuild and restart the IDE.


Then open
Menu: View -> debug windows > Debug output
In 2.2 this will be
Menu: View -> ide internals > Debug output

With the define above it will have an edit field at the bottom. This can be used to send commands to gdb, when the app is PAUSED in the debugger.
You can then find out from gdb docs, how to get info from gdb about why it did not load the dbg file.


The dbg file is linked from the exe. And it has a checksum. So if the gdb file is not properly updated by fpc, then gdb will not load it.

One possibility is, that gdb still had the file open, and fpc could not rewrite it.
I do not know if that would report an error during compilation.
(Compiler) Message Window => right mouse / pop up menu => Copy -> Copy all and original Messages

If that is the case you need to "reset the debugger". (Menu run)
There is on option to always reset the debugger (Tools > Options), but the debug start will be a little bit slower.



Something else.

Lazarus 2.2 will come with a newer version of gdb. No idea if that will change anything.

Lazarus 2.2 also changes to "FpDebug" as default. And that means no support for external debug info at all. But you can switch back to gdb, if this is important to you.

Also, the switch only happens if you do a new install.
If you upgrade with your old config in place, then your config will be kept, and gdb will still be your debugger.




Seenkao

  • Sr. Member
  • ****
  • Posts: 261
Re: External debug info fails on Windows
« Reply #2 on: July 16, 2021, 12:31:14 am »
Приветствую! Благодарю за информацию!
Я пересобрал Lazarus с данным флагом. Результата нет. Так же проверил как работает отладка без внешней отладочной информации. Проблема так же есть.

Но! Я забыл предупредить. У меня собран 32-х битный Lazarus. И мне вручную пришлось указывать на 64-х битный отладчик.

Возможно проблема в этом. Но, я считаю, что отладчик должен стабильно работать в любой версии. Не зависимо от разрядности (я могу быть не прав).

Я надеюсь, что информация будет полезна в дальнейшем. И пользователи Lazarus не будут сталкиваться с подобными проблемами (хотя я сильно залажу внутрь Lazarus и многое могу изменить вручную, что обычный пользователь не делает).

Мне не сильно важно, внешняя или внутренняя отладочная информация будет использоваться. Конечный код будет без отладочной информации.  :)

Google translate:
Greetings! Thanks for the information!
I rebuilt Lazarus with this flag. No result. I also checked how debugging works without external debugging information. There is also a problem.

But! I forgot to warn you. I have built a 32 bit Lazarus. And I manually had to point to the 64 bit debugger.

Perhaps this is the problem. But, I believe that the debugger should work stably in any version. Regardless of the bit depth (I may be wrong).

I hope that the information will be useful in the future. And Lazarus users will not face similar problems (although I will do a lot of work inside Lazarus and can change a lot by hand, which a regular user does not).

It doesn't really matter to me whether external or internal debug information will be used. The final code will be without debug information. :)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7507
  • Debugger - SynEdit - and more
    • wiki
Re: External debug info fails on Windows
« Reply #3 on: July 16, 2021, 06:56:46 pm »
It should work, with a 64bit gdb (inside 32bit Lazarus).

But, from the info I have it could be anything.

--------------------
The flag was not a fix.
I thought you wanted to try and find out what the error was. The flag helps debugging the debugger.

Red_prig

  • New Member
  • *
  • Posts: 18
Re: External debug info fails on Windows
« Reply #4 on: August 09, 2021, 01:48:19 pm »
in the case of an external debug file, pay attention to non-Latin characters in the file path (in the case of 2.0.10 and the built-in gdb, unicode is not supported there)

 

TinyPortal © 2005-2018