From mboxrd@z Thu Jan 1 00:00:00 1970 From: Orjan Friberg To: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH] printcmds.exp: escape curly braces in array print pattern match Date: Mon, 02 Oct 2000 06:53:00 -0000 Message-id: <39D892CB.6CBD363E@axis.com> References: <39D45529.7E67D55E@axis.com> <39D4DCBE.18DC@redhat.com> <39D4E6A9.B8402198@cygnus.com> X-SW-Source: 2000-10/msg00004.html Fernando Nasser wrote: > > Michael Snyder wrote: > > > > Orjan Friberg wrote: > > > > > > The following patch fixes a problem with matching output from printing > > > arrays in printcmds.exp. A left curly brace '{' followed by a number > > > must be escaped, to avoid it being interpreted as the beginning of a > > > bound. I escape it with \\. A right curly brace '}' does not seem to > > > have any special meaning unless preceded by '{', but for consistency I > > > escaped those as well (to indicate that it's not part of a bound). > > > However, it does clutter the exp-file, so it might not be the best way > > > to do it. I'm awaiting comments before submitting the corresponding > > > patch for setvar.exp. > > > > Verified that it does not cause any additional fails on Solaris. > > I would recommend accepting the patch (though I don't know if > > there is a preferable way of doing it). > > > > Stan? Fernando? > > > > Writing a little wrapper proc will do the trick, i.e. let the test pattern clear > and yet fixing the matching problem. > > proc gdb_test_escape_braces {pattern args} { > > > } Here is a revised patch that I believe follows Fernando's suggestion. It may not be optimal, being my first attempt at TCL scripting. Only left curly braces followed by a number are escaped this time. I tried using gdb_test_exact which calls string_to_regexp, but that does not work since string_to_regexp does not escape braces. I will make a corresponding patch for setvar.exp if this patch is accepted. 2000-10-01 Orjan Friberg * gdb.base/printcmds.exp: Escape curly braces followed by a number in array print pattern match. *** /home/orjanf/gdb-5.0-latest/src/gdb/testsuite/gdb.base/printcmds.exp Tue Mar 14 18:01:05 2000 --- printcmds.exp Mon Oct 2 15:31:21 2000 *************** proc test_print_int_arrays {} { *** 542,554 **** gdb_test "set print elements 24" "" ! gdb_test "p int1dim" \ " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" ! gdb_test "p int2dim" \ " = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}" ! gdb_test "p int3dim" \ " = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}" ! gdb_test "p int4dim" \ " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}" } --- 542,554 ---- gdb_test "set print elements 24" "" ! gdb_test_escape_braces "p int1dim" \ " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" ! gdb_test_escape_braces "p int2dim" \ " = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}" ! gdb_test_escape_braces "p int3dim" \ " = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}" ! gdb_test_escape_braces "p int4dim" \ " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}" } *************** proc test_print_typedef_arrays {} { *** 557,563 **** gdb_test "set print elements 24" "" ! gdb_test "p a1" \ " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}" gdb_test "p a1\[0\]" " = 2" gdb_test "p a1\[9\]" " = 20" --- 557,563 ---- gdb_test "set print elements 24" "" ! gdb_test_escape_braces "p a1" \ " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}" gdb_test "p a1\[0\]" " = 2" gdb_test "p a1\[9\]" " = 20" *************** proc test_print_typedef_arrays {} { *** 570,580 **** proc test_artificial_arrays {} { # Send \026@ instead of just @ in case the kill character is @. ! gdb_test "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2} ! gdb_test "p int1dim\[0\]\026@2\026@3" \ "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \ {p int1dim[0]@2@3} ! gdb_test {p/x (short [])0x12345678} \ " = ({0x1234, 0x5678}|{0x5678, 0x1234})" } --- 570,580 ---- proc test_artificial_arrays {} { # Send \026@ instead of just @ in case the kill character is @. ! gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2} ! gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \ "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \ {p int1dim[0]@2@3} ! gdb_test_escape_braces {p/x (short [])0x12345678} \ " = ({0x1234, 0x5678}|{0x5678, 0x1234})" } *************** proc test_print_array_constants {} { *** 655,665 **** setup_xfail "a29k-*-udi" 2416 gdb_test "print {'a','b','c'}" " = \"abc\"" setup_xfail "a29k-*-udi" 2416 ! gdb_test "print {0,1,2}" " = {0, 1, 2}" setup_xfail "a29k-*-udi" 2416 ! gdb_test "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}" setup_xfail "a29k-*-udi" 2416 ! gdb_test "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}" setup_xfail "a29k-*-udi" 2416 gdb_test "print {4,5,6}\[2\]" " = 6" setup_xfail "a29k-*-udi" 2416 --- 655,665 ---- setup_xfail "a29k-*-udi" 2416 gdb_test "print {'a','b','c'}" " = \"abc\"" setup_xfail "a29k-*-udi" 2416 ! gdb_test_escape_braces "print {0,1,2}" " = {0, 1, 2}" setup_xfail "a29k-*-udi" 2416 ! gdb_test_escape_braces "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}" setup_xfail "a29k-*-udi" 2416 ! gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5 }}" setup_xfail "a29k-*-udi" 2416 gdb_test "print {4,5,6}\[2\]" " = 6" setup_xfail "a29k-*-udi" 2416 *************** proc test_printf {} { *** 678,683 **** --- 678,692 ---- gdb_test "printf \"x=%d,y=%f,z=%d\\n\", 5, 6.0, 7" "x=5,y=6\.0+,z=7" gdb_test "printf \"%x %f, %c %x, %x, %f\\n\", 0xbad, -99.541, 'z',\ 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, deadbeef, 5.0+" + } + + # Escape a left curly brace to prevent it from being interpreted as + # the beginning of a bound + proc gdb_test_escape_braces { args } { + + set pattern [lindex $args 1] + regsub -all {\{[0-9]} $pattern {\\&} esc_pattern + gdb_test [lindex $args 0] $esc_pattern [lindex $args 2] } # Start with a fresh gdb. -- Orjan Friberg E-mail: orjan.friberg@axis.com Axis Communications AB Phone: +46 46 272 17 68 >From Peter.Schauer@regent.e-technik.tu-muenchen.de Mon Oct 02 07:00:00 2000 From: "Peter.Schauer" To: gdb-patches@sourceware.cygnus.com Subject: [RFA] target.*: Handle SIGRTMAX for IRIX 6. Date: Mon, 02 Oct 2000 07:00:00 -0000 Message-id: <200010021400.QAA02164@reisser.regent.e-technik.tu-muenchen.de> X-SW-Source: 2000-10/msg00005.html Content-length: 1856 Oh well. Unfortunately IRIX 6 has a SIGRTMAX with signal number 64. The following kludge lets GDB handle this signal as well. I am not sure if we shouldn't reserve a new contiguous block of realtime signals for future targets though. * target.h (TARGET_SIGNAL_REALTIME_64): Added for IRIX 6. * target.c (target_signal_from_host, do_target_signal_to_host): Handle TARGET_SIGNAL_REALTIME_64. *** ./target.c.orig Fri Sep 29 14:54:01 2000 --- ./target.c Fri Sep 29 17:53:35 2000 *************** *** 1423,1428 **** --- 1423,1429 ---- {"SIG63", "Real-time event 63"}, {"SIGCANCEL", "LWP internal signal"}, {"SIG32", "Real-time event 32"}, + {"SIG64", "Real-time event 64"}, #if defined(MACH) || defined(__MACH__) /* Mach exceptions */ *************** *** 1737,1742 **** --- 1738,1745 ---- if (33 <= hostsig && hostsig <= 63) return (enum target_signal) (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33); + else if (hostsig == 64) + return TARGET_SIGNAL_REALTIME_64; else error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal"); } *************** *** 2008,2013 **** --- 2011,2018 ---- if (retsig >= SIGRTMIN && retsig <= SIGRTMAX) return retsig; } + else if (oursig == TARGET_SIGNAL_REALTIME_64) + return 64; #endif *oursig_ok = 0; return 0; *** ./target.h.orig Fri Sep 29 14:54:01 2000 --- ./target.h Mon Oct 2 15:50:57 2000 *************** *** 239,244 **** --- 239,246 ---- of the protocol. Note that in some GDB's TARGET_SIGNAL_REALTIME_32 is number 76. */ TARGET_SIGNAL_REALTIME_32, + /* Yet another pain, IRIX 6 has SIG64. */ + TARGET_SIGNAL_REALTIME_64, #if defined(MACH) || defined(__MACH__) /* Mach exceptions */ -- Peter Schauer pes@regent.e-technik.tu-muenchen.de >From fnasser@cygnus.com Mon Oct 02 07:13:00 2000 From: Fernando Nasser To: Orjan Friberg Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH] printcmds.exp: escape curly braces in array print pattern match Date: Mon, 02 Oct 2000 07:13:00 -0000 Message-id: <39D897F7.C726D71D@cygnus.com> References: <39D45529.7E67D55E@axis.com> <39D4DCBE.18DC@redhat.com> <39D4E6A9.B8402198@cygnus.com> <39D892CB.6CBD363E@axis.com> X-SW-Source: 2000-10/msg00006.html Content-length: 6910 Thank you Orjan, this looks really good. I will give it a spin this afternoon and if it works on my setup as well I will check it in. Fernando Orjan Friberg wrote: > > Fernando Nasser wrote: > > > > Michael Snyder wrote: > > > > > > Orjan Friberg wrote: > > > > > > > > The following patch fixes a problem with matching output from printing > > > > arrays in printcmds.exp. A left curly brace '{' followed by a number > > > > must be escaped, to avoid it being interpreted as the beginning of a > > > > bound. I escape it with \\. A right curly brace '}' does not seem to > > > > have any special meaning unless preceded by '{', but for consistency I > > > > escaped those as well (to indicate that it's not part of a bound). > > > > However, it does clutter the exp-file, so it might not be the best way > > > > to do it. I'm awaiting comments before submitting the corresponding > > > > patch for setvar.exp. > > > > > > Verified that it does not cause any additional fails on Solaris. > > > I would recommend accepting the patch (though I don't know if > > > there is a preferable way of doing it). > > > > > > Stan? Fernando? > > > > > > > Writing a little wrapper proc will do the trick, i.e. let the test pattern clear > > and yet fixing the matching problem. > > > > proc gdb_test_escape_braces {pattern args} { > > > > > > } > > Here is a revised patch that I believe follows Fernando's suggestion. It > may not be optimal, being my first attempt at TCL scripting. Only left > curly braces followed by a number are escaped this time. I tried using > gdb_test_exact which calls string_to_regexp, but that does not work > since string_to_regexp does not escape braces. I will make a > corresponding patch for setvar.exp if this patch is accepted. > > 2000-10-01 Orjan Friberg > > * gdb.base/printcmds.exp: Escape curly braces followed by a number > in array print pattern match. > > *** > /home/orjanf/gdb-5.0-latest/src/gdb/testsuite/gdb.base/printcmds.exp > Tue Mar 14 18:01:05 2000 > --- printcmds.exp Mon Oct 2 15:31:21 2000 > *************** proc test_print_int_arrays {} { > *** 542,554 **** > > gdb_test "set print elements 24" "" > > ! gdb_test "p int1dim" \ > " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" > ! gdb_test "p int2dim" \ > " = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}" > ! gdb_test "p int3dim" \ > " = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}" > ! gdb_test "p int4dim" \ > " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}" > } > > --- 542,554 ---- > > gdb_test "set print elements 24" "" > > ! gdb_test_escape_braces "p int1dim" \ > " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}" > ! gdb_test_escape_braces "p int2dim" \ > " = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}" > ! gdb_test_escape_braces "p int3dim" \ > " = {{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}" > ! gdb_test_escape_braces "p int4dim" \ > " = {{{{0, 1}, {2, 3}, {4, 5}}, {{6, 7}, {8, 9}, {10, 11}}}}" > } > > *************** proc test_print_typedef_arrays {} { > *** 557,563 **** > > gdb_test "set print elements 24" "" > > ! gdb_test "p a1" \ > " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}" > gdb_test "p a1\[0\]" " = 2" > gdb_test "p a1\[9\]" " = 20" > --- 557,563 ---- > > gdb_test "set print elements 24" "" > > ! gdb_test_escape_braces "p a1" \ > " = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}" > gdb_test "p a1\[0\]" " = 2" > gdb_test "p a1\[9\]" " = 20" > *************** proc test_print_typedef_arrays {} { > *** 570,580 **** > > proc test_artificial_arrays {} { > # Send \026@ instead of just @ in case the kill character is @. > ! gdb_test "p int1dim\[0\]\026@2" " = {0, 1}" {p int1dim[0]@2} > ! gdb_test "p int1dim\[0\]\026@2\026@3" \ > "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \ > {p int1dim[0]@2@3} > ! gdb_test {p/x (short [])0x12345678} \ > " = ({0x1234, 0x5678}|{0x5678, 0x1234})" > } > > --- 570,580 ---- > > proc test_artificial_arrays {} { > # Send \026@ instead of just @ in case the kill character is @. > ! gdb_test_escape_braces "p int1dim\[0\]\026@2" " = {0, 1}" {p > int1dim[0]@2} > ! gdb_test_escape_braces "p int1dim\[0\]\026@2\026@3" \ > "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \ > {p int1dim[0]@2@3} > ! gdb_test_escape_braces {p/x (short [])0x12345678} \ > " = ({0x1234, 0x5678}|{0x5678, 0x1234})" > } > > *************** proc test_print_array_constants {} { > *** 655,665 **** > setup_xfail "a29k-*-udi" 2416 > gdb_test "print {'a','b','c'}" " = \"abc\"" > setup_xfail "a29k-*-udi" 2416 > ! gdb_test "print {0,1,2}" " = {0, 1, 2}" > setup_xfail "a29k-*-udi" 2416 > ! gdb_test "print {(long)0,(long)1,(long)2}" " = {0, 1, 2}" > setup_xfail "a29k-*-udi" 2416 > ! gdb_test "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, {3, 4, 5}}" > setup_xfail "a29k-*-udi" 2416 > gdb_test "print {4,5,6}\[2\]" " = 6" > setup_xfail "a29k-*-udi" 2416 > --- 655,665 ---- > setup_xfail "a29k-*-udi" 2416 > gdb_test "print {'a','b','c'}" " = \"abc\"" > setup_xfail "a29k-*-udi" 2416 > ! gdb_test_escape_braces "print {0,1,2}" " = {0, 1, 2}" > setup_xfail "a29k-*-udi" 2416 > ! gdb_test_escape_braces "print {(long)0,(long)1,(long)2}" " = {0, > 1, 2}" > setup_xfail "a29k-*-udi" 2416 > ! gdb_test_escape_braces "print {{0,1,2},{3,4,5}}" " = {{0, 1, 2}, > {3, 4, 5 > }}" > setup_xfail "a29k-*-udi" 2416 > gdb_test "print {4,5,6}\[2\]" " = 6" > setup_xfail "a29k-*-udi" 2416 > *************** proc test_printf {} { > *** 678,683 **** > --- 678,692 ---- > gdb_test "printf \"x=%d,y=%f,z=%d\\n\", 5, 6.0, 7" > "x=5,y=6\.0+,z=7" > gdb_test "printf \"%x %f, %c %x, %x, %f\\n\", 0xbad, -99.541, > 'z',\ > 0xfeedface, 0xdeadbeef, 5.0" "bad -99.54\[0-9\]+, z feedface, > deadbeef, 5.0+" > + } > + > + # Escape a left curly brace to prevent it from being interpreted as > + # the beginning of a bound > + proc gdb_test_escape_braces { args } { > + > + set pattern [lindex $args 1] > + regsub -all {\{[0-9]} $pattern {\\&} esc_pattern > + gdb_test [lindex $args 0] $esc_pattern [lindex $args 2] > } > > # Start with a fresh gdb. > > -- > Orjan Friberg E-mail: orjan.friberg@axis.com > Axis Communications AB Phone: +46 46 272 17 68 -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@cygnus.com 2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311 Toronto, Ontario M4P 2C9 Fax: 416-482-6299 >From kevinb@cygnus.com Mon Oct 02 09:50:00 2000 From: Kevin Buettner To: gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize remote-adapt.c, remote-array.c Date: Mon, 02 Oct 2000 09:50:00 -0000 Message-id: <1001002010445.ZM5551@ocotillo.lan> References: <1000930030529.ZM30081@ocotillo.lan> X-SW-Source: 2000-10/msg00007.html Content-length: 206 On Sep 29, 8:05pm, Kevin Buettner wrote: > * remote-adapt.c (adapt_insert_breakpoint, adapt_remove_breakpoint): > Protoize. > * remote-array.c (write_monitor, array_xfer_memory): Protoize. Committed. >From kevinb@cygnus.com Mon Oct 02 09:51:00 2000 From: Kevin Buettner To: gdb-patches@sourceware.cygnus.com Subject: [PATCH RFC] Protoize remote-bug.c, remote-e7000.c Date: Mon, 02 Oct 2000 09:51:00 -0000 Message-id: <1001002010411.ZM5545@ocotillo.lan> X-SW-Source: 2000-10/msg00008.html Content-length: 3239 More protoization... * remote-bug.c (bug_xfer_memory, bug_insert_breakpoint, bug_remove_breakpoint): Protoize. * remote-e7000.c (fetch_regs_from_dump, e7000_xfer_inferior_memory): Protoize. Index: remote-bug.c =================================================================== RCS file: /cvs/src/src/gdb/remote-bug.c,v retrieving revision 1.6 diff -u -r1.6 remote-bug.c --- remote-bug.c 2000/08/18 22:52:22 1.6 +++ remote-bug.c 2000/10/02 00:58:57 @@ -553,13 +553,15 @@ return; } +/* Transfer LEN bytes between GDB address MYADDR and target address + MEMADDR. If WRITE is non-zero, transfer them to the target, + otherwise transfer them from the target. TARGET is unused. + + Returns the number of bytes transferred. */ + int -bug_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ +bug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, + struct target_ops *target) { if (len <= 0) return 0; @@ -823,10 +825,14 @@ #define MAX_BREAKS 16 static int num_brkpts = 0; + +/* Insert a breakpoint at ADDR. SAVE is normally the address of the + pattern buffer where the instruction that the breakpoint overwrites + is saved. It is unused here since the bug is responsible for + saving/restoring the original instruction. */ + static int -bug_insert_breakpoint (addr, save) - CORE_ADDR addr; - char *save; /* Throw away, let bug save instructions */ +bug_insert_breakpoint (CORE_ADDR addr, char *save) { sr_check_open (); @@ -848,10 +854,13 @@ } } + +/* Remove a breakpoint at ADDR. SAVE is normally the previously + saved pattern, but is unused here since the bug is responsible + for saving/restoring instructions. */ + static int -bug_remove_breakpoint (addr, save) - CORE_ADDR addr; - char *save; /* Throw away, let bug save instructions */ +bug_remove_breakpoint (CORE_ADDR addr, char *save) { if (num_brkpts > 0) { Index: remote-e7000.c =================================================================== RCS file: /cvs/src/src/gdb/remote-e7000.c,v retrieving revision 1.8 diff -u -r1.8 remote-e7000.c --- remote-e7000.c 2000/09/01 00:12:10 1.8 +++ remote-e7000.c 2000/10/02 00:58:59 @@ -795,9 +795,7 @@ } void -fetch_regs_from_dump (nextchar, want) - int (*nextchar) (); - char *want; +fetch_regs_from_dump (int (*nextchar) (), char *want) { int regno; char buf[MAX_REGISTER_RAW_SIZE]; @@ -1468,13 +1466,15 @@ #endif +/* Transfer LEN bytes between GDB address MYADDR and target address + MEMADDR. If WRITE is non-zero, transfer them to the target, + otherwise transfer them from the target. TARGET is unused. + + Returns the number of bytes transferred. */ + static int -e7000_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - unsigned char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ +e7000_xfer_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, + int len, int write, struct target_ops *target) { if (write) return e7000_write_inferior_memory (memaddr, myaddr, len);