PATCH: tweak character printing
Jim Blandy
jimb@zwingli.cygnus.com
Tue Dec 18 22:37:00 GMT 2001
Obvious fix?
gdb/ChangeLog:
2001-12-19 Jim Blandy <jimb@redhat.com>
* c-lang.c (c_emit_char): Print ASCII 11 as '\v', to match
ISO C, and our parser. Print ASCII 0 as '\0', since that's what
people are used to seeing.
gdb/testsuite/ChangeLog:
2001-12-19 Jim Blandy <jimb@redhat.com>
* gdb.base/printcmds.exp: Expect the null character to be printed
as '\0', and the '\013' to be printed as '\v'.
* gdb.base/callfuncs.exp ("backtrace at nested call level 4"): Same.
* gdb.base/setvar.exp: Same.
Index: gdb/c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.8
diff -c -r1.8 c-lang.c
*** gdb/c-lang.c 2001/12/19 03:07:08 1.8
--- gdb/c-lang.c 2001/12/19 06:24:31
***************
*** 67,78 ****
--- 67,84 ----
case '\r':
fputs_filtered ("\\r", stream);
break;
+ case '\013':
+ fputs_filtered ("\\v", stream);
+ break;
case '\033':
fputs_filtered ("\\e", stream);
break;
case '\007':
fputs_filtered ("\\a", stream);
break;
+ case '\0':
+ fputs_filtered ("\\0", stream);
+ break;
default:
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
break;
Index: gdb/testsuite/gdb.base/callfuncs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.exp,v
retrieving revision 1.7
diff -c -r1.7 callfuncs.exp
*** gdb/testsuite/gdb.base/callfuncs.exp 2001/12/07 21:17:00 1.7
--- gdb/testsuite/gdb.base/callfuncs.exp 2001/12/19 06:24:31
***************
*** 406,412 ****
"The program being debugged stopped while.*" \
"stop at nested call level 4"
gdb_test "backtrace" \
! "\#0 t_small_values \\(arg1=1 '.001', arg2=3, arg3=5, arg4=7 '.a', arg5=9, arg6=11 '.013', 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"
gdb_test "finish" "Value returned is .* = 100" \
"Finish from nested call level 4"
--- 406,412 ----
"The program being debugged stopped while.*" \
"stop at nested call level 4"
gdb_test "backtrace" \
! "\#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"
gdb_test "finish" "Value returned is .* = 100" \
"Finish from nested call level 4"
Index: gdb/testsuite/gdb.base/printcmds.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/printcmds.exp,v
retrieving revision 1.4
diff -c -r1.4 printcmds.exp
*** gdb/testsuite/gdb.base/printcmds.exp 2001/03/06 08:21:51 1.4
--- gdb/testsuite/gdb.base/printcmds.exp 2001/12/19 06:24:31
***************
*** 134,140 ****
proc test_print_all_chars {} {
global gdb_prompt
! 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'"
--- 134,140 ----
proc test_print_all_chars {} {
global gdb_prompt
! gdb_test "p ctable1\[0\]" " = 0 '\\\\0'"
gdb_test "p ctable1\[1\]" " = 1 '\\\\001'"
gdb_test "p ctable1\[2\]" " = 2 '\\\\002'"
gdb_test "p ctable1\[3\]" " = 3 '\\\\003'"
***************
*** 145,151 ****
gdb_test "p ctable1\[8\]" " = 8 '\\\\b'"
gdb_test "p ctable1\[9\]" " = 9 '\\\\t'"
gdb_test "p ctable1\[10\]" " = 10 '\\\\n'"
! gdb_test "p ctable1\[11\]" " = 11 '\\\\013'"
gdb_test "p ctable1\[12\]" " = 12 '\\\\f'"
gdb_test "p ctable1\[13\]" " = 13 '\\\\r'"
gdb_test "p ctable1\[14\]" " = 14 '\\\\016'"
--- 145,151 ----
gdb_test "p ctable1\[8\]" " = 8 '\\\\b'"
gdb_test "p ctable1\[9\]" " = 9 '\\\\t'"
gdb_test "p ctable1\[10\]" " = 10 '\\\\n'"
! 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 '\\\\016'"
***************
*** 475,481 ****
gdb_test "p &ctable1\[1\]" \
" = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
gdb_test "p &ctable1\[1*8\]" \
! " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\013\\\\f\\\\r\\\\016\\\\017\"..."
gdb_test "p &ctable1\[2*8\]" \
" = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
gdb_test "p &ctable1\[3*8\]" \
--- 475,481 ----
gdb_test "p &ctable1\[1\]" \
" = \\(unsigned char \\*\\) \"\\\\001\\\\002\\\\003\\\\004\\\\005\\\\006\\\\a\\\\b\"..."
gdb_test "p &ctable1\[1*8\]" \
! " = \\(unsigned char \\*\\) \"\\\\b\\\\t\\\\n\\\\v\\\\f\\\\r\\\\016\\\\017\"..."
gdb_test "p &ctable1\[2*8\]" \
" = \\(unsigned char \\*\\) \"\\\\020\\\\021\\\\022\\\\023\\\\024\\\\025\\\\026\\\\027\"..."
gdb_test "p &ctable1\[3*8\]" \
***************
*** 622,628 ****
setup_xfail "a29k-*-udi" 2416
gdb_test "p \"a string\"" " = \"a string\""
setup_xfail "a29k-*-udi" 2416
! gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\000 null\""
setup_xfail "a29k-*-udi" 2416
gdb_test "p \"abcd\"\[2\]" " = 99 'c'"
setup_xfail "a29k-*-udi" 2416
--- 622,628 ----
setup_xfail "a29k-*-udi" 2416
gdb_test "p \"a string\"" " = \"a string\""
setup_xfail "a29k-*-udi" 2416
! gdb_test "p \"embedded \\000 null\"" " = \"embedded \\\\0 null\""
setup_xfail "a29k-*-udi" 2416
gdb_test "p \"abcd\"\[2\]" " = 99 'c'"
setup_xfail "a29k-*-udi" 2416
Index: gdb/testsuite/gdb.base/setvar.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/setvar.exp,v
retrieving revision 1.4
diff -c -r1.4 setvar.exp
*** gdb/testsuite/gdb.base/setvar.exp 2001/10/29 16:24:35 1.4
--- gdb/testsuite/gdb.base/setvar.exp 2001/12/19 06:24:32
***************
*** 137,143 ****
# range of values that are common to both (0-127).
#
! 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=27" "print v_char" ".\[0-9\]* = 27 \'.e\'" "set variable char=27 (Esc)"
test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
--- 137,143 ----
# 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 \'.001\'" "set variable char=1"
test_set "set variable v_char=27" "print v_char" ".\[0-9\]* = 27 \'.e\'" "set variable char=27 (Esc)"
test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
***************
*** 148,154 ****
#
# test "set variable" for type "signed char"
#
! 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=27" "print v_signed_char" ".\[0-9\]* = 27 \'.e\'" "set variable signed char=27 (Esc)"
test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
--- 148,154 ----
#
# 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 \'.001\'" "set variable signed char=1"
test_set "set variable v_signed_char=27" "print v_signed_char" ".\[0-9\]* = 27 \'.e\'" "set variable signed char=27 (Esc)"
test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
***************
*** 167,173 ****
#
# test "set variable" for type "unsigned char"
#
! 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=27" "print v_unsigned_char" ".\[0-9\]* = 27 \'.e\'" "set variable unsigned char=27 (Esc)"
test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
--- 167,173 ----
#
# 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 \'.001\'" "set variable unsigned char=1"
test_set "set variable v_unsigned_char=27" "print v_unsigned_char" ".\[0-9\]* = 27 \'.e\'" "set variable unsigned char=27 (Esc)"
test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
More information about the Gdb-patches
mailing list