7

So, I have a variable buffPtr: TPointer It has a size of 16 and contains a series of numbers, mostly starting with 0, say something like 013854351387365. I'm sure it contains values, because the application does what it does fine.

I want to see this value while I'm debugging.

If I add "PAnsiChar(buffPtr)^" to the watches I only see the first byte.

1
  • 1
    Did you tried to put PAnsiChar(BufPtr) (without the ^)? Commented Jan 8, 2013 at 16:57

3 Answers 3

11

Just type in the watch expression PAnsiChar(buffPtr)^,16 or PByte(buffPtr)^,16 if you want the ordinal/byte values.

The trick here is to add the number of pattern repeat after a comma, like ,16.

It is IMHO more convenient than changing the Watch Properties, and it works with the F7 evaluation command of the IDE.

Sign up to request clarification or add additional context in comments.

Comments

9

I added a watch to PAnsiChar(buffPtr)^

with the Watch Properties as

Repeat Count = 16 Decimal

enter image description here

2 Comments

I don't understand the question or the answer. Could you elaborate?
It would be nice if you also included a picture of the output from this configuration, instead of just the input of the dialog.
3

Did you set the watch do dump a region of memory? For some structures that helps.

If you can recompile your application, then define this:

type
  T16Values = array[0..15] of Byte;
  P16Values = ^T16Values;

Then cast your pointer into a P16Values, and view that.

If it is another data type than Byte, change the above code accordingly.

3 Comments

IMHO you don't need that, since the debugger handle custom repetition directly.
Sometimes it is more convenient to do this at code time, as saving debugger settings requires you to save the whole .DSK, which often results in pain.
... or just add ,16 to the expression. No need to change the settings. ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.