LLDB: How To Print Sequence Of Chars
LLDB: How To Print Sequence Of Chars
- Subject: LLDB: How To Print Sequence Of Chars
- From: Andreas Grosam <email@hidden>
- Date: Fri, 25 Nov 2011 11:19:57 +0100
In my program I'm using an array of characters which is actually a string without the zero termination.
From the context, I know the length of the string, e.g. in a function:
template <typename CharT>
void foo(const CharT* s, size_t len)
{
...
}
In the example, the function will be instantiated with a char!
Now I would like to print the string into the console in LLDB.
I've tried a few variants, but I'm not satisfied with the result:
(lldb) expr -f c -- (char*)((void*)(s))
(char *) $14 = string\0\0
(lldb) expr -f uint8_t[] -- (char*)((void*)(s))
(char *) $18 = {0x73 0x74 0x72 0x69 0x6e 0x67 0x00 0x00}
(lldb) expr -f char[] -- (char*)((void*)(s))
(char *) $19 = {string\0\0}
(lldb) expr (int)printf("%.6s", s)
(int) $20 = 6
(lldb) expr -f char[6] -- (char*)((void*)(s))
Invalid format character or name 'char[6]'. Valid values are:
…
How would I do this?
Thanks in advance!
Regards
Andreas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden