* c-lang.c (convert_octal): Only allow 3 octal digits.
	(print_wchar): Prefer 3-digit octal form.  Fall back to hex if
	needed.
	* c-exp.y (c_parse_escape): Only allow 3 octal digits.
gdb/testsuite
	* gdb.base/call-rt-st.exp: Update for change to escape output.
	* gdb.base/callfuncs.exp: Likewise.
	* gdb.base/charset.exp: Likewise.
	* gdb.base/constvars.exp: Likewise.
	* gdb.base/long_long.exp: Likewise.
	* gdb.base/pointers.exp: Likewise.
	* gdb.base/printcmds.exp: Likewise.
	* gdb.base/setvar.exp: Likewise.
	* gdb.base/store.exp: Likewise.
	* gdb.cp/ref-types.exp: Likewise.
	* gdb.mi/mi-var-child.exp: Likewise.
	* gdb.mi/mi-var-display.exp: Likewise.
	* gdb.mi/mi2-var-display.exp: Likewise.
	* gdb.base/charset.exp: Test octal escape sequence length.
	Update for change to escape output.
This commit is contained in:
Tom Tromey
2009-07-07 21:33:50 +00:00
parent 7ec721f405
commit 30b66ecc73
17 changed files with 106 additions and 65 deletions

View File

@ -1,3 +1,10 @@
2009-07-07 Tom Tromey <tromey@redhat.com>
* c-lang.c (convert_octal): Only allow 3 octal digits.
(print_wchar): Prefer 3-digit octal form. Fall back to hex if
needed.
* c-exp.y (c_parse_escape): Only allow 3 octal digits.
2009-07-07 Paul Pluzhnikov <ppluzhnikov@google.com> 2009-07-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/python-value.c (valpy_getitem): Remove incorrect assert. * python/python-value.c (valpy_getitem): Remove incorrect assert.

View File

@ -1440,14 +1440,19 @@ c_parse_escape (char **ptr, struct obstack *output)
case '5': case '5':
case '6': case '6':
case '7': case '7':
{
int i;
if (output) if (output)
obstack_grow_str (output, "\\"); obstack_grow_str (output, "\\");
while (isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9') for (i = 0;
i < 3 && isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9';
++i)
{ {
if (output) if (output)
obstack_1grow (output, *tokptr); obstack_1grow (output, *tokptr);
++tokptr; ++tokptr;
} }
}
break; break;
/* We handle UCNs later. We could handle them here, but that /* We handle UCNs later. We could handle them here, but that

View File

@ -225,7 +225,12 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
char octal[30]; char octal[30];
ULONGEST value; ULONGEST value;
value = extract_unsigned_integer (&orig[i], width, byte_order); value = extract_unsigned_integer (&orig[i], width, byte_order);
sprintf (octal, "\\%lo", (long) value); /* If the value fits in 3 octal digits, print it that
way. Otherwise, print it as a hex escape. */
if (value <= 0777)
sprintf (octal, "\\%.3o", (int) (value & 0777));
else
sprintf (octal, "\\x%lx", (long) value);
append_string_as_wide (octal, output); append_string_as_wide (octal, output);
} }
/* If we somehow have extra bytes, print them now. */ /* If we somehow have extra bytes, print them now. */
@ -770,9 +775,12 @@ emit_numeric_character (struct type *type, unsigned long value,
static char * static char *
convert_octal (struct type *type, char *p, char *limit, struct obstack *output) convert_octal (struct type *type, char *p, char *limit, struct obstack *output)
{ {
int i;
unsigned long value = 0; unsigned long value = 0;
while (p < limit && isdigit (*p) && *p != '8' && *p != '9') for (i = 0;
i < 3 && p < limit && isdigit (*p) && *p != '8' && *p != '9';
++i)
{ {
value = 8 * value + host_hex_value (*p); value = 8 * value + host_hex_value (*p);
++p; ++p;

View File

@ -1,3 +1,21 @@
2009-07-07 Tom Tromey <tromey@redhat.com>
* gdb.base/call-rt-st.exp: Update for change to escape output.
* gdb.base/callfuncs.exp: Likewise.
* gdb.base/charset.exp: Likewise.
* gdb.base/constvars.exp: Likewise.
* gdb.base/long_long.exp: Likewise.
* gdb.base/pointers.exp: Likewise.
* gdb.base/printcmds.exp: Likewise.
* gdb.base/setvar.exp: Likewise.
* gdb.base/store.exp: Likewise.
* gdb.cp/ref-types.exp: Likewise.
* gdb.mi/mi-var-child.exp: Likewise.
* gdb.mi/mi-var-display.exp: Likewise.
* gdb.mi/mi2-var-display.exp: Likewise.
* gdb.base/charset.exp: Test octal escape sequence length.
Update for change to escape output.
2009-07-07 Jan Kratochvil <jan.kratochvil@redhat.com> 2009-07-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.mi/mi2-var-cmd.exp (floating varobj invalidation): New test. * gdb.mi/mi2-var-cmd.exp (floating varobj invalidation): New test.

View File

@ -186,7 +186,7 @@ if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \
if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] { if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] {
print_struct_call "print_bit_flags_char(*cflags)" \ print_struct_call "print_bit_flags_char(*cflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\1', beta = 0 '\\\\0', gamma = 1 '\\\\1', delta = 0 '\\\\0', epsilon = 1 '\\\\1', omega = 0 '\\\\0'\\}" ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\000', gamma = 1 '\\\\001', delta = 0 '\\\\000', epsilon = 1 '\\\\001', omega = 0 '\\\\000'\\}"
} }
if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] { if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] {

View File

@ -439,7 +439,7 @@ gdb_test "print t_small_values(1,3,5,7,9,11,13,15,17,19)" \
"The program being debugged stopped while.*" \ "The program being debugged stopped while.*" \
"stop at nested call level 4" "stop at nested call level 4"
gdb_test "backtrace" \ gdb_test "backtrace" \
"\#0 t_small_values \\(arg1=1 '.1', arg2=3, arg3=5, arg4=7 '.a', arg5=9, arg6=11 '.v', arg7=13, arg8=15, arg9=17, arg10=19\\).*\#2 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#3 <function called from gdb>.*\#4 add \\(a=4, b=5\\).*\#5 <function called from gdb>.*\#6 add \\(a=2, b=3\\).*\#7 <function called from gdb>.*\#8 main.*" \ "\#0 t_small_values \\(arg1=1 '.001', arg2=3, arg3=5, arg4=7 '.a', arg5=9, arg6=11 '.v', arg7=13, arg8=15, arg9=17, arg10=19\\).*\#2 sum10 \\(i0=2, i1=4, i2=6, i3=8, i4=10, i5=12, i6=14, i7=16, i8=18, i9=20\\).*\#3 <function called from gdb>.*\#4 add \\(a=4, b=5\\).*\#5 <function called from gdb>.*\#6 add \\(a=2, b=3\\).*\#7 <function called from gdb>.*\#8 main.*" \
"backtrace at nested call level 4" "backtrace at nested call level 4"
gdb_test "finish" "Value returned is .* = 100" \ gdb_test "finish" "Value returned is .* = 100" \
"Finish from nested call level 4" "Finish from nested call level 4"

View File

@ -409,7 +409,7 @@ foreach target_charset $charset_subset {
# gdb_test that requires us to use gdb_expect here. # gdb_test that requires us to use gdb_expect here.
send_gdb "print $L'\\0'\n" send_gdb "print $L'\\0'\n"
gdb_expect { gdb_expect {
-re "\\\$${decimal} = 0 $L'\\\\0'\[\r\n\]+$gdb_prompt $" { -re "\\\$${decimal} = 0 $L'\\\\000'\[\r\n\]+$gdb_prompt $" {
pass "print the null character in ${target_charset}" pass "print the null character in ${target_charset}"
} }
-re "$gdb_prompt $" { -re "$gdb_prompt $" {
@ -552,6 +552,9 @@ gdb_test "print '\\x'" "\\\\x escape without a following hex digit."
gdb_test "print '\\u'" "\\\\u escape without a following hex digit." gdb_test "print '\\u'" "\\\\u escape without a following hex digit."
gdb_test "print '\\9'" " = \[0-9\]+ '9'" gdb_test "print '\\9'" " = \[0-9\]+ '9'"
# An octal escape can only be 3 digits.
gdb_test "print \"\\1011\"" " = \"A1\""
# Tests for wide- or unicode- strings. L is the prefix letter to use, # Tests for wide- or unicode- strings. L is the prefix letter to use,
# either "L" (for wide strings), "u" (for UCS-2), or "U" (for UCS-4). # either "L" (for wide strings), "u" (for UCS-2), or "U" (for UCS-4).
# NAME is used in the test names and should be related to the prefix # NAME is used in the test names and should be related to the prefix
@ -563,7 +566,7 @@ proc test_wide_or_unicode {L name} {
"narrow and $name string concatenation" "narrow and $name string concatenation"
gdb_test "print \"ab\" $L\"c\"" " = $L\"abc\"" \ gdb_test "print \"ab\" $L\"c\"" " = $L\"abc\"" \
"$name and narrow string concatenation" "$name and narrow string concatenation"
gdb_test "print $L\"\\xe\" $L\"c\"" " = $L\"\\\\16c\"" \ gdb_test "print $L\"\\xe\" $L\"c\"" " = $L\"\\\\016c\"" \
"$name string concatenation with escape" "$name string concatenation with escape"
gdb_test "print $L\"\" \"abcdef\" \"g\"" \ gdb_test "print $L\"\" \"abcdef\" \"g\"" \
"$L\"abcdefg\"" \ "$L\"abcdefg\"" \

View File

@ -161,7 +161,7 @@ proc do_constvar_tests {} {
gdb_test "print laconic" " = 65 'A'" gdb_test "print laconic" " = 65 'A'"
local_compiler_xfail_check local_compiler_xfail_check
gdb_test "ptype laconic" "type = const char" gdb_test "ptype laconic" "type = const char"
gdb_test "print laggard" " = 1 '.1'" gdb_test "print laggard" " = 1 '.001'"
local_compiler_xfail_check local_compiler_xfail_check
gdb_test "ptype laggard" "type = const unsigned char" gdb_test "ptype laggard" "type = const unsigned char"
gdb_test "print lagoon" " = 2" gdb_test "print lagoon" " = 2"
@ -209,7 +209,7 @@ proc do_constvar_tests {} {
gdb_test "print *lewd" " = 65 'A'" gdb_test "print *lewd" " = 65 'A'"
local_compiler_xfail_check local_compiler_xfail_check
gdb_test "ptype lewd" "type = const char \\* const" gdb_test "ptype lewd" "type = const char \\* const"
gdb_test "print *lexicographer" " = 1 '.1'" gdb_test "print *lexicographer" " = 1 '.001'"
local_compiler_xfail_check local_compiler_xfail_check
gdb_test "ptype lexicographer" "type = const unsigned char \\* const" gdb_test "ptype lexicographer" "type = const unsigned char \\* const"
gdb_test "print *lexicon" " = 2" gdb_test "print *lexicon" " = 2"
@ -233,7 +233,7 @@ proc do_constvar_tests {} {
gdb_test "print *languish" " = 65 'A'" gdb_test "print *languish" " = 65 'A'"
local_compiler_xfail_check local_compiler_xfail_check
gdb_test "ptype languish" "type = const char \\*" gdb_test "ptype languish" "type = const char \\*"
gdb_test "print *languor" " = 1 '.1'" gdb_test "print *languor" " = 1 '.001'"
local_compiler_xfail_check local_compiler_xfail_check
gdb_test "ptype languor" "type = const unsigned char \\*" gdb_test "ptype languor" "type = const unsigned char \\*"
gdb_test "print *lank" " = 2" gdb_test "print *lank" " = 2"

View File

@ -211,7 +211,7 @@ gdb_test_char "p/o *(char *)c" "01"
gdb_test_char "p/t *(char *)c" "1" gdb_test_char "p/t *(char *)c" "1"
gdb_test_char "p/a *(char *)c" "0x1( <.*>)?" gdb_test_char "p/a *(char *)c" "0x1( <.*>)?"
gdb_test_char "p/f *(char *)c" "1" gdb_test_char "p/f *(char *)c" "1"
gdb_test_char "p/c *(char *)c" "1 '.1'" gdb_test_char "p/c *(char *)c" "1 '.001'"
gdb_test_short "p/x *(short *)s" "" "0x123" "" gdb_test_short "p/x *(short *)s" "" "0x123" ""
gdb_test_short "p/d *(short *)s" "" "291" "" gdb_test_short "p/d *(short *)s" "" "291" ""
@ -258,7 +258,7 @@ gdb_test "x/u w" "19088743"
gdb_test "x/o w" "0110642547" gdb_test "x/o w" "0110642547"
gdb_test "x/t w" "00000001001000110100010101100111" gdb_test "x/t w" "00000001001000110100010101100111"
gdb_test_xptr "x/a" { b "" } { h "" } { w "0x1234567" } { g "0x123456789abcdef" } gdb_test_xptr "x/a" { b "" } { h "" } { w "0x1234567" } { g "0x123456789abcdef" }
gdb_test "x/c b" "1 '.1'" gdb_test "x/c b" "1 '.001'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } { if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
gdb_test "x/f &val.oct" "-5.9822653797615723e-120" gdb_test "x/f &val.oct" "-5.9822653797615723e-120"
} else { } else {
@ -274,7 +274,7 @@ gdb_test "x/2u g" "81985529216486895.*12046818088235383159"
gdb_test "x/2o g" "04432126361152746757.*01234567123456701234567" gdb_test "x/2o g" "04432126361152746757.*01234567123456701234567"
gdb_test "x/2t g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111" gdb_test "x/2t g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111"
gdb_test_xptr "x/2a" { b "" } { h "" } { w "0x1234567.*0xa72ee539" } { g "0x123456789abcdef.*0xa72ee53977053977" } gdb_test_xptr "x/2a" { b "" } { h "" } { w "0x1234567.*0xa72ee539" } { g "0x123456789abcdef.*0xa72ee53977053977" }
gdb_test "x/2c b" "1 '.1'.*-89 '.\[0-9\]*'" gdb_test "x/2c b" "1 '.001'.*-89 '.\[0-9\]*'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } { if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
gdb_test "x/2f &val.oct" "-5.9822653797615723e-120.*-5.9041889495880968e-100" gdb_test "x/2f &val.oct" "-5.9822653797615723e-120.*-5.9041889495880968e-100"
} else { } else {
@ -289,7 +289,7 @@ gdb_test "x/2bu b" "1.*167"
gdb_test "x/2bo b" "01.*0247" gdb_test "x/2bo b" "01.*0247"
gdb_test "x/2bt b" "00000001.*10100111" gdb_test "x/2bt b" "00000001.*10100111"
gdb_test_ptr "x/2ba b" "" "" "0x1.*0xffffffa7" "0x1.*0xffffffffffffffa7" gdb_test_ptr "x/2ba b" "" "" "0x1.*0xffffffa7" "0x1.*0xffffffffffffffa7"
gdb_test "x/2bc b" "1 '.1'.*-89 '.\[0-9\]*'" gdb_test "x/2bc b" "1 '.001'.*-89 '.\[0-9\]*'"
gdb_test "x/2bf b" "1.*-89" gdb_test "x/2bf b" "1.*-89"
gdb_test "x/2hx h" "0x0123.*0xa72e" gdb_test "x/2hx h" "0x0123.*0xa72e"

View File

@ -389,7 +389,7 @@ gdb_expect {
send_gdb "print *pUC\n" send_gdb "print *pUC\n"
gdb_expect { gdb_expect {
-re ".\[0-9\]* = 21 \'.25\'.*$gdb_prompt $" { -re ".\[0-9\]* = 21 \'.025\'.*$gdb_prompt $" {
pass "print value of *pUC" pass "print value of *pUC"
} }
-re ".*$gdb_prompt $" { fail "print value of *pUC" } -re ".*$gdb_prompt $" { fail "print value of *pUC" }

View File

@ -136,13 +136,13 @@ proc test_integer_literals_rejected {} {
proc test_print_all_chars {} { proc test_print_all_chars {} {
global gdb_prompt global gdb_prompt
gdb_test "p ctable1\[0\]" " = 0 '\\\\0'" gdb_test "p ctable1\[0\]" " = 0 '\\\\000'"
gdb_test "p ctable1\[1\]" " = 1 '\\\\1'" gdb_test "p ctable1\[1\]" " = 1 '\\\\001'"
gdb_test "p ctable1\[2\]" " = 2 '\\\\2'" gdb_test "p ctable1\[2\]" " = 2 '\\\\002'"
gdb_test "p ctable1\[3\]" " = 3 '\\\\3'" gdb_test "p ctable1\[3\]" " = 3 '\\\\003'"
gdb_test "p ctable1\[4\]" " = 4 '\\\\4'" gdb_test "p ctable1\[4\]" " = 4 '\\\\004'"
gdb_test "p ctable1\[5\]" " = 5 '\\\\5'" gdb_test "p ctable1\[5\]" " = 5 '\\\\005'"
gdb_test "p ctable1\[6\]" " = 6 '\\\\6'" gdb_test "p ctable1\[6\]" " = 6 '\\\\006'"
gdb_test "p ctable1\[7\]" " = 7 '\\\\a'" gdb_test "p ctable1\[7\]" " = 7 '\\\\a'"
gdb_test "p ctable1\[8\]" " = 8 '\\\\b'" gdb_test "p ctable1\[8\]" " = 8 '\\\\b'"
gdb_test "p ctable1\[9\]" " = 9 '\\\\t'" gdb_test "p ctable1\[9\]" " = 9 '\\\\t'"
@ -150,24 +150,24 @@ proc test_print_all_chars {} {
gdb_test "p ctable1\[11\]" " = 11 '\\\\v'" gdb_test "p ctable1\[11\]" " = 11 '\\\\v'"
gdb_test "p ctable1\[12\]" " = 12 '\\\\f'" gdb_test "p ctable1\[12\]" " = 12 '\\\\f'"
gdb_test "p ctable1\[13\]" " = 13 '\\\\r'" gdb_test "p ctable1\[13\]" " = 13 '\\\\r'"
gdb_test "p ctable1\[14\]" " = 14 '\\\\16'" gdb_test "p ctable1\[14\]" " = 14 '\\\\016'"
gdb_test "p ctable1\[15\]" " = 15 '\\\\17'" gdb_test "p ctable1\[15\]" " = 15 '\\\\017'"
gdb_test "p ctable1\[16\]" " = 16 '\\\\20'" gdb_test "p ctable1\[16\]" " = 16 '\\\\020'"
gdb_test "p ctable1\[17\]" " = 17 '\\\\21'" gdb_test "p ctable1\[17\]" " = 17 '\\\\021'"
gdb_test "p ctable1\[18\]" " = 18 '\\\\22'" gdb_test "p ctable1\[18\]" " = 18 '\\\\022'"
gdb_test "p ctable1\[19\]" " = 19 '\\\\23'" gdb_test "p ctable1\[19\]" " = 19 '\\\\023'"
gdb_test "p ctable1\[20\]" " = 20 '\\\\24'" gdb_test "p ctable1\[20\]" " = 20 '\\\\024'"
gdb_test "p ctable1\[21\]" " = 21 '\\\\25'" gdb_test "p ctable1\[21\]" " = 21 '\\\\025'"
gdb_test "p ctable1\[22\]" " = 22 '\\\\26'" gdb_test "p ctable1\[22\]" " = 22 '\\\\026'"
gdb_test "p ctable1\[23\]" " = 23 '\\\\27'" gdb_test "p ctable1\[23\]" " = 23 '\\\\027'"
gdb_test "p ctable1\[24\]" " = 24 '\\\\30'" gdb_test "p ctable1\[24\]" " = 24 '\\\\030'"
gdb_test "p ctable1\[25\]" " = 25 '\\\\31'" gdb_test "p ctable1\[25\]" " = 25 '\\\\031'"
gdb_test "p ctable1\[26\]" " = 26 '\\\\32'" gdb_test "p ctable1\[26\]" " = 26 '\\\\032'"
gdb_test "p ctable1\[27\]" " = 27 '\\\\33'" gdb_test "p ctable1\[27\]" " = 27 '\\\\033'"
gdb_test "p ctable1\[28\]" " = 28 '\\\\34'" gdb_test "p ctable1\[28\]" " = 28 '\\\\034'"
gdb_test "p ctable1\[29\]" " = 29 '\\\\35'" gdb_test "p ctable1\[29\]" " = 29 '\\\\035'"
gdb_test "p ctable1\[30\]" " = 30 '\\\\36'" gdb_test "p ctable1\[30\]" " = 30 '\\\\036'"
gdb_test "p ctable1\[31\]" " = 31 '\\\\37'" gdb_test "p ctable1\[31\]" " = 31 '\\\\037'"
gdb_test "p ctable1\[32\]" " = 32 ' '" gdb_test "p ctable1\[32\]" " = 32 ' '"
gdb_test "p ctable1\[33\]" " = 33 '!'" gdb_test "p ctable1\[33\]" " = 33 '!'"
gdb_test "p ctable1\[34\]" " = 34 '\"'" gdb_test "p ctable1\[34\]" " = 34 '\"'"
@ -475,13 +475,13 @@ proc test_print_strings {} {
gdb_test "p &ctable1\[0\]" \ gdb_test "p &ctable1\[0\]" \
" = \\(unsigned char \\*\\) \"\"" " = \\(unsigned char \\*\\) \"\""
gdb_test "p &ctable1\[1\]" \ gdb_test "p &ctable1\[1\]" \
" = \\(unsigned char \\*\\) \"\\\\1\\\\2\\\\3\\\\4\\\\5\\\\6\\\\a\\\\b\"..." " = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
gdb_test "p &ctable1\[1*8\]" \ gdb_test "p &ctable1\[1*8\]" \
" = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\16\\\\17\"..." " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\017\"..."
gdb_test "p &ctable1\[2*8\]" \ gdb_test "p &ctable1\[2*8\]" \
" = \\(unsigned char \\*\\) \"\\\\20\\\\21\\\\22\\\\23\\\\24\\\\25\\\\26\\\\27\"..." " = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
gdb_test "p &ctable1\[3*8\]" \ gdb_test "p &ctable1\[3*8\]" \
" = \\(unsigned char \\*\\) \"\\\\30\\\\31\\\\32\\\\33\\\\34\\\\35\\\\36\\\\37\"..." " = \\(unsigned char \\*\\) \"\\\\030\\\\031\\\\032\\\\033\\\\034\\\\035\\\\036\\\\037\"..."
gdb_test "p &ctable1\[4*8\]" \ gdb_test "p &ctable1\[4*8\]" \
" = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..." " = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..."
gdb_test "p &ctable1\[5*8\]" \ gdb_test "p &ctable1\[5*8\]" \
@ -622,7 +622,7 @@ proc test_print_string_constants {} {
set timeout 60; set timeout 60;
gdb_test "p \"a string\"" " = \"a string\"" gdb_test "p \"a string\"" " = \"a string\""
gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\0 null\"" gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\000 null\""
gdb_test "p \"abcd\"\[2\]" " = 99 'c'" gdb_test "p \"abcd\"\[2\]" " = 99 'c'"
gdb_test "p sizeof (\"abcdef\")" " = 7" gdb_test "p sizeof (\"abcdef\")" " = 7"
gdb_test "ptype \"foo\"" " = char \\\[4\\\]" gdb_test "ptype \"foo\"" " = char \\\[4\\\]"

View File

@ -120,8 +120,8 @@ proc test_set { args } {
# range of values that are common to both (0-127). # range of values that are common to both (0-127).
# #
test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.0\'" "set variable char=0" test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0"
test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.1\'" "set variable char=1" test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)" test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)"
test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)" test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')" test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
@ -131,8 +131,8 @@ test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'"
# #
# test "set variable" for type "signed char" # test "set variable" for type "signed char"
# #
test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.0\'" "set variable signed char=0" test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0"
test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.1\'" "set variable signed char=1" test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)" test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)"
test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)" test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')" test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
@ -150,8 +150,8 @@ gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \
# #
# test "set variable" for type "unsigned char" # test "set variable" for type "unsigned char"
# #
test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.0\'" "set variable unsigned char=0" test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0"
test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.1\'" "set variable unsigned char=1" test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)" test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)"
test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)" test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')" test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"

View File

@ -74,7 +74,7 @@ proc check_set { t l r new add } {
"${prefix}; print incremented l, expecting ${add}" "${prefix}; print incremented l, expecting ${add}"
} }
check_set "charest" "-1 .*" "-2 .*" "4 ..4." "2 ..2." check_set "charest" "-1 .*" "-2 .*" "4 ..004." "2 ..002."
check_set "short" "-1" "-2" "4" "2" check_set "short" "-1" "-2" "4" "2"
check_set "int" "-1" "-2" "4" "2" check_set "int" "-1" "-2" "4" "2"
check_set "long" "-1" "-2" "4" "2" check_set "long" "-1" "-2" "4" "2"
@ -102,7 +102,7 @@ proc up_set { t l r new } {
"${prefix}; print new l, expecting ${new}" "${prefix}; print new l, expecting ${new}"
} }
up_set "charest" "-1 .*" "-2 .*" "4 ..4." up_set "charest" "-1 .*" "-2 .*" "4 ..004."
up_set "short" "-1" "-2" "4" up_set "short" "-1" "-2" "4"
up_set "int" "-1" "-2" "4" up_set "int" "-1" "-2" "4"
up_set "long" "-1" "-2" "4" up_set "long" "-1" "-2" "4"

View File

@ -284,7 +284,7 @@ gdb_expect {
send_gdb "print UC\n" send_gdb "print UC\n"
gdb_expect { gdb_expect {
-re ".\[0-9\]* = 21 '\.25'\.*$gdb_prompt $" { -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" {
pass "print value of UC" pass "print value of UC"
} }
-re ".*$gdb_prompt $" { fail "print value of UC" } -re ".*$gdb_prompt $" { fail "print value of UC" }
@ -557,7 +557,7 @@ gdb_expect {
send_gdb "print rUC\n" send_gdb "print rUC\n"
gdb_expect { gdb_expect {
-re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.25\'.*$gdb_prompt $" { -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" {
pass "print value of rUC" pass "print value of rUC"
} }
-re ".*$gdb_prompt $" { fail "print value of rUC" } -re ".*$gdb_prompt $" { fail "print value of rUC" }

View File

@ -801,7 +801,7 @@ mi_list_varobj_children {struct_declarations.long_array --all-values} {
mi_list_varobj_children {struct_declarations --simple-values} \ mi_list_varobj_children {struct_declarations --simple-values} \
[list \ [list \
{struct_declarations.integer integer 0 int 123} \ {struct_declarations.integer integer 0 int 123} \
{struct_declarations.character character 0 char {0 '\\\\0'}} \ {struct_declarations.character character 0 char {0 '\\\\000'}} \
[list struct_declarations.char_ptr char_ptr 1 "char \\*" "$hex \\\\\"hello\\\\\""] \ [list struct_declarations.char_ptr char_ptr 1 "char \\*" "$hex \\\\\"hello\\\\\""] \
{struct_declarations.long_int long_int 0 "long int" 0} \ {struct_declarations.long_int long_int 0 "long int" 0} \
[list struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*" "$hex"] \ [list struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*" "$hex"] \

View File

@ -259,7 +259,7 @@ mi_gdb_test "-var-set-format weird.integer natural" \
"set format variable weird.integer" "set format variable weird.integer"
mi_gdb_test "-var-set-format weird.character natural" \ mi_gdb_test "-var-set-format weird.character natural" \
"\\^done,format=\"natural\",value=\"0 '\\\\\\\\0'\"" \ "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
"set format variable weird.character" "set format variable weird.character"
mi_gdb_test "-var-set-format weird.char_ptr natural" \ mi_gdb_test "-var-set-format weird.char_ptr natural" \

View File

@ -258,7 +258,7 @@ mi_gdb_test "-var-set-format weird.integer natural" \
"set format variable weird.integer" "set format variable weird.integer"
mi_gdb_test "-var-set-format weird.character natural" \ mi_gdb_test "-var-set-format weird.character natural" \
"\\^done,format=\"natural\",value=\"0 '\\\\\\\\0'\"" \ "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
"set format variable weird.character" "set format variable weird.character"
mi_gdb_test "-var-set-format weird.char_ptr natural" \ mi_gdb_test "-var-set-format weird.char_ptr natural" \