Recent

Author Topic: Limited call stack when debugging 64 bit progs  (Read 1465 times)

Pascal

  • Hero Member
  • *****
  • Posts: 789
Limited call stack when debugging 64 bit progs
« on: June 01, 2018, 01:13:43 pm »
Debugging 64 bit prog with 32 bit Lazarus:
If program encounters an exception the call stack only shows current location!

What can i do to see the full call stack?
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Thaddy

  • Hero Member
  • *****
  • Posts: 7334
Re: Limited call stack when debugging 64 bit progs
« Reply #1 on: June 01, 2018, 03:34:06 pm »
Quote
Debugging 64 bit prog with 32 bit Lazarus
Really? You need a 64 bit capable debugger as well. So you also need a 64 bit capable GDB. The standard debugger is GDB for the platform. (Although with hoops and loops you - partially - may be be able to do that: from the GDB side, not the FPC or Lazarus side...). The address spaces are completely different.
64 bit GDB.... I am not aware that a standard 32bit GDB can debug all and any 64 bit code.
« Last Edit: June 01, 2018, 03:44:25 pm by Thaddy »
Brexit. My Indonesian and Dutch friends know what " Tempo doeloe" means....There is no empire.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5027
    • wiki
Re: Limited call stack when debugging 64 bit progs
« Reply #2 on: June 01, 2018, 03:59:17 pm »
There are some reports about stepping in 64bit windows not always working as expected. It is unclear where this arises, but could be between fpc and gdb. (and may be dwarf related).

As for stackframes....

1) Make sure ALL units are compiled with either -O- or -O-1
fpc_ansistring_assign may have optimization, though if PRHighlighToken and ALL its callers have no optimization it should still be ok...

Make sure you do not use smart linking in your project.

Not sure, I dont think inlining is an issue here, but you may but a {$Inline off} in the unit in question. (though probably not the issue)

2) Try dwarf vs stabs
Make sure ALL packages use the same. Mixing them is no good.
Use "Additions and overrides"

3) Try the external linker -Xe

Pascal

  • Hero Member
  • *****
  • Posts: 789
Re: Limited call stack when debugging 64 bit progs
« Reply #3 on: June 01, 2018, 07:36:45 pm »
Quote
Debugging 64 bit prog with 32 bit Lazarus
Really? You need a 64 bit capable debugger as well. So you also need a 64 bit capable GDB. The standard debugger is GDB for the platform. (Although with hoops and loops you - partially - may be be able to do that: from the GDB side, not the FPC or Lazarus side...). The address spaces are completely different.
64 bit GDB.... I am not aware that a standard 32bit GDB can debug all and any 64 bit code.

Of course! If i hadn't used a 64 bit gdb i couldn't debug a 64 bit app ...
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 789
Re: Limited call stack when debugging 64 bit progs
« Reply #4 on: June 01, 2018, 09:44:24 pm »
There are some reports about stepping in 64bit windows not always working as expected. It is unclear where this arises, but could be between fpc and gdb. (and may be dwarf related).

As for stackframes....

1) Make sure ALL units are compiled with either -O- or -O-1
fpc_ansistring_assign may have optimization, though if PRHighlighToken and ALL its callers have no optimization it should still be ok...

Make sure you do not use smart linking in your project.

Not sure, I dont think inlining is an issue here, but you may but a {$Inline off} in the unit in question. (though probably not the issue)

2) Try dwarf vs stabs
Make sure ALL packages use the same. Mixing them is no good.
Use "Additions and overrides"

3) Try the external linker -Xe

Compiling fpc with "-gl -O-" instead of "-gl" made it work again. Thanks!
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)