First of, the debugger is having problems heer because
String is a C++ class and so it can’t directly translate it to a string. You need to look at the implementation of
String for your specific Arduino core to understand where the data actually lies.
However, you are already looking at the correct attributes of the object-- there’s a
buff pointer with capacity and length information.
What you’re hovering over is the
sso object – standing for short-string-optimization. This also indicates to me that you’re probably using the ESP32 Arduino core (support for SSO was added here), although you didn’t say so explicitly.
The string you’re looking at definitely seems empty now, because
len is 0. Refer to the source code here. You maybe hit the breakpoint before it was able to write anything to the string?
Generally for viewing the string’s content you’d first try and open the
buff: 0x3ff.: object on the left side and it hopefully gives you the data in its full form. You can also use direct gdb commands in the console to examine (
x) the memory, with commands like
“examine 1 zero-terminated string at address 0x3ffb843c” (docs). Or, more readably with variable names,
(might need an
* before the variable name). That assumes the string is null-terminated – if it isn’t, only print
len many bytes with e.g.
x/20c inputString._ptr.buff for examining 20 characters.