0

I have char* type variable that contains some data at this address can be visible while debugging:

enter image description here

But I would like to see more data at this pointer, not just first character, I would like to see A[0]...A[16] array. How to achieve that?

Debugger shows that I have data "x\0340" that might be represented as 0x7fffffffd070. x according ascii table is 0x78, but there is no such value in hex representation. Why?

UPD

Can I assume that I have string that's first three characters are "\b<" and forth one is 027 in Octal (or 0x17) ?

enter image description here

vico
  • 17,051
  • 45
  • 159
  • 315
  • 1
    How long is the string `Ans`? It could be that `x\0340` is all it contains up to the zero delimiter. Anyway it's the `char*` *pointer* which has the address value 0x7fffffffd070, not the string itself – meowgoesthedog Jan 31 '18 at 16:30
  • How I should understand `\0340` value? Can I assume it is two bytes : 0x01 and 0x54 ? – vico Jan 31 '18 at 16:45
  • `\0340` constitutes two values, the first being the [octal escape sequence](https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences) `\034` (corresponding to hex value `0x1C`), and the second being "0" – meowgoesthedog Jan 31 '18 at 16:50
  • How to ask Eclipse show hex representation instead of octal (now idea how this format might be useful) ? – vico Jan 31 '18 at 17:14
  • I have updated message body with one more picture with my interpretation of debug info – vico Feb 13 '18 at 11:42
  • What do you see if you cast the pointer to `wchar_t*`? – meowgoesthedog Feb 13 '18 at 11:53
  • I'm not willing to interpret this to some human readable string. My program uses it as some array of bytes that sometimes might have not unicode characters. – vico Feb 13 '18 at 12:22
  • In that case the string in "Details" is all you are going to get. In C/C++ the sizes of memory blocks are not exposed, so eclipse is unable to print a general array pointer. Strings are only printable due to the zero delimiter. – meowgoesthedog Feb 13 '18 at 12:26
  • I know that my array will end with zero. I just want confirmation that I understand Eclipse debig info correctly - `first three characters are "\b<" and forth one is 027 in Octal (or 0x17)` – vico Feb 13 '18 at 12:29
  • The second line `(x)= *Ans` in your edit shows that the first character is `\b`, which is a [backspace character](https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences). `<` is just a character by itself, and `\027` = hex value `0x17` which is [ETB](https://en.wikipedia.org/wiki/End-of-Transmission-Block_character)(end of transmission block). Use a GDB breakpoint and call `strlen` on it to confirm that it is 3 characters long. – meowgoesthedog Feb 13 '18 at 12:35
  • Does this answer your question? [Eclipse-C++-Debugging: see content of an Array](https://stackoverflow.com/questions/1824685/eclipse-c-debugging-see-content-of-an-array) – user202729 Jan 11 '21 at 04:20

0 Answers0