* [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes @ 2013-07-02 13:31 Hui Zhu 2013-07-02 14:44 ` Yao Qi 0 siblings, 1 reply; 13+ messages in thread From: Hui Zhu @ 2013-07-02 13:31 UTC (permalink / raw) To: gdb-patches ml Hi, I found this issue because mi_argv_to_format doesn't handle double quotes. So I make a patch to add it. Thanks, Hui 2013-07-02 Hui Zhu <hui@codesourcery.com> PR gdb/15692 mi/mi-cmd-break.c (mi_argv_to_format): Handle double quotes. --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -128,6 +128,9 @@ mi_argv_to_format (char **argv, int argc case '\v': obstack_grow (&obstack, "\\v", 2); break; + case '"': + obstack_grow (&obstack, "\\\"", 2); + break; default: if (isprint (argv[0][i])) obstack_grow (&obstack, argv[0] + i, 1); ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-02 13:31 [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes Hui Zhu @ 2013-07-02 14:44 ` Yao Qi 2013-07-03 8:42 ` Hui Zhu 0 siblings, 1 reply; 13+ messages in thread From: Yao Qi @ 2013-07-02 14:44 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches ml On 07/02/2013 09:30 PM, Hui Zhu wrote: > --- a/gdb/mi/mi-cmd-break.c > +++ b/gdb/mi/mi-cmd-break.c > @@ -128,6 +128,9 @@ mi_argv_to_format (char **argv, int argc > case '\v': > obstack_grow (&obstack, "\\v", 2); > break; > + case '"': > + obstack_grow (&obstack, "\\\"", 2); > + break; > default: > if (isprint (argv[0][i])) > obstack_grow (&obstack, argv[0] + i, 1); IWBN to add a test case to show that GDB handles double quotes correctly after this fix. -- Yao (é½å°§) ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-02 14:44 ` Yao Qi @ 2013-07-03 8:42 ` Hui Zhu 2013-07-03 10:55 ` Yao Qi 0 siblings, 1 reply; 13+ messages in thread From: Hui Zhu @ 2013-07-03 8:42 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches ml [-- Attachment #1: Type: text/plain, Size: 1013 bytes --] On Tue, Jul 2, 2013 at 10:44 PM, Yao Qi <yao@codesourcery.com> wrote: > On 07/02/2013 09:30 PM, Hui Zhu wrote: >> >> --- a/gdb/mi/mi-cmd-break.c >> +++ b/gdb/mi/mi-cmd-break.c >> @@ -128,6 +128,9 @@ mi_argv_to_format (char **argv, int argc >> case '\v': >> obstack_grow (&obstack, "\\v", 2); >> break; >> + case '"': >> + obstack_grow (&obstack, "\\\"", 2); >> + break; >> default: >> if (isprint (argv[0][i])) >> obstack_grow (&obstack, argv[0] + i, 1); > > > IWBN to add a test case to show that GDB handles double quotes correctly > after this fix. Hi Yao, Thanks for your remind. Post a new patch about test this issue. Best, Hui > > -- > Yao (齐尧) 2013-07-03 Hui Zhu <hui@codesourcery.com> PR gdb/15692 mi/mi-cmd-break.c (mi_argv_to_format): Handle double quotes. 2013-07-03 Hui Zhu <hui@codesourcery.com> PR gdb/15692 gdb.mi/mi-dprintf.exp: Add double quotes test. [-- Attachment #2: dprintf-mi-handle-quotes.txt --] [-- Type: text/plain, Size: 331 bytes --] --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -128,6 +128,9 @@ mi_argv_to_format (char **argv, int argc case '\v': obstack_grow (&obstack, "\\v", 2); break; + case '"': + obstack_grow (&obstack, "\\\"", 2); + break; default: if (isprint (argv[0][i])) obstack_grow (&obstack, argv[0] + i, 1); [-- Attachment #3: dprintf-mi-handle-quotes-test.txt --] [-- Type: text/plain, Size: 1211 bytes --] --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -48,7 +48,7 @@ mi_gdb_test "3-dprintf-insert 29" \ mi_gdb_test "-break-insert main" ".*" "mi insert breakpoint main" mi_delete_breakpoints -mi_gdb_test "4-dprintf-insert foo \"At foo entry\\n\"" \ +mi_gdb_test "4-dprintf-insert foo \"\\\"foobarbazqux\\\" At foo entry\\n\"" \ "4\\^done,bkpt=\{number=\".*\",type=\"dprintf\".*func=\"foo\",file=\".*mi-dprintf.c\",fullname=\".*mi-dprintf.c\",line=\".*\".*" "mi insert dprintf foo" mi_gdb_test "5-dprintf-insert $dp_location1 \"arg=%d, g=%d\\n\" arg g" \ @@ -68,7 +68,7 @@ proc mi_continue_dprintf {args} { mi_run_cmd set msg "mi 1st dprintf" gdb_expect { - -re ".*At foo entry.*arg=1234, g=1234" { + -re ".*foobarbazqux.*At foo entry.*arg=1234, g=1234" { pass $msg } -re ".*$mi_gdb_prompt$" { @@ -83,7 +83,7 @@ proc mi_continue_dprintf {args} { set msg "mi 2nd dprintf" mi_send_resuming_command "exec-continue" "$msg continue" gdb_expect { - -re ".*At foo entry.*arg=1235, g=2222" { + -re ".*foobarbazqux.*At foo entry.*arg=1235, g=2222" { pass $msg } -re ".*$mi_gdb_prompt$" { ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-03 8:42 ` Hui Zhu @ 2013-07-03 10:55 ` Yao Qi 2013-07-03 12:03 ` Hui Zhu 0 siblings, 1 reply; 13+ messages in thread From: Yao Qi @ 2013-07-03 10:55 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches ml On 07/03/2013 04:41 PM, Hui Zhu wrote: > @@ -68,7 +68,7 @@ proc mi_continue_dprintf {args} { > mi_run_cmd > set msg "mi 1st dprintf" > gdb_expect { > - -re ".*At foo entry.*arg=1234, g=1234" { > + -re ".*foobarbazqux.*At foo entry.*arg=1234, g=1234" { It is good if we match double quotes before and after foobarbazqux, and get rid of ".*" between "foobarbazqux" and "At foo entry", in order to get the test more restrictive. Something like ".*\\\\\"foobarbazqux\\\\\" At foo entry.*arg=1234, g=1234" I have no other comments then. -- Yao (é½å°§) ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-03 10:55 ` Yao Qi @ 2013-07-03 12:03 ` Hui Zhu 2013-07-03 13:09 ` Yao Qi 0 siblings, 1 reply; 13+ messages in thread From: Hui Zhu @ 2013-07-03 12:03 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches ml [-- Attachment #1: Type: text/plain, Size: 1009 bytes --] On Wed, Jul 3, 2013 at 6:55 PM, Yao Qi <yao@codesourcery.com> wrote: > On 07/03/2013 04:41 PM, Hui Zhu wrote: >> >> @@ -68,7 +68,7 @@ proc mi_continue_dprintf {args} { >> mi_run_cmd >> set msg "mi 1st dprintf" >> gdb_expect { >> - -re ".*At foo entry.*arg=1234, g=1234" { >> + -re ".*foobarbazqux.*At foo entry.*arg=1234, g=1234" { > > > It is good if we match double quotes before and after foobarbazqux, and get > rid of ".*" between "foobarbazqux" and "At foo entry", in order to get the > test more restrictive. Something like > > ".*\\\\\"foobarbazqux\\\\\" At foo entry.*arg=1234, g=1234" > > I have no other comments then. Update test patch for it. Thanks, Hui > > -- > Yao (齐尧) 2013-07-03 Hui Zhu <hui@codesourcery.com> PR gdb/15692 mi/mi-cmd-break.c (mi_argv_to_format): Handle double quotes. 2013-07-03 Hui Zhu <hui@codesourcery.com> PR gdb/15692 gdb.mi/mi-dprintf.exp: Add double quotes test. [-- Attachment #2: dprintf-mi-handle-quotes.txt --] [-- Type: text/plain, Size: 331 bytes --] --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -128,6 +128,9 @@ mi_argv_to_format (char **argv, int argc case '\v': obstack_grow (&obstack, "\\v", 2); break; + case '"': + obstack_grow (&obstack, "\\\"", 2); + break; default: if (isprint (argv[0][i])) obstack_grow (&obstack, argv[0] + i, 1); [-- Attachment #3: dprintf-mi-handle-quotes-test.txt --] [-- Type: text/plain, Size: 1424 bytes --] --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -48,7 +48,7 @@ mi_gdb_test "3-dprintf-insert 29" \ mi_gdb_test "-break-insert main" ".*" "mi insert breakpoint main" mi_delete_breakpoints -mi_gdb_test "4-dprintf-insert foo \"At foo entry\\n\"" \ +mi_gdb_test "4-dprintf-insert foo \"\\\"foobarbazqux\\\" At foo entry\\n\"" \ "4\\^done,bkpt=\{number=\".*\",type=\"dprintf\".*func=\"foo\",file=\".*mi-dprintf.c\",fullname=\".*mi-dprintf.c\",line=\".*\".*" "mi insert dprintf foo" mi_gdb_test "5-dprintf-insert $dp_location1 \"arg=%d, g=%d\\n\" arg g" \ @@ -65,10 +65,16 @@ proc mi_continue_dprintf {args} { with_test_prefix $args { global mi_gdb_prompt + if { $args == "call" || $args == "fprintf" } { + set foobarbazqux "foobarbazqux.*" + } else { + set foobarbazqux "\\\\\"foobarbazqux\\\\\"" + } + mi_run_cmd set msg "mi 1st dprintf" gdb_expect { - -re ".*At foo entry.*arg=1234, g=1234" { + -re ".*$foobarbazqux At foo entry.*arg=1234, g=1234" { pass $msg } -re ".*$mi_gdb_prompt$" { @@ -83,7 +89,7 @@ proc mi_continue_dprintf {args} { set msg "mi 2nd dprintf" mi_send_resuming_command "exec-continue" "$msg continue" gdb_expect { - -re ".*At foo entry.*arg=1235, g=2222" { + -re ".*$foobarbazqux At foo entry.*arg=1235, g=2222" { pass $msg } -re ".*$mi_gdb_prompt$" { ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-03 12:03 ` Hui Zhu @ 2013-07-03 13:09 ` Yao Qi 2013-07-07 5:54 ` Hui Zhu 0 siblings, 1 reply; 13+ messages in thread From: Yao Qi @ 2013-07-03 13:09 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches ml On 07/03/2013 08:02 PM, Hui Zhu wrote: > + if { $args == "call" || $args == "fprintf" } { > + set foobarbazqux "foobarbazqux.*" To match the double quotes, please consider: set foobarbazqux "\"foobarbazqux\"" -- Yao (é½å°§) ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-03 13:09 ` Yao Qi @ 2013-07-07 5:54 ` Hui Zhu 2013-07-10 17:03 ` Tom Tromey 0 siblings, 1 reply; 13+ messages in thread From: Hui Zhu @ 2013-07-07 5:54 UTC (permalink / raw) To: Yao Qi; +Cc: gdb-patches ml [-- Attachment #1: Type: text/plain, Size: 638 bytes --] On Wed, Jul 3, 2013 at 9:09 PM, Yao Qi <yao@codesourcery.com> wrote: > On 07/03/2013 08:02 PM, Hui Zhu wrote: >> >> + if { $args == "call" || $args == "fprintf" } { >> + set foobarbazqux "foobarbazqux.*" > > > To match the double quotes, please consider: > > set foobarbazqux "\"foobarbazqux\"" > > -- > Yao (齐尧) Post a new version about that. Thanks, Hui 2013-07-07 Hui Zhu <hui@codesourcery.com> PR gdb/15692 mi/mi-cmd-break.c (mi_argv_to_format): Handle double quotes. 2013-07-07 Hui Zhu <hui@codesourcery.com> PR gdb/15692 gdb.mi/mi-dprintf.exp: Add double quotes test. [-- Attachment #2: dprintf-mi-handle-quotes.txt --] [-- Type: text/plain, Size: 331 bytes --] --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -128,6 +128,9 @@ mi_argv_to_format (char **argv, int argc case '\v': obstack_grow (&obstack, "\\v", 2); break; + case '"': + obstack_grow (&obstack, "\\\"", 2); + break; default: if (isprint (argv[0][i])) obstack_grow (&obstack, argv[0] + i, 1); [-- Attachment #3: dprintf-mi-handle-quotes-test.txt --] [-- Type: text/plain, Size: 1426 bytes --] --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -48,7 +48,7 @@ mi_gdb_test "3-dprintf-insert 29" \ mi_gdb_test "-break-insert main" ".*" "mi insert breakpoint main" mi_delete_breakpoints -mi_gdb_test "4-dprintf-insert foo \"At foo entry\\n\"" \ +mi_gdb_test "4-dprintf-insert foo \"\\\"foobarbazqux\\\" At foo entry\\n\"" \ "4\\^done,bkpt=\{number=\".*\",type=\"dprintf\".*func=\"foo\",file=\".*mi-dprintf.c\",fullname=\".*mi-dprintf.c\",line=\".*\".*" "mi insert dprintf foo" mi_gdb_test "5-dprintf-insert $dp_location1 \"arg=%d, g=%d\\n\" arg g" \ @@ -65,10 +65,16 @@ proc mi_continue_dprintf {args} { with_test_prefix $args { global mi_gdb_prompt + if { $args == "call" || $args == "fprintf" } { + set foobarbazqux "\"foobarbazqux\"" + } else { + set foobarbazqux "\\\\\"foobarbazqux\\\\\"" + } + mi_run_cmd set msg "mi 1st dprintf" gdb_expect { - -re ".*At foo entry.*arg=1234, g=1234" { + -re ".*$foobarbazqux At foo entry.*arg=1234, g=1234" { pass $msg } -re ".*$mi_gdb_prompt$" { @@ -83,7 +89,7 @@ proc mi_continue_dprintf {args} { set msg "mi 2nd dprintf" mi_send_resuming_command "exec-continue" "$msg continue" gdb_expect { - -re ".*At foo entry.*arg=1235, g=2222" { + -re ".*$foobarbazqux At foo entry.*arg=1235, g=2222" { pass $msg } -re ".*$mi_gdb_prompt$" { ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-07 5:54 ` Hui Zhu @ 2013-07-10 17:03 ` Tom Tromey 2013-07-18 12:58 ` Hui Zhu 0 siblings, 1 reply; 13+ messages in thread From: Tom Tromey @ 2013-07-10 17:03 UTC (permalink / raw) To: Hui Zhu; +Cc: Yao Qi, gdb-patches ml >>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes: Hui> + if { $args == "call" || $args == "fprintf" } { Hui> + set foobarbazqux "\"foobarbazqux\"" Hui> + } else { Hui> + set foobarbazqux "\\\\\"foobarbazqux\\\\\"" Hui> + } Why are different regexps needed for these cases? I thought the output was supposed to be the same in all situations. Other than this issue the patch is ok. Tom ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-10 17:03 ` Tom Tromey @ 2013-07-18 12:58 ` Hui Zhu 2013-07-18 13:42 ` Tom Tromey 0 siblings, 1 reply; 13+ messages in thread From: Hui Zhu @ 2013-07-18 12:58 UTC (permalink / raw) To: Tom Tromey; +Cc: Yao Qi, gdb-patches ml On Thu, Jul 11, 2013 at 1:02 AM, Tom Tromey <tromey@redhat.com> wrote: >>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes: > > Hui> + if { $args == "call" || $args == "fprintf" } { > Hui> + set foobarbazqux "\"foobarbazqux\"" > Hui> + } else { > Hui> + set foobarbazqux "\\\\\"foobarbazqux\\\\\"" > Hui> + } > > Why are different regexps needed for these cases? > I thought the output was supposed to be the same in all situations. With "call" or "fprintf". The dprintf is directly outputted by inferior. So the string is: "foobarbazqux" At foo entry But with others, the dprintf is outputted by GDB. So the string is: ~"\"foobarbazqux\" At foo entry\n" That is why I use different $foobarbazqux. Thanks, Hui > > Other than this issue the patch is ok. > > Tom ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-18 12:58 ` Hui Zhu @ 2013-07-18 13:42 ` Tom Tromey 2013-07-19 7:29 ` Hui Zhu 0 siblings, 1 reply; 13+ messages in thread From: Tom Tromey @ 2013-07-18 13:42 UTC (permalink / raw) To: Hui Zhu; +Cc: Yao Qi, gdb-patches ml >>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes: Hui> With "call" or "fprintf". Hui> The dprintf is directly outputted by inferior. So the string is: Hui> "foobarbazqux" At foo entry Hui> But with others, the dprintf is outputted by GDB. So the string is: Hui> ~"\"foobarbazqux\" At foo entry\n" Hui> That is why I use different $foobarbazqux. Ah, ok, that makes sense. The patch is ok. Tom ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-18 13:42 ` Tom Tromey @ 2013-07-19 7:29 ` Hui Zhu 2013-07-23 19:04 ` Tom Tromey 0 siblings, 1 reply; 13+ messages in thread From: Hui Zhu @ 2013-07-19 7:29 UTC (permalink / raw) To: Tom Tromey; +Cc: Yao Qi, gdb-patches ml On Thu, Jul 18, 2013 at 9:42 PM, Tom Tromey <tromey@redhat.com> wrote: >>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes: > > Hui> With "call" or "fprintf". > Hui> The dprintf is directly outputted by inferior. So the string is: > Hui> "foobarbazqux" At foo entry > > Hui> But with others, the dprintf is outputted by GDB. So the string is: > Hui> ~"\"foobarbazqux\" At foo entry\n" > > Hui> That is why I use different $foobarbazqux. > > Ah, ok, that makes sense. The patch is ok. > > Tom Checked in http://sourceware.org/ml/gdb-cvs/2013-07/msg00090.html Do you think this patch is OK for 7.6 branch? Thanks, Hui ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-19 7:29 ` Hui Zhu @ 2013-07-23 19:04 ` Tom Tromey 2013-07-24 1:56 ` Hui Zhu 0 siblings, 1 reply; 13+ messages in thread From: Tom Tromey @ 2013-07-23 19:04 UTC (permalink / raw) To: Hui Zhu; +Cc: Yao Qi, gdb-patches ml >>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes: Hui> Checked in http://sourceware.org/ml/gdb-cvs/2013-07/msg00090.html Hui> Do you think this patch is OK for 7.6 branch? I think it would be fine. Tom ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes 2013-07-23 19:04 ` Tom Tromey @ 2013-07-24 1:56 ` Hui Zhu 0 siblings, 0 replies; 13+ messages in thread From: Hui Zhu @ 2013-07-24 1:56 UTC (permalink / raw) To: Tom Tromey; +Cc: Yao Qi, gdb-patches ml On Wed, Jul 24, 2013 at 3:04 AM, Tom Tromey <tromey@redhat.com> wrote: >>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes: > > Hui> Checked in http://sourceware.org/ml/gdb-cvs/2013-07/msg00090.html > Hui> Do you think this patch is OK for 7.6 branch? > > I think it would be fine. Oops. I am sorry that I make a mistake. dprintf-insert patches is not committed to 7.6 branch. So this patch is not need for 7.6 branch. Thanks, Hui > > Tom ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-07-24 1:56 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-07-02 13:31 [PATCH] Fix PR 15692 -dprintf-insert does not accept double quotes Hui Zhu 2013-07-02 14:44 ` Yao Qi 2013-07-03 8:42 ` Hui Zhu 2013-07-03 10:55 ` Yao Qi 2013-07-03 12:03 ` Hui Zhu 2013-07-03 13:09 ` Yao Qi 2013-07-07 5:54 ` Hui Zhu 2013-07-10 17:03 ` Tom Tromey 2013-07-18 12:58 ` Hui Zhu 2013-07-18 13:42 ` Tom Tromey 2013-07-19 7:29 ` Hui Zhu 2013-07-23 19:04 ` Tom Tromey 2013-07-24 1:56 ` Hui Zhu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox