Recent

Author Topic: Not nice string look in the Call Stack  (Read 1922 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1366
    • UVviewsoft
Not nice string look in the Call Stack
« on: July 31, 2021, 11:04:42 pm »

Code: Pascal  [Select][+][-]
  1. #5 EDITORSETLINE(0x7ffff56ccd50, 16, 0x7ffff413ef58 '  from', ' ' <repeats 12 times>, 'cudatex'...) at proc_editor.pas:2048
  2.  

This is shown for the line
Code: Pascal  [Select][+][-]
  1.   from            cudatext_keys   import *
  2.  

Why this cryptic look?
1) some hex number before value
2) <repeated 12 times>


I use gdb
user@PC:~$ gdb --version
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7384
  • Debugger - SynEdit - and more
    • wiki
Re: Not nice string look in the Call Stack
« Reply #1 on: August 01, 2021, 12:11:19 am »
This is how gdb formats it...
Gdb has no concept for a Pascal string. So this is either a pchar or array of char (depending on fpc version, and dwarf version used).

1)
Since pchar is a pointer, gdb starts with the address that is stored in the pointer.
The problem is, that even if the IDE would want to do something about it, using gdb there is no way to find out if it is a string.
(In fact, there is no such info in dwarf)

and a pchar might want to include the address. (ideally as an option, but that sort of fine-tuning is still a good bit away)


2)
Gdb does "shorten" repeating chars. (No idea, maybe there is a setting).

If this is in the IDE, the IDE does not currently undo the "repeats n times" (it mostly happens if there is trash at the end of a string)
Actually, in the callstack/threads/locals the IDE gives the verbatim gdb representation.
Only in watches does the IDE do some clean up...

 

TinyPortal © 2005-2018