From: Tom Tromey Date: Tue, 7 Jul 2009 21:33:50 +0000 (+0000) Subject: gdb X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=30b66ecc739234c58f8f1aca25a8c068b09f9cc8;p=binutils-gdb.git gdb * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e54fd1336d9..7634ce28a13 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2009-07-07 Tom Tromey + + * 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 * python/python-value.c (valpy_getitem): Remove incorrect assert. diff --git a/gdb/c-exp.y b/gdb/c-exp.y index d0a6332911c..aacc1125774 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1440,14 +1440,19 @@ c_parse_escape (char **ptr, struct obstack *output) case '5': case '6': case '7': - if (output) - obstack_grow_str (output, "\\"); - while (isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9') - { - if (output) - obstack_1grow (output, *tokptr); - ++tokptr; - } + { + int i; + if (output) + obstack_grow_str (output, "\\"); + for (i = 0; + i < 3 && isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9'; + ++i) + { + if (output) + obstack_1grow (output, *tokptr); + ++tokptr; + } + } break; /* We handle UCNs later. We could handle them here, but that diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 55dc042dfee..5cbecd26b5c 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -225,7 +225,12 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len, char octal[30]; ULONGEST value; 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); } /* If we somehow have extra bytes, print them now. */ @@ -770,9 +775,12 @@ emit_numeric_character (struct type *type, unsigned long value, static char * convert_octal (struct type *type, char *p, char *limit, struct obstack *output) { + int i; 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); ++p; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 870afe4ff44..b6a2025b946 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2009-07-07 Tom Tromey + + * 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 * gdb.mi/mi2-var-cmd.exp (floating varobj invalidation): New test. diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index f73dd7f3c03..ff68e20f310 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -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)"] { 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)"] { diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index b17b0ba0fd0..2b5112d17ee 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -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.*" \ "stop at nested call level 4" 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 .*\#4 add \\(a=4, b=5\\).*\#5 .*\#6 add \\(a=2, b=3\\).*\#7 .*\#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 .*\#4 add \\(a=4, b=5\\).*\#5 .*\#6 add \\(a=2, b=3\\).*\#7 .*\#8 main.*" \ "backtrace at nested call level 4" gdb_test "finish" "Value returned is .* = 100" \ "Finish from nested call level 4" diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp index 85885c8e25c..fe1fbb0efdd 100644 --- a/gdb/testsuite/gdb.base/charset.exp +++ b/gdb/testsuite/gdb.base/charset.exp @@ -409,7 +409,7 @@ foreach target_charset $charset_subset { # gdb_test that requires us to use gdb_expect here. send_gdb "print $L'\\0'\n" 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}" } -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 '\\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, # 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 @@ -563,7 +566,7 @@ proc test_wide_or_unicode {L name} { "narrow and $name string concatenation" gdb_test "print \"ab\" $L\"c\"" " = $L\"abc\"" \ "$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" gdb_test "print $L\"\" \"abcdef\" \"g\"" \ "$L\"abcdefg\"" \ diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp index 6d1bd12f171..d53a826fa93 100644 --- a/gdb/testsuite/gdb.base/constvars.exp +++ b/gdb/testsuite/gdb.base/constvars.exp @@ -161,7 +161,7 @@ proc do_constvar_tests {} { gdb_test "print laconic" " = 65 'A'" local_compiler_xfail_check gdb_test "ptype laconic" "type = const char" - gdb_test "print laggard" " = 1 '.1'" + gdb_test "print laggard" " = 1 '.001'" local_compiler_xfail_check gdb_test "ptype laggard" "type = const unsigned char" gdb_test "print lagoon" " = 2" @@ -209,7 +209,7 @@ proc do_constvar_tests {} { gdb_test "print *lewd" " = 65 'A'" local_compiler_xfail_check gdb_test "ptype lewd" "type = const char \\* const" - gdb_test "print *lexicographer" " = 1 '.1'" + gdb_test "print *lexicographer" " = 1 '.001'" local_compiler_xfail_check gdb_test "ptype lexicographer" "type = const unsigned char \\* const" gdb_test "print *lexicon" " = 2" @@ -233,7 +233,7 @@ proc do_constvar_tests {} { gdb_test "print *languish" " = 65 'A'" local_compiler_xfail_check gdb_test "ptype languish" "type = const char \\*" - gdb_test "print *languor" " = 1 '.1'" + gdb_test "print *languor" " = 1 '.001'" local_compiler_xfail_check gdb_test "ptype languor" "type = const unsigned char \\*" gdb_test "print *lank" " = 2" diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index e8159156323..e5e85393f76 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -211,7 +211,7 @@ gdb_test_char "p/o *(char *)c" "01" gdb_test_char "p/t *(char *)c" "1" gdb_test_char "p/a *(char *)c" "0x1( <.*>)?" 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/d *(short *)s" "" "291" "" @@ -258,7 +258,7 @@ gdb_test "x/u w" "19088743" gdb_test "x/o w" "0110642547" gdb_test "x/t w" "00000001001000110100010101100111" 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 } { gdb_test "x/f &val.oct" "-5.9822653797615723e-120" } else { @@ -274,7 +274,7 @@ gdb_test "x/2u g" "81985529216486895.*12046818088235383159" gdb_test "x/2o g" "04432126361152746757.*01234567123456701234567" gdb_test "x/2t g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111" 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 } { gdb_test "x/2f &val.oct" "-5.9822653797615723e-120.*-5.9041889495880968e-100" } else { @@ -289,7 +289,7 @@ gdb_test "x/2bu b" "1.*167" gdb_test "x/2bo b" "01.*0247" gdb_test "x/2bt b" "00000001.*10100111" 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/2hx h" "0x0123.*0xa72e" diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp index 2d0a70e3625..91838a2aea5 100644 --- a/gdb/testsuite/gdb.base/pointers.exp +++ b/gdb/testsuite/gdb.base/pointers.exp @@ -389,7 +389,7 @@ gdb_expect { send_gdb "print *pUC\n" gdb_expect { - -re ".\[0-9\]* = 21 \'.25\'.*$gdb_prompt $" { + -re ".\[0-9\]* = 21 \'.025\'.*$gdb_prompt $" { pass "print value of *pUC" } -re ".*$gdb_prompt $" { fail "print value of *pUC" } diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 65ab3a45c15..0cbcdfa0526 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -136,13 +136,13 @@ proc test_integer_literals_rejected {} { proc test_print_all_chars {} { global gdb_prompt - gdb_test "p ctable1\[0\]" " = 0 '\\\\0'" - gdb_test "p ctable1\[1\]" " = 1 '\\\\1'" - gdb_test "p ctable1\[2\]" " = 2 '\\\\2'" - gdb_test "p ctable1\[3\]" " = 3 '\\\\3'" - gdb_test "p ctable1\[4\]" " = 4 '\\\\4'" - gdb_test "p ctable1\[5\]" " = 5 '\\\\5'" - gdb_test "p ctable1\[6\]" " = 6 '\\\\6'" + gdb_test "p ctable1\[0\]" " = 0 '\\\\000'" + gdb_test "p ctable1\[1\]" " = 1 '\\\\001'" + gdb_test "p ctable1\[2\]" " = 2 '\\\\002'" + gdb_test "p ctable1\[3\]" " = 3 '\\\\003'" + gdb_test "p ctable1\[4\]" " = 4 '\\\\004'" + gdb_test "p ctable1\[5\]" " = 5 '\\\\005'" + gdb_test "p ctable1\[6\]" " = 6 '\\\\006'" gdb_test "p ctable1\[7\]" " = 7 '\\\\a'" gdb_test "p ctable1\[8\]" " = 8 '\\\\b'" 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\[12\]" " = 12 '\\\\f'" gdb_test "p ctable1\[13\]" " = 13 '\\\\r'" - gdb_test "p ctable1\[14\]" " = 14 '\\\\16'" - gdb_test "p ctable1\[15\]" " = 15 '\\\\17'" - gdb_test "p ctable1\[16\]" " = 16 '\\\\20'" - gdb_test "p ctable1\[17\]" " = 17 '\\\\21'" - gdb_test "p ctable1\[18\]" " = 18 '\\\\22'" - gdb_test "p ctable1\[19\]" " = 19 '\\\\23'" - gdb_test "p ctable1\[20\]" " = 20 '\\\\24'" - gdb_test "p ctable1\[21\]" " = 21 '\\\\25'" - gdb_test "p ctable1\[22\]" " = 22 '\\\\26'" - gdb_test "p ctable1\[23\]" " = 23 '\\\\27'" - gdb_test "p ctable1\[24\]" " = 24 '\\\\30'" - gdb_test "p ctable1\[25\]" " = 25 '\\\\31'" - gdb_test "p ctable1\[26\]" " = 26 '\\\\32'" - gdb_test "p ctable1\[27\]" " = 27 '\\\\33'" - gdb_test "p ctable1\[28\]" " = 28 '\\\\34'" - gdb_test "p ctable1\[29\]" " = 29 '\\\\35'" - gdb_test "p ctable1\[30\]" " = 30 '\\\\36'" - gdb_test "p ctable1\[31\]" " = 31 '\\\\37'" + gdb_test "p ctable1\[14\]" " = 14 '\\\\016'" + gdb_test "p ctable1\[15\]" " = 15 '\\\\017'" + gdb_test "p ctable1\[16\]" " = 16 '\\\\020'" + gdb_test "p ctable1\[17\]" " = 17 '\\\\021'" + gdb_test "p ctable1\[18\]" " = 18 '\\\\022'" + gdb_test "p ctable1\[19\]" " = 19 '\\\\023'" + gdb_test "p ctable1\[20\]" " = 20 '\\\\024'" + gdb_test "p ctable1\[21\]" " = 21 '\\\\025'" + gdb_test "p ctable1\[22\]" " = 22 '\\\\026'" + gdb_test "p ctable1\[23\]" " = 23 '\\\\027'" + gdb_test "p ctable1\[24\]" " = 24 '\\\\030'" + gdb_test "p ctable1\[25\]" " = 25 '\\\\031'" + gdb_test "p ctable1\[26\]" " = 26 '\\\\032'" + gdb_test "p ctable1\[27\]" " = 27 '\\\\033'" + gdb_test "p ctable1\[28\]" " = 28 '\\\\034'" + gdb_test "p ctable1\[29\]" " = 29 '\\\\035'" + gdb_test "p ctable1\[30\]" " = 30 '\\\\036'" + gdb_test "p ctable1\[31\]" " = 31 '\\\\037'" gdb_test "p ctable1\[32\]" " = 32 ' '" gdb_test "p ctable1\[33\]" " = 33 '!'" gdb_test "p ctable1\[34\]" " = 34 '\"'" @@ -475,13 +475,13 @@ proc test_print_strings {} { gdb_test "p &ctable1\[0\]" \ " = \\(unsigned char \\*\\) \"\"" 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\]" \ - " = \\(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\]" \ - " = \\(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\]" \ - " = \\(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\]" \ " = \\(unsigned char \\*\\) \" !\\\\\"#\\\$%&'\"..." gdb_test "p &ctable1\[5*8\]" \ @@ -622,7 +622,7 @@ proc test_print_string_constants {} { set timeout 60; 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 sizeof (\"abcdef\")" " = 7" gdb_test "ptype \"foo\"" " = char \\\[4\\\]" diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index 3be8424615a..1783d1a59ad 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -120,8 +120,8 @@ proc test_set { args } { # 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=1" "print v_char" ".\[0-9\]* = 1 \'.1\'" "set variable char=1" +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 \'.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=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')" @@ -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 "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.0\'" "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_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 \'.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=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')" @@ -150,8 +150,8 @@ gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \ # # 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=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.1\'" "set variable unsigned char=1" +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 \'.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=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')" diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp index feab6bd8730..963bb19bfe3 100644 --- a/gdb/testsuite/gdb.base/store.exp +++ b/gdb/testsuite/gdb.base/store.exp @@ -74,7 +74,7 @@ proc check_set { t l r new 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 "int" "-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}" } -up_set "charest" "-1 .*" "-2 .*" "4 ..4." +up_set "charest" "-1 .*" "-2 .*" "4 ..004." up_set "short" "-1" "-2" "4" up_set "int" "-1" "-2" "4" up_set "long" "-1" "-2" "4" diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp index b2e55cf51d3..4784cb25d4d 100644 --- a/gdb/testsuite/gdb.cp/ref-types.exp +++ b/gdb/testsuite/gdb.cp/ref-types.exp @@ -284,7 +284,7 @@ gdb_expect { send_gdb "print UC\n" gdb_expect { - -re ".\[0-9\]* = 21 '\.25'\.*$gdb_prompt $" { + -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" { pass "print value of UC" } -re ".*$gdb_prompt $" { fail "print value of UC" } @@ -557,7 +557,7 @@ gdb_expect { send_gdb "print rUC\n" 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" } -re ".*$gdb_prompt $" { fail "print value of rUC" } diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 6299e3c2fbc..1f4bdc699a2 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -801,7 +801,7 @@ mi_list_varobj_children {struct_declarations.long_array --all-values} { mi_list_varobj_children {struct_declarations --simple-values} \ [list \ {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\\\\\""] \ {struct_declarations.long_int long_int 0 "long int" 0} \ [list struct_declarations.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*" "$hex"] \ diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index 59be6b283b0..4b02e50fd65 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -259,7 +259,7 @@ mi_gdb_test "-var-set-format weird.integer natural" \ "set format variable weird.integer" 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" mi_gdb_test "-var-set-format weird.char_ptr natural" \ diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp index 9c98694e135..d6ce6734e5b 100644 --- a/gdb/testsuite/gdb.mi/mi2-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp @@ -258,7 +258,7 @@ mi_gdb_test "-var-set-format weird.integer natural" \ "set format variable weird.integer" 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" mi_gdb_test "-var-set-format weird.char_ptr natural" \