Recent

Author Topic: Debugger / call stack not opening "view source" correctly  (Read 4094 times)

MISV

  • Hero Member
  • *****
  • Posts: 783
Debugger / call stack not opening "view source" correctly
« on: May 16, 2015, 03:15:50 pm »
If I get an exception I can have:

- Assembler window
- Call stack

However, I can not use the "View Source" button from "call stack" - all just state "Line 0"

For Lazarus/FPC code units, doubleclicking in the callstack will open the unit at line 0.
For my own units in a shared directory, doubleclicking opens nothing.

For tor the latter it may be I need to add a unit uses/reference somewhere? But I think I already added it to all necessary places.... What could I be missing?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger / call stack not opening "view source" correctly
« Reply #1 on: May 16, 2015, 04:00:37 pm »
FPC version ?
GDB version ?

What kind of exception?
- raise exception.create (exception thrown by code)
- run error (div 0 / range check /...)
- access violation


Dwarf or Stabs? Unless you got the old gdb 6.3.50 (which needs stabs), it should be dwarf.

If the exception is in a package (e.g. you call LCL and LCL fails) then it may help to compile the package with debug info too.
Either go to the options of each package, or use "Additions and overrides" (search wiki), add -gw for dwarf).

Since you get the unit, but not the line, it is likely to be a package, that has no debug info.

------------
If the exception is inside a library (so) or kernel, then it may also be impossible, because libraries may not provide the information needed to resolve the stack.

In cases of access violations (and sometimes  others), if your code wrote to memory it should not have written too, your code may have overridden the stack, then there is no way to get it.

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: Debugger / call stack not opening "view source" correctly
« Reply #2 on: May 17, 2015, 12:10:51 pm »
OSX Lazarus 1.2.6 using GDB (i.e. everything about 3 months old. but was the newest back then. I will try dig up versions)

Happens with all exceptions kinds


For reference:
I have just checked the options for my own package containing my own units and components. Under "debugging" I only have:

[yes] Generate debugging info for GDB
Type of debug info [Automatic (-g)
[yes] Display line numbers in runtime error backtraces (-gl)


I will try investigate your suggestions today!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger / call stack not opening "view source" correctly
« Reply #3 on: May 17, 2015, 03:10:27 pm »
automatic unfortunately is stabs, and does not work well on OSX.


The easiest way to update all packages, is "override and additions" (That may require Laz 1.4). That is in your project, and only needs changes there. add -gw
« Last Edit: May 17, 2015, 03:12:58 pm by Martin_fr »

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: Debugger / call stack not opening "view source" correctly
« Reply #4 on: May 18, 2015, 02:25:05 pm »
Hi,

I did not have "override and additions" in 1.2.6 but it is there in 1.4.0 :)

I have now
clicked "Add > Custom option"
and
typed "-gw"

For reference I use GDB 7.8.1, PPC 2.6.4, Lazarus 1.4.0. Looking in 1.4.0 in project options > debugging I can see I use "Dwarf with sets (-gw godwarfsets)

Does that mean I remove the addition I made in "override and additions" or is that still necessary, so the setting is applied to all packages compiled in my application?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Debugger / call stack not opening "view source" correctly
« Reply #5 on: May 18, 2015, 02:53:56 pm »
Code: [Select]
in project options > debugging Each package has its own setting. And they can be different.

So you should test to change them (easiest with Additions and overrides)

Can you copy and paste an example of the stack you get (without line numbers, but I assume with unit/file names)?

Also have you tried to look at more than the default 10 lines?

MISV

  • Hero Member
  • *****
  • Posts: 783
Re: Debugger / call stack not opening "view source" correctly
« Reply #6 on: May 24, 2015, 11:20:28 am »
Thanks for all your help. I will return soon with the results :)

 

TinyPortal © 2005-2018