2011-07-25 Pedro Alves <pedro@codesourcery.com>

* breakpoint.c (bkpt_print_it, internal_bkpt_print_it)
	(momentary_bkpt_print_it): Simplify.
This commit is contained in:
Pedro Alves
2011-07-25 11:20:08 +00:00
parent 06edf0c005
commit 001c8c333d
2 changed files with 40 additions and 94 deletions

View File

@ -1,3 +1,8 @@
2011-07-25 Pedro Alves <pedro@codesourcery.com>
* breakpoint.c (bkpt_print_it, internal_bkpt_print_it)
(momentary_bkpt_print_it): Simplify.
2011-07-25 Pedro Alves <pedro@codesourcery.com> 2011-07-25 Pedro Alves <pedro@codesourcery.com>
Split internal, momentary and user breakpoints breakpoint_ops Split internal, momentary and user breakpoints breakpoint_ops

View File

@ -10783,25 +10783,15 @@ bkpt_works_in_software_mode (const struct breakpoint *b)
enum print_stop_action enum print_stop_action
bkpt_print_it (bpstat bs) bkpt_print_it (bpstat bs)
{ {
struct cleanup *old_chain;
struct breakpoint *b; struct breakpoint *b;
const struct bp_location *bl; const struct bp_location *bl;
struct ui_stream *stb; int bp_temp;
int bp_temp = 0;
enum print_stop_action result;
gdb_assert (bs->bp_location_at != NULL); gdb_assert (bs->bp_location_at != NULL);
bl = bs->bp_location_at; bl = bs->bp_location_at;
b = bs->breakpoint_at; b = bs->breakpoint_at;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
switch (b->type)
{
case bp_breakpoint:
case bp_hardware_breakpoint:
bp_temp = b->disposition == disp_del; bp_temp = b->disposition == disp_del;
if (bl->address != bl->requested_address) if (bl->address != bl->requested_address)
breakpoint_adjustment_warning (bl->requested_address, breakpoint_adjustment_warning (bl->requested_address,
@ -10820,16 +10810,8 @@ bkpt_print_it (bpstat bs)
} }
ui_out_field_int (uiout, "bkptno", b->number); ui_out_field_int (uiout, "bkptno", b->number);
ui_out_text (uiout, ", "); ui_out_text (uiout, ", ");
result = PRINT_SRC_AND_LOC;
break;
default: return PRINT_SRC_AND_LOC;
result = PRINT_UNKNOWN;
break;
}
do_cleanups (old_chain);
return result;
} }
void void
@ -10944,21 +10926,10 @@ internal_bkpt_check_status (bpstat bs)
static enum print_stop_action static enum print_stop_action
internal_bkpt_print_it (bpstat bs) internal_bkpt_print_it (bpstat bs)
{ {
struct cleanup *old_chain;
struct breakpoint *b; struct breakpoint *b;
const struct bp_location *bl;
struct ui_stream *stb;
int bp_temp = 0;
enum print_stop_action result;
gdb_assert (bs->bp_location_at != NULL);
bl = bs->bp_location_at;
b = bs->breakpoint_at; b = bs->breakpoint_at;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
switch (b->type) switch (b->type)
{ {
case bp_shlib_event: case bp_shlib_event:
@ -10966,49 +10937,38 @@ internal_bkpt_print_it (bpstat bs)
variable? (If so, we report this as a generic, "Stopped due variable? (If so, we report this as a generic, "Stopped due
to shlib event" message.) */ to shlib event" message.) */
printf_filtered (_("Stopped due to shared library event\n")); printf_filtered (_("Stopped due to shared library event\n"));
result = PRINT_NOTHING;
break; break;
case bp_thread_event: case bp_thread_event:
/* Not sure how we will get here. /* Not sure how we will get here.
GDB should not stop for these breakpoints. */ GDB should not stop for these breakpoints. */
printf_filtered (_("Thread Event Breakpoint: gdb should not stop!\n")); printf_filtered (_("Thread Event Breakpoint: gdb should not stop!\n"));
result = PRINT_NOTHING;
break; break;
case bp_overlay_event: case bp_overlay_event:
/* By analogy with the thread event, GDB should not stop for these. */ /* By analogy with the thread event, GDB should not stop for these. */
printf_filtered (_("Overlay Event Breakpoint: gdb should not stop!\n")); printf_filtered (_("Overlay Event Breakpoint: gdb should not stop!\n"));
result = PRINT_NOTHING;
break; break;
case bp_longjmp_master: case bp_longjmp_master:
/* These should never be enabled. */ /* These should never be enabled. */
printf_filtered (_("Longjmp Master Breakpoint: gdb should not stop!\n")); printf_filtered (_("Longjmp Master Breakpoint: gdb should not stop!\n"));
result = PRINT_NOTHING;
break; break;
case bp_std_terminate_master: case bp_std_terminate_master:
/* These should never be enabled. */ /* These should never be enabled. */
printf_filtered (_("std::terminate Master Breakpoint: " printf_filtered (_("std::terminate Master Breakpoint: "
"gdb should not stop!\n")); "gdb should not stop!\n"));
result = PRINT_NOTHING;
break; break;
case bp_exception_master: case bp_exception_master:
/* These should never be enabled. */ /* These should never be enabled. */
printf_filtered (_("Exception Master Breakpoint: " printf_filtered (_("Exception Master Breakpoint: "
"gdb should not stop!\n")); "gdb should not stop!\n"));
result = PRINT_NOTHING;
break;
default:
result = PRINT_UNKNOWN;
break; break;
} }
do_cleanups (old_chain); return PRINT_NOTHING;
return result;
} }
static void static void
@ -11064,46 +11024,27 @@ momentary_bkpt_check_status (bpstat bs)
static enum print_stop_action static enum print_stop_action
momentary_bkpt_print_it (bpstat bs) momentary_bkpt_print_it (bpstat bs)
{ {
struct cleanup *old_chain; if (ui_out_is_mi_like_p (uiout))
struct breakpoint *b; {
const struct bp_location *bl; struct breakpoint *b = bs->breakpoint_at;
struct ui_stream *stb;
int bp_temp = 0;
enum print_stop_action result;
gdb_assert (bs->bp_location_at != NULL);
bl = bs->bp_location_at;
b = bs->breakpoint_at;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
switch (b->type) switch (b->type)
{ {
case bp_finish: case bp_finish:
if (ui_out_is_mi_like_p (uiout))
ui_out_field_string ui_out_field_string
(uiout, "reason", (uiout, "reason",
async_reason_lookup (EXEC_ASYNC_FUNCTION_FINISHED)); async_reason_lookup (EXEC_ASYNC_FUNCTION_FINISHED));
result = PRINT_UNKNOWN;
break; break;
case bp_until: case bp_until:
if (ui_out_is_mi_like_p (uiout))
ui_out_field_string ui_out_field_string
(uiout, "reason", (uiout, "reason",
async_reason_lookup (EXEC_ASYNC_LOCATION_REACHED)); async_reason_lookup (EXEC_ASYNC_LOCATION_REACHED));
result = PRINT_UNKNOWN;
break;
default:
result = PRINT_UNKNOWN;
break; break;
} }
}
do_cleanups (old_chain); return PRINT_UNKNOWN;
return result;
} }
static void static void