* gdb/remote.c (remote_insert_hw_breakpoint): Throw exception if
there is an error inserting hardware breakpoints and use the error message from the target. * gdb/breakpoint.c (insert_bp_location, insert_breakpoint_locations): Catch this exception and print the error message contained within. Do not print the default hardware error breakpoint message in this case.
This commit is contained in:
parent
a1b64ce14e
commit
dd61ec5cb3
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2012-09-12 Mike Wrighton <wrighton@codesourcery.com>
|
||||
|
||||
* gdb/remote.c (remote_insert_hw_breakpoint): Throw exception if
|
||||
there is an error inserting hardware breakpoints and use the
|
||||
error message from the target.
|
||||
|
||||
* gdb/breakpoint.c (insert_bp_location, insert_breakpoint_locations):
|
||||
Catch this exception and print the error message contained within. Do not
|
||||
print the default hardware error breakpoint message in this case.
|
||||
|
||||
2012-08-26 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR binutils/4970
|
||||
|
|
|
@ -2375,9 +2375,12 @@ static int
|
|||
insert_bp_location (struct bp_location *bl,
|
||||
struct ui_file *tmp_error_stream,
|
||||
int *disabled_breaks,
|
||||
int *hw_breakpoint_error)
|
||||
int *hw_breakpoint_error,
|
||||
int *hw_bp_error_explained_already)
|
||||
{
|
||||
int val = 0;
|
||||
char *hw_bp_err_string = NULL;
|
||||
struct gdb_exception e;
|
||||
|
||||
if (!should_be_inserted (bl) || (bl->inserted && !bl->needs_update))
|
||||
return 0;
|
||||
|
@ -2474,8 +2477,15 @@ insert_bp_location (struct bp_location *bl,
|
|||
|| !(section_is_overlay (bl->section)))
|
||||
{
|
||||
/* No overlay handling: just set the breakpoint. */
|
||||
|
||||
val = bl->owner->ops->insert_location (bl);
|
||||
TRY_CATCH (e, RETURN_MASK_ALL)
|
||||
{
|
||||
val = bl->owner->ops->insert_location (bl);
|
||||
}
|
||||
if (e.reason < 0)
|
||||
{
|
||||
val = 1;
|
||||
hw_bp_err_string = (char *) e.message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2509,7 +2519,15 @@ insert_bp_location (struct bp_location *bl,
|
|||
if (section_is_mapped (bl->section))
|
||||
{
|
||||
/* Yes. This overlay section is mapped into memory. */
|
||||
val = bl->owner->ops->insert_location (bl);
|
||||
TRY_CATCH (e, RETURN_MASK_ALL)
|
||||
{
|
||||
val = bl->owner->ops->insert_location (bl);
|
||||
}
|
||||
if (e.reason < 0)
|
||||
{
|
||||
val = 1;
|
||||
hw_bp_err_string = (char *) e.message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2545,11 +2563,13 @@ insert_bp_location (struct bp_location *bl,
|
|||
{
|
||||
if (bl->loc_type == bp_loc_hardware_breakpoint)
|
||||
{
|
||||
*hw_breakpoint_error = 1;
|
||||
fprintf_unfiltered (tmp_error_stream,
|
||||
"Cannot insert hardware "
|
||||
"breakpoint %d.\n",
|
||||
bl->owner->number);
|
||||
*hw_breakpoint_error = 1;
|
||||
*hw_bp_error_explained_already = hw_bp_err_string != NULL;
|
||||
fprintf_unfiltered (tmp_error_stream,
|
||||
"Cannot insert hardware breakpoint %d%s",
|
||||
bl->owner->number, hw_bp_err_string ? ":" : ".\n");
|
||||
if (hw_bp_err_string)
|
||||
fprintf_unfiltered (tmp_error_stream, "%s.\n", hw_bp_err_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2741,6 +2761,7 @@ update_inserted_breakpoint_locations (void)
|
|||
int val = 0;
|
||||
int disabled_breaks = 0;
|
||||
int hw_breakpoint_error = 0;
|
||||
int hw_bp_details_reported = 0;
|
||||
|
||||
struct ui_file *tmp_error_stream = mem_fileopen ();
|
||||
struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_error_stream);
|
||||
|
@ -2775,7 +2796,7 @@ update_inserted_breakpoint_locations (void)
|
|||
continue;
|
||||
|
||||
val = insert_bp_location (bl, tmp_error_stream, &disabled_breaks,
|
||||
&hw_breakpoint_error);
|
||||
&hw_breakpoint_error, &hw_bp_details_reported);
|
||||
if (val)
|
||||
error_flag = val;
|
||||
}
|
||||
|
@ -2800,6 +2821,7 @@ insert_breakpoint_locations (void)
|
|||
int val = 0;
|
||||
int disabled_breaks = 0;
|
||||
int hw_breakpoint_error = 0;
|
||||
int hw_bp_error_explained_already = 0;
|
||||
|
||||
struct ui_file *tmp_error_stream = mem_fileopen ();
|
||||
struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_error_stream);
|
||||
|
@ -2833,7 +2855,7 @@ insert_breakpoint_locations (void)
|
|||
continue;
|
||||
|
||||
val = insert_bp_location (bl, tmp_error_stream, &disabled_breaks,
|
||||
&hw_breakpoint_error);
|
||||
&hw_breakpoint_error, &hw_bp_error_explained_already);
|
||||
if (val)
|
||||
error_flag = val;
|
||||
}
|
||||
|
@ -2878,7 +2900,7 @@ insert_breakpoint_locations (void)
|
|||
{
|
||||
/* If a hardware breakpoint or watchpoint was inserted, add a
|
||||
message about possibly exhausted resources. */
|
||||
if (hw_breakpoint_error)
|
||||
if (hw_breakpoint_error && !hw_bp_error_explained_already)
|
||||
{
|
||||
fprintf_unfiltered (tmp_error_stream,
|
||||
"Could not insert hardware breakpoints:\n\
|
||||
|
@ -2943,7 +2965,7 @@ reattach_breakpoints (int pid)
|
|||
struct bp_location *bl, **blp_tmp;
|
||||
int val;
|
||||
struct ui_file *tmp_error_stream;
|
||||
int dummy1 = 0, dummy2 = 0;
|
||||
int dummy1 = 0, dummy2 = 0, dummy3 = 0;
|
||||
struct inferior *inf;
|
||||
struct thread_info *tp;
|
||||
|
||||
|
@ -2967,7 +2989,7 @@ reattach_breakpoints (int pid)
|
|||
if (bl->inserted)
|
||||
{
|
||||
bl->inserted = 0;
|
||||
val = insert_bp_location (bl, tmp_error_stream, &dummy1, &dummy2);
|
||||
val = insert_bp_location (bl, tmp_error_stream, &dummy1, &dummy2, &dummy3);
|
||||
if (val != 0)
|
||||
{
|
||||
do_cleanups (old_chain);
|
||||
|
|
|
@ -7026,6 +7026,7 @@ putpkt_binary (char *buf, int cnt)
|
|||
int ch;
|
||||
int tcount = 0;
|
||||
char *p;
|
||||
char *message;
|
||||
|
||||
/* Catch cases like trying to read memory or listing threads while
|
||||
we're waiting for a stop reply. The remote server wouldn't be
|
||||
|
@ -8181,6 +8182,7 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
|
|||
CORE_ADDR addr;
|
||||
struct remote_state *rs;
|
||||
char *p, *endbuf;
|
||||
char *message;
|
||||
|
||||
/* The length field should be set to the size of a breakpoint
|
||||
instruction, even though we aren't inserting one ourselves. */
|
||||
|
@ -8215,6 +8217,13 @@ remote_insert_hw_breakpoint (struct gdbarch *gdbarch,
|
|||
switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z1]))
|
||||
{
|
||||
case PACKET_ERROR:
|
||||
if (rs->buf[1] == '.')
|
||||
{
|
||||
message = strchr (rs->buf + 2, '.');
|
||||
if (message)
|
||||
error ("Remote failure reply: %s", message + 1);
|
||||
}
|
||||
return -1;
|
||||
case PACKET_UNKNOWN:
|
||||
return -1;
|
||||
case PACKET_OK:
|
||||
|
|
Loading…
Reference in New Issue