public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hui Zhu <hui_zhu@mentor.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet
Date: Mon, 02 Dec 2013 12:45:00 -0000	[thread overview]
Message-ID: <529C80D2.2080608@mentor.com> (raw)
In-Reply-To: <5298AE7C.6020607@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]

On 11/29/13 23:10, Pedro Alves wrote:
> On 11/28/2013 09:07 AM, Hui Zhu wrote:
>
>> +  if (have_target_target_side_commands)
>
> This can now just be:
>
>    if (!VEC_empty (agent_expr_p, bp_tgt->tcommands))
>
> OK with that change.
>
>> +    {
>> +      warning (_("\
>> +Target doesn't support breakpoints that have target side commands."));
>
> I was doing to suggest making this an error instead, that
> insert_bp_location would print the error string, but that's
> only true for hw breakpoints... insert_bp_location's error
> handling is quite messy.  For instance, if this breakpoint
> is in a a shared library, this will disable the breakpoint,
> even though the cause of the error is clearly not that the
> shared library disappeared (i.e., not a memory error).
>
>> +      return -1;
>> +    }

Updated the patch according to your comments.

And I make a patch for dprintf.exp and mi-dprintf.exp to make test OK on the target that doesn't support "Zx" packets.

The patches were tested and pass regression test on X86_64 and PPC.

Please help me review it.

Thanks,
Hui

2013-12-02  Hui Zhu  <hui@codesourcery.com>

	PR gdb/16101
	* remote.c (remote_insert_breakpoint): If this breakpoint has
	target-side commands but this stub doesn't support Z0 packets,
	throw error.

2013-12-02  Hui Zhu  <hui@codesourcery.com>

	PR gdb/16101
	* gdb.base/dprintf.exp: Add check for the the gdbserver of some
	architecture doesn't support some "Zx" doesn't support some "Zx"
	packets.
	* gdb.mi/mi-dprintf.exp: Ditto.
	* lib/mi-support.exp: Add check for continue get error.

[-- Attachment #2: fix-dprintf-test-v2.txt --]
[-- Type: text/plain, Size: 433 bytes --]

--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8244,6 +8244,12 @@ remote_insert_breakpoint (struct gdbarch
 	}
     }
 
+  /* If this breakpoint has target-side commands but this stub doesn't
+     support Z0 packets, throw error.  */
+  if (!VEC_empty (agent_expr_p, bp_tgt->tcommands))
+    error (_("\
+Target doesn't support breakpoints that have target side commands."));
+
   return memory_insert_breakpoint (gdbarch, bp_tgt);
 }
 

[-- Attachment #3: dprintf-test.txt --]
[-- Type: text/plain, Size: 2033 bytes --]

--- a/gdb/testsuite/gdb.base/dprintf.exp
+++ b/gdb/testsuite/gdb.base/dprintf.exp
@@ -108,6 +108,26 @@ gdb_test_multiple "set dprintf-style age
     }
 }
 
+# Continue with target-side breakpoint commands will get error if GDB
+# work with the gdbserver of some architecture doesn't support some "Zx"
+# packets.
+if $target_can_dprintf {
+    gdb_run_cmd
+
+    gdb_test "" "Breakpoint"
+
+    set msg "continue with target-side breakpoint commands"
+    gdb_test_multiple "continue" $msg {
+	-re "Cannot insert breakpoint $decimal\.\r\n.*\r\n$gdb_prompt $" {
+	    set target_can_dprintf 0
+	    pass "$msg - cannot do"
+	}
+	-re ".*$gdb_prompt $" {
+	    pass "$msg - can do"
+	}
+    }
+}
+
 if $target_can_dprintf {
     gdb_run_cmd
 
@@ -120,7 +140,7 @@ if $target_can_dprintf {
     gdb_test_sequence "info breakpoints" "dprintf info 2" {
 	"\[\r\n\]Num     Type           Disp Enb Address +What"
 	"\[\r\n\]2       breakpoint"
-	"\[\r\n\]\tbreakpoint already hit 2 times"
+	"\[\r\n\]\tbreakpoint already hit 3 times"
 	"\[\r\n\]3       dprintf"
 	"\[\r\n\]\tbreakpoint already hit 2 times"
 	"\[\r\n\]        agent-printf \"At foo entry\\\\n\""
--- a/gdb/testsuite/gdb.mi/mi-dprintf.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp
@@ -139,6 +139,16 @@ gdb_expect {
     }
 }
 
+# Continue with target-side breakpoint commands will get error if GDB
+# work with The gdbserver of some architecture doesn't support some "Zx"
+# packets.
+if $target_can_dprintf {
+    if {[mi_run_cmd] == -1} {
+	pass "continue with target-side breakpoint commands - cannot do"
+	set target_can_dprintf 0
+    }
+}
+
 if $target_can_dprintf {
     mi_run_cmd
 
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -843,6 +843,7 @@ proc mi_run_cmd_full {use_mi_command arg
 	    send_gdb "${run_prefix}continue\n"
 	    gdb_expect 60 {
 		-re "${run_match}\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt" {}
+		-re "\\^error.*\r\n$mi_gdb_prompt" { return -1 }
 		default {}
 	    }
 	    return 0

  reply	other threads:[~2013-12-02 12:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 10:30 Hui Zhu
2013-10-21 15:37 ` Pedro Alves
2013-11-28 10:56   ` Hui Zhu
2013-11-28 17:38     ` Maciej W. Rozycki
2013-11-29  9:41       ` Hui Zhu
2013-11-29 15:27     ` [pushed] Plug target side conditions and commands leaks (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-11-29 16:05     ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2013-12-02 12:45       ` Hui Zhu [this message]
2013-12-02 14:38         ` Pedro Alves
2013-12-03  4:50           ` Hui Zhu
2013-12-03  4:54             ` Hui Zhu
2013-12-06 19:29             ` Pedro Alves
2013-12-08  5:19               ` Hui Zhu
2013-12-08  8:34                 ` Doug Evans
2013-12-08 14:18                   ` Hui Zhu
2013-12-09 19:48                 ` Pedro Alves
2013-12-09 21:07                   ` Doug Evans
2013-12-10 17:34                     ` Pedro Alves
2013-12-10 18:14                       ` [PATCH] Eliminate UNSUPPORTED_ERROR Pedro Alves
2013-12-11 16:33                         ` Doug Evans
2013-12-11 19:17                           ` Pedro Alves
2013-12-12  4:23                             ` Doug Evans
2013-12-12 10:23                               ` Pedro Alves
2013-12-11 16:40                       ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Doug Evans
2013-12-12 10:55                     ` breakpoint.c:insert_bp_location: Constify local. (was: Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet) Pedro Alves
2013-12-12 12:55                     ` [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet Pedro Alves
2014-01-09 18:36                       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=529C80D2.2080608@mentor.com \
    --to=hui_zhu@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).