This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Let gdbserver doesn't tell GDB it support target-side breakpoint conditions and commands if it doesn't support 'Z' packet


On 12/02/13 22:37, Pedro Alves wrote:
On 12/02/2013 12:45 PM, Hui Zhu wrote:
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.

But you switched to "error" anyway?  Above I was saying that I
was going that suggest it, but then explained why I didn't think
it would work.  Was I wrong?

The reason is insert_bp_location doesn't have code to handle this error.  I make a new patch that include this code.

Please help me review it.



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.

(It's best to stick to one patch per email, otherwise things
end up confusing.  I suggest looking into git send-email.)


OK.  I will post new version of this patch in another mail.

Thanks,
Hui

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

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

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -2588,6 +2588,12 @@ insert_bp_location (struct bp_location *
                   if (hw_bp_err_string)
                     fprintf_unfiltered (tmp_error_stream, "%s.\n", hw_bp_err_string);
 		}
+	      else if (hw_bp_err_string != NULL)
+	        {
+		  fprintf_unfiltered (tmp_error_stream,
+				      "Cannot insert breakpoint %d:%s\n",
+				      bl->owner->number, hw_bp_err_string);
+		}
 	      else
 		{
 		  char *message = memory_error_message (TARGET_XFER_E_IO,
--- 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);
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]