(mi_interpreter_init): Register the above.
* solib.c (clear_solib): Notify solib unload.
* breakpoint.c (disable_breakpoints_in_unloaded_shlib): Do not
disable breakpoints on a.out targets.
+2009-02-18 Vladimir Prus <vladimir@codesourcery.com>
+
+ * mi/mi-interp.c (mi_solib_loaded, mi_solib_unloaded): New.
+ (mi_interpreter_init): Register the above.
+ * solib.c (clear_solib): Notify solib unload.
+ * breakpoint.c (disable_breakpoints_in_unloaded_shlib): Do not
+ disable breakpoints on a.out targets.
+
2009-02-17 Vladimir Prus <vladimir@codesourcery.com>
* observer.c (observer_test_first_notification_function)
struct bp_location *loc;
int disabled_shlib_breaks = 0;
+ /* SunOS a.out shared libraries are always mapped, so do not
+ disable breakpoints; they will only be reported as unloaded
+ through clear_solib when GDB discards its shared library
+ list. See clear_solib for more information. */
+ if (exec_bfd != NULL
+ && bfd_get_flavour (exec_bfd) == bfd_target_aout_flavour)
+ return;
+
ALL_BP_LOCATIONS (loc)
{
struct breakpoint *b = loc->owner;
+2009-02-18 Vladimir Prus <vladimir@codesourcery.com>
+
+ * gdb.texinfo (GDB/MI Async Records): Document the
+ =library-loaded and =library-unloaded notifications.
+
2009-02-17 Vladimir Prus <vladimir@codesourcery.com>
* observer.texi (test_notification): New observer.
highlight the selected thread and cause subsequent commands to apply to
that thread.
+@item =library-loaded,...
+Reports that a new library file was loaded by the program. This
+notification has 4 fields---@var{id}, @var{target-name},
+@var{host-name}, and @var{symbols-loaded}. The @var{id} field is an
+opaque identifier of the library. For remote debugging case,
+@var{target-name} and @var{host-name} fields give the name of the
+library file on the target, and on the host respectively. For native
+debugging, both those fields have the same value. The
+@var{symbols-loaded} field reports if the debug symbols for this
+library are loaded.
+
+@item =library-unloaded,...
+Reports that a library was unloaded by the program. This notification
+has 3 fields---@var{id}, @var{target-name} and @var{host-name} with
+the same meaning as for the @code{=library-loaded} notification
+
@end table
@node GDB/MI Frame Information
#include "mi-common.h"
#include "observer.h"
#include "gdbthread.h"
+#include "solist.h"
/* These are the interpreter setup, etc. functions for the MI interpreter */
static void mi_execute_command_wrapper (char *cmd);
static void mi_new_inferior (int pid);
static void mi_inferior_exit (int pid);
static void mi_on_resume (ptid_t ptid);
+static void mi_solib_loaded (struct so_list *solib);
+static void mi_solib_unloaded (struct so_list *solib);
static void *
mi_interpreter_init (int top_level)
observer_attach_inferior_exit (mi_inferior_exit);
observer_attach_normal_stop (mi_on_normal_stop);
observer_attach_target_resumed (mi_on_resume);
+ observer_attach_solib_loaded (mi_solib_loaded);
+ observer_attach_solib_unloaded (mi_solib_unloaded);
}
return mi;
gdb_flush (raw_stdout);
}
+static void
+mi_solib_loaded (struct so_list *solib)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+ target_terminal_ours ();
+ fprintf_unfiltered (mi->event_channel,
+ "library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"%d\"",
+ solib->so_original_name, solib->so_original_name,
+ solib->so_name, solib->symbols_loaded);
+ gdb_flush (mi->event_channel);
+}
+
+static void
+mi_solib_unloaded (struct so_list *solib)
+{
+ struct mi_interp *mi = top_level_interpreter_data ();
+ target_terminal_ours ();
+ fprintf_unfiltered (mi->event_channel,
+ "library-unloaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\"",
+ solib->so_original_name, solib->so_original_name,
+ solib->so_name);
+ gdb_flush (mi->event_channel);
+}
+
+
extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */
void
{
struct so_list *so = so_list_head;
so_list_head = so->next;
+ observer_notify_solib_unloaded (so);
if (so->abfd)
remove_target_sections (so->abfd);
free_so (so);
+2009-02-17 Vladimir Prus <vladimir@codesourcery.com>
+
+ * gdb.mi/mi-nonstop.exp (notifs): Adjust for library
+ notifications.
+ * gdb.mi/mi-nsintrall.exp (notifs): Likewise.
+ * gdb.mi/mi-nsmoribund.exp (notifs): Likewise.
+ * lib/mi-support.exp (library_loaded_re): New.
+ (mi_run_cmd, mi_send_resuming_command_raw): Adjust.
+
2009-02-17 Vladimir Prus <vladimir@codesourcery.com>
* gdb.gdb/observer.exp: Use test_notification observer, not
set created "=thread-created,id=\"$decimal\"\r\n"
set running "\\*running,thread-id=\"$decimal\"\r\n"
-set notifs "($created)*($running)*"
+set notifs "($created)*($running)*($library_loaded_re)*"
# Note: presently, we skip this test on non-native targets,
# so 'run' is OK. As soon as we start to run this on remote
set created "=thread-created,id=\"$decimal\"\r\n"
set running "\\*running,thread-id=\"$decimal\"\r\n"
-set notifs "($created)*($running)*"
+set notifs "($created)*($running)*($library_loaded_re)*"
# Note: presently, we skip this test on non-native targets,
# so 'run' is OK. As soon as we start to run this on remote
set created "=thread-created,id=\"$decimal\"\r\n"
set running "\\*running,thread-id=\"$decimal\"\r\n"
-set notifs "($created)*($running)*"
+set notifs "($created)*($running)*($library_loaded_re)*"
# Note: presently, we skip this test on non-native targets,
# so 'run' is OK. As soon as we start to run this on remote
set MIFLAGS "-i=mi"
set thread_selected_re "=thread-selected,id=\"\[0-9+\]\"\r\n"
+set library_loaded_re "=library-loaded\[^\n\]+\"\r\n"
#
# mi_gdb_exit -- exit the GDB, killing the target program if necessary
}
global mi_gdb_prompt
global thread_selected_re
+ global library_loaded_re
if [target_info exists gdb_init_command] {
send_gdb "[target_info gdb_init_command]\n";
send_gdb "220-exec-run $args\n"
gdb_expect {
- -re "220\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\",group-id=\"\[0-9\]+\"\r\n)*(${thread_selected_re})?${mi_gdb_prompt}" {
+ -re "220\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n|=thread-created,id=\"1\",group-id=\"\[0-9\]+\"\r\n)*(${library_loaded_re})*(${thread_selected_re})?${mi_gdb_prompt}" {
}
timeout {
perror "Unable to start target"
global mi_gdb_prompt
global thread_selected_re
+ global library_loaded_re
send_gdb "$command\n"
gdb_expect {
- -re "\\^running\r\n\\*running,thread-id=\"\[^\"\]+\"\r\n($thread_selected_re)?${mi_gdb_prompt}" {
+ -re "\\^running\r\n\\*running,thread-id=\"\[^\"\]+\"\r\n($library_loaded_re)*($thread_selected_re)?${mi_gdb_prompt}" {
# Note that lack of 'pass' call here -- this works around limitation
# in DejaGNU xfail mechanism. mi-until.exp has this:
#