aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/inferior.h2
-rw-r--r--gdb/infrun.c118
-rw-r--r--gdb/mi/mi-interp.c3
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.mi/mi-solib.exp4
-rw-r--r--gdb/testsuite/lib/mi-support.exp18
7 files changed, 98 insertions, 63 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8b54b59..1c68937 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2014-03-18 Pedro Alves <palves@redhat.com>
+
+ PR gdb/13860
+ * inferior.h (print_stop_event): Declare.
+ * infrun.c (print_stop_event): New, factored out from ...
+ (normal_stop): ... this.
+ * mi/mi-interp.c (mi_on_normal_stop): Use print_stop_event instead
+ of bpstat_print/print_stack_frame.
+
2014-03-17 Tom Tromey <tromey@redhat.com>
* ui-out.c (clear_table, ui_out_new): Clear uiout->table.id.
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 6c0730a..b15f692 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -195,6 +195,8 @@ extern void start_remote (int from_tty);
extern void normal_stop (void);
+extern void print_stop_event (struct target_waitstatus *ws);
+
extern int signal_stop_state (int);
extern int signal_print_state (int);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b7c0969..fe5d88b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5996,6 +5996,68 @@ print_no_history_reason (void)
ui_out_text (current_uiout, "\nNo more reverse-execution history.\n");
}
+/* Print current location without a level number, if we have changed
+ functions or hit a breakpoint. Print source line if we have one.
+ bpstat_print contains the logic deciding in detail what to print,
+ based on the event(s) that just occurred. */
+
+void
+print_stop_event (struct target_waitstatus *ws)
+{
+ int bpstat_ret;
+ int source_flag;
+ int do_frame_printing = 1;
+ struct thread_info *tp = inferior_thread ();
+
+ bpstat_ret = bpstat_print (tp->control.stop_bpstat, ws->kind);
+ switch (bpstat_ret)
+ {
+ case PRINT_UNKNOWN:
+ /* FIXME: cagney/2002-12-01: Given that a frame ID does (or
+ should) carry around the function and does (or should) use
+ that when doing a frame comparison. */
+ if (tp->control.stop_step
+ && frame_id_eq (tp->control.step_frame_id,
+ get_frame_id (get_current_frame ()))
+ && step_start_function == find_pc_function (stop_pc))
+ {
+ /* Finished step, just print source line. */
+ source_flag = SRC_LINE;
+ }
+ else
+ {
+ /* Print location and source line. */
+ source_flag = SRC_AND_LOC;
+ }
+ break;
+ case PRINT_SRC_AND_LOC:
+ /* Print location and source line. */
+ source_flag = SRC_AND_LOC;
+ break;
+ case PRINT_SRC_ONLY:
+ source_flag = SRC_LINE;
+ break;
+ case PRINT_NOTHING:
+ /* Something bogus. */
+ source_flag = SRC_LINE;
+ do_frame_printing = 0;
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, _("Unknown value."));
+ }
+
+ /* The behavior of this routine with respect to the source
+ flag is:
+ SRC_LINE: Print only source line
+ LOCATION: Print only location
+ SRC_AND_LOC: Print location and source line. */
+ if (do_frame_printing)
+ print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
+
+ /* Display the auto-display expressions. */
+ do_displays ();
+}
+
/* Here to return control to GDB when the inferior stops for real.
Print appropriate messages, remove breakpoints, give terminal our modes.
@@ -6118,65 +6180,11 @@ normal_stop (void)
{
select_frame (get_current_frame ());
- /* Print current location without a level number, if
- we have changed functions or hit a breakpoint.
- Print source line if we have one.
- bpstat_print() contains the logic deciding in detail
- what to print, based on the event(s) that just occurred. */
-
/* If --batch-silent is enabled then there's no need to print the current
source location, and to try risks causing an error message about
missing source files. */
if (stop_print_frame && !batch_silent)
- {
- int bpstat_ret;
- int source_flag;
- int do_frame_printing = 1;
- struct thread_info *tp = inferior_thread ();
-
- bpstat_ret = bpstat_print (tp->control.stop_bpstat, last.kind);
- switch (bpstat_ret)
- {
- case PRINT_UNKNOWN:
- /* FIXME: cagney/2002-12-01: Given that a frame ID does
- (or should) carry around the function and does (or
- should) use that when doing a frame comparison. */
- if (tp->control.stop_step
- && frame_id_eq (tp->control.step_frame_id,
- get_frame_id (get_current_frame ()))
- && step_start_function == find_pc_function (stop_pc))
- source_flag = SRC_LINE; /* Finished step, just
- print source line. */
- else
- source_flag = SRC_AND_LOC; /* Print location and
- source line. */
- break;
- case PRINT_SRC_AND_LOC:
- source_flag = SRC_AND_LOC; /* Print location and
- source line. */
- break;
- case PRINT_SRC_ONLY:
- source_flag = SRC_LINE;
- break;
- case PRINT_NOTHING:
- source_flag = SRC_LINE; /* something bogus */
- do_frame_printing = 0;
- break;
- default:
- internal_error (__FILE__, __LINE__, _("Unknown value."));
- }
-
- /* The behavior of this routine with respect to the source
- flag is:
- SRC_LINE: Print only source line
- LOCATION: Print only location
- SRC_AND_LOC: Print location and source line. */
- if (do_frame_printing)
- print_stack_frame (get_selected_frame (NULL), 0, source_flag, 1);
-
- /* Display the auto-display expressions. */
- do_displays ();
- }
+ print_stop_event (&last);
}
/* Save the function value return registers, if we care.
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 25bf0a1..862beaf 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -441,9 +441,8 @@ mi_on_normal_stop (struct bpstats *bs, int print_frame)
current_uiout = mi_uiout;
get_last_target_status (&last_ptid, &last);
- bpstat_print (bs, last.kind);
+ print_stop_event (&last);
- print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
current_uiout = saved_uiout;
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4e6e248..458e795 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-18 Pedro Alves <palves@redhat.com>
+
+ PR gdb/13860
+ * gdb.mi/mi-solib.exp: Remove gdb/13860 kfail.
+ * lib/mi-support.exp (mi_expect_stop): Add special handling for
+ solib-event.
+
2014-03-17 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/pckd_arr_ren: New testcase.
diff --git a/gdb/testsuite/gdb.mi/mi-solib.exp b/gdb/testsuite/gdb.mi/mi-solib.exp
index 06fa26b..608d2b7 100644
--- a/gdb/testsuite/gdb.mi/mi-solib.exp
+++ b/gdb/testsuite/gdb.mi/mi-solib.exp
@@ -60,8 +60,4 @@ mi_gdb_test "777-gdb-set stop-on-solib-events 1" "777\\^done" \
# commands still cause the correct MI output to be generated.
mi_run_with_cli
-global async
-if { $async } {
- setup_kfail gdb/13860 *-*-*
-}
mi_expect_stop solib-event .* .* .* .* .* "check for solib event"
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 1e8fee6..213073a 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1028,6 +1028,8 @@ proc mi_expect_stop { reason func args file line extra test } {
global thread_selected_re
global breakpoint_re
+ set any "\[^\n\]*"
+
set after_stopped ""
set after_reason ""
if { [llength $extra] == 2 } {
@@ -1070,6 +1072,20 @@ proc mi_expect_stop { reason func args file line extra test } {
return
}
+ if { $reason == "solib-event" } {
+ set pattern "\\*stopped,reason=\"solib-event\",thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
+ verbose -log "mi_expect_stop: expecting: $pattern"
+ gdb_expect {
+ -re "$pattern" {
+ pass "$test"
+ }
+ timeout {
+ fail "$test (unknown output after running)"
+ }
+ }
+ return
+ }
+
set args "\\\[$args\\\]"
set bn ""
@@ -1087,8 +1103,6 @@ proc mi_expect_stop { reason func args file line extra test } {
set a $after_reason
- set any "\[^\n\]*"
-
verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
gdb_expect {
-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {