Cleaned up reading of debug info a bit.
Renamed:
VG_(read_procselfmaps_contents)() --> VG_(read_procselfmaps)()
VG_(read_procselfmaps)() --> VG_(parse_procselfmaps)()
VG_(read_symbols)() --> VG_(read_all_symbols)()
VG_(read_symtab_callback)() --> VG_(read_seg_symbols)()
Removed the Bool 'read_from_file' arg from (what is now)
VG_(parse_procselfmaps)(). If /proc/self/maps needs to be read beforehand, the
code calls (what is now) VG_(read_procselfmaps)() before. Still using the
static buffer which is not nice but good enough.
More importantly, I split up VG_(new_exe_segment)() into
VG_(new_exeseg_startup)() and VG_(new_exeseg_mmap)(). This is because at
startup, we were stupidly calling VG_(read_symbols)() for every exe seg, which
parses /proc/self/maps completely in order to load the debug info/symbols for
the exe seg (and any others we haven't already got the symbols for). Despite
the fact that the startup code reads /proc/self/maps to know which segments are
there at startup. In other words, we were reading /proc/self/maps several
times more often than necessary, and there were nested reads, which Stephan
Kulow's recent depth patch fixed (but in a pretty hacky way; this commit fixes
it properly). So VG_(new_exeseg_startup)() now doesn't cause /proc/self/maps
to be re-read. Unfortunately we do have to re-read /proc/self/maps for mmap(),
because we don't know the filename from the mmap() call (only the file
descriptor, which isn't enough).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1830 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h
index 11ec671..5425e3e 100644
--- a/coregrind/vg_include.h
+++ b/coregrind/vg_include.h
@@ -1258,16 +1258,16 @@
Exports of vg_procselfmaps.c
------------------------------------------------------------------ */
-/* Reads /proc/self/maps into a static buffer. */
-void VG_(read_procselfmaps_contents) ( void );
+/* Reads /proc/self/maps into a static buffer which can be parsed by
+ VG_(parse_procselfmaps)(). */
+extern void VG_(read_procselfmaps) ( void );
/* Parses /proc/self/maps, calling `record_mapping' for each entry. If
`read_from_file' is True, /proc/self/maps is read directly, otherwise
it's read from the buffer filled by VG_(read_procselfmaps_contents)(). */
extern
-void VG_(read_procselfmaps) (
- void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* ),
- Bool read_from_file
+void VG_(parse_procselfmaps) (
+ void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* )
);
@@ -1275,13 +1275,12 @@
Exports of vg_symtab2.c
------------------------------------------------------------------ */
-extern void VG_(mini_stack_dump) ( Addr eips[], UInt n_eips );
-extern Char* VG_(describe_eip)(Addr eip, Char* buf, Int n_buf);
-extern void VG_(read_symbols) ( void );
-extern void VG_(read_symtab_callback) ( Addr start, UInt size,
- Char rr, Char ww, Char xx,
- UInt foffset, UChar* filename );
-extern void VG_(unload_symbols) ( Addr start, UInt length );
+extern void VG_(mini_stack_dump) ( Addr eips[], UInt n_eips );
+extern void VG_(read_all_symbols) ( void );
+extern void VG_(read_seg_symbols) ( Addr start, UInt size,
+ Char rr, Char ww, Char xx,
+ UInt foffset, UChar* filename );
+extern void VG_(unload_symbols) ( Addr start, UInt length );
extern Bool VG_(get_fnname_nodemangle)( Addr a, Char* fnname, Int n_fnname );
extern Int VG_(setup_code_redirect_table) ( void );
@@ -1454,12 +1453,15 @@
Exports of vg_memory.c
------------------------------------------------------------------ */
-extern void VG_(init_memory) ( void );
-extern void VG_(new_exe_segment) ( Addr a, UInt len );
-extern void VG_(remove_if_exe_segment) ( Addr a, UInt len );
+extern void VG_(init_memory) ( void );
+extern void VG_(new_exeseg_startup) ( Addr a, UInt len, Char rr, Char ww,
+ Char xx, UInt foffset,
+ UChar* filename );
+extern void VG_(new_exeseg_mmap) ( Addr a, UInt len );
+extern void VG_(remove_if_exeseg) ( Addr a, UInt len );
extern __attribute__((regparm(1)))
- void VG_(unknown_esp_update) ( Addr new_ESP );
+ void VG_(unknown_esp_update) ( Addr new_ESP );
/* ---------------------------------------------------------------------
Exports of vg_syscalls.c