Ilia K b9bfd969e3 Add support for Unicode strings in CMICmnLLDBUtilSBValue::GetValue (MI)
This patch includes the following changes:
# Add CMIUtilString::ConvertToASCII to convert unicode to ASCII (MI)
# Rework CMICmnLLDBUtilSBValue::GetSimpleValue to print wide/unicode char (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValueChar
## Extend CMICmnLLDBUtilSBValue::IsCharType to accept char16_t/char32_t
## Don't ignore the fail_value in SBValue::GetValueAsUnsigned
# Rework CMIUtilString::ConvertToASCII (MI)
## Don't use templates
## Change the function signature to convert signle characters (was std::basic_string)
## Rename CMIUtilString::ConvertToASCII to CMIUtilString::ConvertToPrintableASCII
# Add CMIUtilString::ConvertToPrintableASCII for char (MI)
## Refactor CMIUtilString::Escape
## Simplify CMICmnLLDBUtilSBValue::GetSimpleValueChar for char
# Add char16_t* and char32_t* support in CMICmnLLDBUtilSBValue::GetSimpleValue (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValueCStringPointer
## Add CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory2
   (it's extended version of CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory)
# Improve error checking in CMICmnLLDBUtilSBValue::GetSimpleValueChar (MI)
# Refactor CMICmnLLDBUtilSBValue (MI)
## Remove CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory
   (use CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory2 instead)
## Rename CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory2 to
   CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory
## Move CMICmnLLDBUtilSBValue::GetValueCString to private methods
## Rename CMICmnLLDBUtilSBValue::GetValueCString to
   CMICmnLLDBUtilSBValue::GetSimpleValueCStringArray
## Remove CMICmnLLDBUtilSBValue::GetChildValueCString
# Improve MiGdbSetShowTestCase.test_lldbmi_gdb_set_show_print_char_array_as_string test to check char16_t/char32_t (MI)
# Fix CMICmnLLDBUtilSBValue::GetSimpleValueCStringArray for Unicode (MI)
## Fix handling of char16_t and char32_t
## Improve CMICmnLLDBUtilSBValue::ReadCStringFromHostMemory to read
   variables of type char[]: add vnMaxLen argument
## Turn on few cases to check char16_t[] and char32_t[] output in
   MiGdbSetShowTestCase.test_lldbmi_gdb_set_show_print_char_array_as_string
# Remove unnecessary checks in CMICmnLLDBUtilSBValue (MI)

llvm-svn: 236827
2015-05-08 11:21:13 +00:00

93 lines
2.2 KiB
C++

//===-- main.cpp ------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <cstdint>
struct complex_type
{
int i;
struct { long l; } inner;
complex_type *complex_ptr;
};
void
var_update_test(void)
{
long l = 1;
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_var_update_test_init
l = 0;
// BP_var_update_test_l
complx.inner.l = 2;
// BP_var_update_test_complx
complx_array[1].inner.l = 4;
// BP_var_update_test_complx_array
}
void
var_list_children(void)
{
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_var_list_children
}
void
gdb_set_show_print_char_array_as_string_test(void)
{
const char *cp = "hello";
const char ca[] = "hello";
const char16_t *u16p = u"hello";
const char16_t u16a[] = u"hello";
const char32_t *u32p = U"hello";
const char32_t u32a[] = U"hello";
// BP_gdb_set_show_print_char_array_as_string_test
}
void
gdb_set_show_print_expand_aggregates(void)
{
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_gdb_set_show_print_expand_aggregates
}
void
gdb_set_show_print_aggregate_field_names(void)
{
complex_type complx = { 3, { 3L }, &complx };
complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
// BP_gdb_set_show_print_aggregate_field_names
}
int g_MyVar = 3;
static int s_MyVar = 4;
int
main(int argc, char const *argv[])
{
int a = 10, b = 20;
s_MyVar = a + b;
var_update_test();
var_list_children();
gdb_set_show_print_char_array_as_string_test();
gdb_set_show_print_expand_aggregates();
gdb_set_show_print_aggregate_field_names();
return 0; // BP_return
}