Display the value of wchar_t strings.
commite307e6d6083fcc8815a6899c87a2ac564b2a5e45
authorStefan Taferner <taferner@kde.org>
Mon, 9 Oct 2006 11:04:31 +0000 (9 13:04 +0200)
committerJohannes Sixt <johannes.sixt@telecom.at>
Sat, 21 Oct 2006 21:19:46 +0000 (21 23:19 +0200)
tree9e9de4985f244c621dd676ddaec97837bc90f725
parentb0df6c10920b64d78f88697eccdb57309fef719b
Display the value of wchar_t strings.

A small testprogram widechar.cpp is included in the directory testprogs.

The patch does the following:

The values of variables of type "wchar_t*" (as well as "const wchar_t*")
ar displayed analogous to "char*". I have used your implementations of
handlePrint methods as guidelines and implemented it the same way. When
a variable of type "wchar_t*" is found, then its contents is requested
from GDB and the resulting array is displayed as string.

Limitations:

Unfortunately, this does not work for arrays of wchar_t. A tip how this
could be done is appreciated.

If there are invalid pointers, then the function wcslen, which is used
internally, crashes. But GDB handles this correctly and there are no
problems (at least for me).

It is assumed that wchart_t and QChar contain the same characters.
At least this is the case for me, and as far as I understand this topic,
this should be ok generally.

[J6t: Actually, no. There is no guarantee that wchar_t contains Unicode
characters. But for all practical purposes, the assumption should be valid.]
kdbg/dbgdriver.h
kdbg/debugger.cpp
kdbg/debugger.h
kdbg/gdbdriver.cpp
kdbg/testprogs/Makefile.am
kdbg/testprogs/widechar.cpp [new file with mode: 0644]