Recent

Author Topic: [SOLVED]How do I resolve Debbuger GDB error?  (Read 12001 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
[SOLVED]How do I resolve Debbuger GDB error?
« on: May 10, 2013, 08:46:16 pm »
Please have a look at the following link. Sorry if this is against the forum rule, but I already created the question on that site and I don't want to repeat it here too....

http://stackoverflow.com/questions/16488317/lazarus-how-do-i-resolve-debbuger-gdb-error

Simply put I am running into GDB debbugger error on the Linux system. As soon as I start debugging and before my main window pops up I get the GDB Debbuger error message box. Then, it stops completely. It didn't use to be that. Please help.
« Last Edit: May 24, 2013, 02:57:55 pm by reltek »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12114
  • Debugger - SynEdit - and more
    • wiki
Re: How do I resolve Debbuger GDB error?
« Reply #1 on: May 10, 2013, 09:00:38 pm »
Check which version of GDB you have. The latest release (gdb 7.6) and pre-release (7.5.9) do NOT work: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Issues_with_GDB_7.5.9_or_7.6

If you have one of them : downgrade 7.0 to 7.5.1 should work

-----
Check your setup:
http://wiki.lazarus.freepascal.org/Debugger_Setup

Absolutely NO smart linking.

-----

Otherwise:
- which GDB version do you have?
- What OS
- 32 or 64 bit?
- Using which version of Lazarus/fpc? should be 1.0.8 and 2.6.2 / But if you are at least 1.0 and 2.6.0 then that is fine

Also please produce a log:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session


---
More:

In "project options" is a page "linker". It has a dropdown for debug info type. Contais entries like stabs, dwarf, ...
What is selected?

Can you try changing it to either stabs or "dwarf 2 with sets"?


Do you use components from additional packages? 3rd party, LazReport, Chart, BGRA?
If so: each package has an option dialog, containing the above setting.
Make sure they are all either off, or the same as the project (a small set of GDB does mind, if you mix stabs and dwarf)
« Last Edit: May 10, 2013, 09:08:16 pm by Martin_fr »

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
Re: How do I resolve Debbuger GDB error?
« Reply #2 on: May 21, 2013, 08:26:47 pm »
 :D How do you find the GDB version number? I am using PCLinuxOS Linux System? :D :-[

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12114
  • Debugger - SynEdit - and more
    • wiki
Re: How do I resolve Debbuger GDB error?
« Reply #3 on: May 21, 2013, 08:47:48 pm »
open a shell and run

Code: [Select]
gdb --version

Reply looks something like:

Code: [Select]
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as ***
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
Re: How do I resolve Debbuger GDB error?
« Reply #4 on: May 21, 2013, 09:06:09 pm »
okay here is my gdb version.

Plus, I am using fpc 2.6.2
lazarus 1.0.6 64bit
PCLinuxOS 64bit

Code: [Select]
GNU gdb (GDB) 7.1-2pclos2011 (PCLinuxOS release 2011)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-mandriva-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
« Last Edit: May 21, 2013, 09:14:42 pm by reltek »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12114
  • Debugger - SynEdit - and more
    • wiki
Re: How do I resolve Debbuger GDB error?
« Reply #5 on: May 21, 2013, 09:26:30 pm »
Ok 7.1.2 is good.
So is your fpc and lazarus.

I can't see the original error any more, as the link is dead.

The "oops debugger error" has a "More" button. That may reveal something that can help me, identify the issue.
--------------------

You did check the setup, according to the link I posted?

--------------------
If it is not your setup you most likely need to produce a logifle
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session


Also: does this happen with all your projects, and even a new empty form?
Or just with some specific projects?


Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
Re: How do I resolve Debbuger GDB error?
« Reply #6 on: May 21, 2013, 10:10:25 pm »
Here that GDB error picture with more button already clicked.

No, this is only happening to one of my program. I did open an empty program and ran it. It had no GDB error.

I setup the debugger options from the link you provided.

Also I noticed that IDE is no longer breaking at the breakpoint.




« Last Edit: May 21, 2013, 10:34:17 pm by reltek »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12114
  • Debugger - SynEdit - and more
    • wiki
Re: How do I resolve Debbuger GDB error?
« Reply #7 on: May 21, 2013, 11:09:49 pm »
Ah yes, I remember.

Strange you are the first to get this error.

This means your GDB appears to crash on one of the first thinks the IDE doe in every debug session. "did not return a result" in this case most likely means crash.

This particular command could be removed in your copy. Bot that would likely not help. The crash might happen at a later time. (at any time during your debug session. (Anyway, I will add some info below)

The problem may not be that one command itself. Most likely the debug info is corrupted, and at some time GDB gets to the corrupt info.

-------------
There are many things you can try. But it is impossible to say which (if any) will help.

You can try to update gdb up to 7.5.1, or any in-between. Though I do not know how to do that on your system.

-------------

Since it only happens with that program:

Very first thing to do: Change between Dwarf and stabs. (Project options / page: linker)



Do you use any packages other than the LCL, FCL, LAzUtils?

Open the "Project Inspector" Their is a list of all units, at the bottom, you find the used packages.

You can double-click EACH package, and in the package window open the "Options" (toolbar), and also check on the linker page what debug-settings they have.
If you do not debug the package, disable the debug setings for that package.


-------------


Next check for  array (static array) declarations in your units (and the packages).

One thing that is a known issue
   array [0..max] of
where max is a very large number. usually max := maxint / sizeof(arrayelement)

In other words, such an array would use 2 gigabyte of memory and if GDB allocates this (and gdb will) then it runs out of mem (even if you have thet memory)

Those arrays are sometimes used to typecast other data, where the data is smaller, and only a few elements at the start exist.

So if any package that you use (or a unit of yours) uses this trick, then this may be the issue.
If it is a package it should be solved by switching of debug info for it.

-------------

Not sure what else to try.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12114
  • Debugger - SynEdit - and more
    • wiki
Re: How do I resolve Debbuger GDB error?
« Reply #8 on: May 21, 2013, 11:11:45 pm »
Oh also try this, maybe it is in one of the system libraries used:

http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe_has_stopped_working

--eval-command="set auto-solib-add off"

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
[SOLVED]Re: How do I resolve Debbuger GDB error?
« Reply #9 on: May 22, 2013, 08:32:29 pm »
I played around with Project options-->Linking-->Debug info--->Stab and drawf.

Automatic - program crashes as soon as it starts with that message box I attached earlier.
Drawf with Sets (-gw -godwrafsets) - Same result program crashes as soon as it starts with that messagebox.
Drawf2 (-gw2) - Same Resut program crashes as soon as it starts with that messagebox.
Stabs (-gs) - My program in question actually compiles and runs. However, when I try to shut it down, compiler raised an error - something to do with array I believe.
Drawf3 (beta) (-gw3) - The program doesn't even run at all, but compiler raise a lot of syntax error.

Then, I went through all the packages' debug info settings and set them all to automatic. I could not disable the debug info setting for the packages or Lazarus completely crashes.

After setting everything to automatic for the project and packages, now my program actually went past GDB error. Still, I ran into other errors but that is more related to my program itself than Lazarus IDE.

Thanks,
« Last Edit: May 24, 2013, 02:57:25 pm by reltek »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12114
  • Debugger - SynEdit - and more
    • wiki
Re: How do I resolve Debbuger GDB error?
« Reply #10 on: May 22, 2013, 09:03:12 pm »
Automatic is decided to be either stabs or dwarf. FPC decides that, depending on OS, 32 or64 bit, ... Not sure what it is for you.

Dwarf3 is known not to work. (sorry should have mentioned)

Anyway, good to know you got a work around for now.

Code: [Select]
Then, I went through all the packages' debug info settings and set them all to automatic. I could not disable the debug info setting for the packages or Lazarus completely crashes.
Odd. That shouldn't happen.

You mean the IDE crashes? Can you start the IDE from a console (open a terminal and run lazarus), and see if there is any output (stacktrace)

Code: [Select]
Drawf3 (beta) (-gw3) - The program doesn't even run at all, but compiler raise a lot of syntax error.
Even odder, but would be an issue in fpc. The debug info type should not affect compilation.
Except if the errors are from the linker.
The linker is part of your linux. Not sure if there are known problems.


I am still curious what caused the issue at first, but it will be harder to find than the proverbial needle in the haystack.

Do you have other Computers, or VM with other OS? SO you could test, if the original error happens on all of them?
(Only if you got the spare time, of course).

Or, if it is not confidential, I can try on my system. But that is up to you. I can send my email for that)

 

TinyPortal © 2005-2018