Recent

Author Topic: null terminated character arrays formatting  (Read 1234 times)

440bx

  • Hero Member
  • *****
  • Posts: 4757
null terminated character arrays formatting
« on: June 26, 2024, 10:52:23 am »
Hello,

In the screenshot, notice the array "Output" is there twice.  Once showing every character individually quoted and a second time as a string (with only two quotes.)

The question is: is it possible to have the format as shown in the second instance (@Output[0]) but without having to create a second instance ? 

Thank you for your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 16201
  • Censorship about opinions does not belong here.
Re: null terminated character arrays formatting
« Reply #1 on: June 26, 2024, 11:12:12 am »
As long as there is a PChar cast involved, no. You know that as opposed to PChars, Pascal strings can contain zero's at any spot.
Looks to me only the first one is correct, but it is possible to see the content of the hex pointers in hex for the second one and since you can read hex, use that. ;D
« Last Edit: June 26, 2024, 11:14:40 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10560
  • Debugger - SynEdit - and more
    • wiki
Re: null terminated character arrays formatting
« Reply #2 on: June 26, 2024, 07:44:50 pm »
there is a setting on the setup of the display-formatter, that allows to show or hide the original value

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10560
  • Debugger - SynEdit - and more
    • wiki
Re: null terminated character arrays formatting
« Reply #3 on: June 26, 2024, 07:47:39 pm »
Sorry, partly misread the question.

But still, if you use the displayformatter for "array of char as string" then you can have both outputs => on the same line though, which means one may need scrolling.


If you don't mark the display formatter as checked (in the list / config), then you can select it for individual watches, in the watch properties.
« Last Edit: June 26, 2024, 07:50:15 pm by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 4757
Re: null terminated character arrays formatting
« Reply #4 on: June 27, 2024, 12:09:09 am »
Hi Martin,

First, I'm using Lazarus v3.4 (64 bit)

But still, if you use the displayformatter for "array of char as string" then you can have both outputs => on the same line though, which means one may need scrolling.
I am unable to find the option for "displayformatter for "array of char as string".  I've tried the field's properties in the watch window and the Tools->Options->Debugger but, I don't see an option like that.  Can you provide more specific information please ?

If you don't mark the display formatter as checked (in the list / config), then you can select it for individual watches, in the watch properties.
Same question, I can't find a place to "mark the display formatter as checked".  Where do I find that option ?

Thank you for your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018