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]

[PATCH, mi] Add memory ranges to -library-loaded events


Hi,

This patch extends the information exported by -library-loaded events to the upper layers by adding two more fields.

These fields are the low address and high address of the loaded library, indicating exactly where it was loaded in memory.

I didn't see any explicit tests for -library-loaded events. We mostly just recognize that it is there, but ignore its contents completely. So no testcase for this one.

A NEWS entry was added and the documentation was updated to reflect the new fields.

OK?

Luis
2013-04-22  Vladimir Prus  <vladimir@codesourcery.com>
	    Luis Machado  <lgustavo@codesourcery.com>

	* NEWS (MI changes): Report -library-loaded event change.
	* doc/gdb.texinfo (Async Records): Update -library-loaded
	event description.
	* mi/mi-interp.c (mi_solib_loaded): Report addresses.

Index: gdb/mi/mi-interp.c
===================================================================
--- gdb.orig/mi/mi-interp.c	2013-04-22 12:38:54.149797891 +0200
+++ gdb/mi/mi-interp.c	2013-04-22 12:39:29.733797259 +0200
@@ -807,16 +807,24 @@ mi_solib_loaded (struct so_list *solib)
   if (gdbarch_has_global_solist (target_gdbarch ()))
     fprintf_unfiltered (mi->event_channel,
 			"library-loaded,id=\"%s\",target-name=\"%s\","
-			"host-name=\"%s\",symbols-loaded=\"%d\"",
+			"host-name=\"%s\",low-address=\"%s\","
+			"high-address=\"%s\",symbols-loaded=\"%d\"",
 			solib->so_original_name, solib->so_original_name,
-			solib->so_name, solib->symbols_loaded);
+			solib->so_name,
+			paddress (target_gdbarch (), solib->addr_low),
+			paddress (target_gdbarch (), solib->addr_high),
+			solib->symbols_loaded);
   else
     fprintf_unfiltered (mi->event_channel,
 			"library-loaded,id=\"%s\",target-name=\"%s\","
-			"host-name=\"%s\",symbols-loaded=\"%d\","
+			"host-name=\"%s\",low-address=\"%s\","
+			"high-address=\"%s\",symbols-loaded=\"%d\""
 			"thread-group=\"i%d\"",
 			solib->so_original_name, solib->so_original_name,
-			solib->so_name, solib->symbols_loaded,
+			solib->so_name,
+			paddress (target_gdbarch (), solib->addr_low),
+			paddress (target_gdbarch (), solib->addr_high),
+			solib->symbols_loaded,
 			current_inferior ()->num);
 
   gdb_flush (mi->event_channel);
Index: gdb/doc/gdb.texinfo
===================================================================
--- gdb.orig/doc/gdb.texinfo	2013-04-22 12:38:54.149797891 +0200
+++ gdb/doc/gdb.texinfo	2013-04-22 12:39:29.741797258 +0200
@@ -28117,12 +28117,15 @@ 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
+notification has 6 fields---@var{id}, @var{target-name},
+@var{host-name}, @var{low-address}, @var{high-address} 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{low-address} and @var{high-address} fields carry information
+about the memory address range used by the loaded library.
 @var{symbols-loaded} field is emitted only for backward compatibility
 and should not be relied on to convey any useful information.  The
 @var{thread-group} field, if present, specifies the id of the thread
Index: gdb/NEWS
===================================================================
--- gdb.orig/NEWS	2013-04-22 12:38:54.149797891 +0200
+++ gdb/NEWS	2013-04-22 12:39:29.741797258 +0200
@@ -48,6 +48,8 @@ show remote trace-status-packet
 
 * MI changes
 
+  ** The -library-loaded event carries information about the memory range
+     in which the library was loaded.
   ** The -trace-save MI command can optionally save trace buffer in Common
      Trace Format now.
 

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