From e7aa6b03de97242bfd38e2efe7ff89fe299dd68f Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sat, 25 Jun 2005 20:49:33 +0000 Subject: [PATCH] Made m_debuginfo not depend on m_aspacemgr, breaking the direct circular dependence between them. (There's still an indirect one via m_libcmman.) As a result, I was able to move the Segment type declaration into pub_core_aspacemgr.h, which is a much better spot. I was also able to remove a couple of #includes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4025 --- coregrind/m_aspacemgr/aspacemgr.c | 9 ++++++--- coregrind/m_debuginfo/symtab.c | 15 ++++++--------- coregrind/m_redir.c | 3 +-- coregrind/m_stacktrace.c | 2 +- coregrind/pub_core_aspacemgr.h | 2 ++ coregrind/pub_core_debuginfo.h | 5 ++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr.c b/coregrind/m_aspacemgr/aspacemgr.c index 9cc3ea404..64745c647 100644 --- a/coregrind/m_aspacemgr/aspacemgr.c +++ b/coregrind/m_aspacemgr/aspacemgr.c @@ -792,13 +792,16 @@ VG_(map_file_segment)( Addr addr, SizeT len, && ( (addr+len < VG_(valgrind_base) || addr > VG_(valgrind_last)) || is_stage2 ) - && (flags & (SF_MMAP|SF_NOSYMS)) == SF_MMAP) { + && (flags & (SF_MMAP|SF_NOSYMS)) == SF_MMAP + ) { if (off == 0 && s->fnIdx != -1 && (prot & (VKI_PROT_READ|VKI_PROT_EXEC)) == (VKI_PROT_READ|VKI_PROT_EXEC) && len >= VKI_PAGE_SIZE - && VG_(is_object_file)((void *)addr)) { - s->seginfo = VG_(read_seg_symbols)(s); + && VG_(is_object_file)((void *)addr) + ) { + s->seginfo = VG_(read_seg_symbols)(s->addr, s->len, s->offset, + s->filename); if (s->seginfo != NULL) { s->flags |= SF_DYNLIB; } diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c index b37dd2bf9..729128dea 100644 --- a/coregrind/m_debuginfo/symtab.c +++ b/coregrind/m_debuginfo/symtab.c @@ -31,8 +31,6 @@ #include "pub_core_basics.h" #include "pub_core_threadstate.h" -#include "pub_core_debuginfo.h" // Needed for pub_core_aspacemgr :( -#include "pub_core_aspacemgr.h" // For Segment type #include "pub_core_debuginfo.h" #include "pub_core_demangle.h" #include "pub_core_libcbase.h" @@ -1618,22 +1616,21 @@ Bool read_lib_symbols ( SegInfo* si ) address ranges, and as a result the SegInfos in this list describe disjoint address ranges. */ -SegInfo *VG_(read_seg_symbols) ( Segment *seg ) +SegInfo *VG_(read_seg_symbols) ( Addr seg_addr, SizeT seg_len, + OffT seg_offset, const Char* seg_filename) { SegInfo* si; - vg_assert(seg->seginfo == NULL); - VGP_PUSHCC(VgpReadSyms); /* Get the record initialised right. */ si = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(SegInfo)); VG_(memset)(si, 0, sizeof(*si)); - si->start = seg->addr; - si->size = seg->len; - si->foffset = seg->offset; - si->filename = VG_(arena_strdup)(VG_AR_SYMTAB, seg->filename); + si->start = seg_addr; + si->size = seg_len; + si->foffset = seg_offset; + si->filename = VG_(arena_strdup)(VG_AR_SYMTAB, seg_filename); si->ref = 1; diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 9048b2d84..78e29eeef 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -31,8 +31,7 @@ */ #include "pub_core_basics.h" -#include "pub_core_debuginfo.h" // Needed for pub_core_aspacemgr :( -#include "pub_core_aspacemgr.h" // Needed for pub_core_redir.h :( +#include "pub_core_debuginfo.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index 08e4b0ad0..65bd00d54 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -30,7 +30,7 @@ #include "pub_core_basics.h" #include "pub_core_threadstate.h" -#include "pub_core_debuginfo.h" // Needed for pub_core_aspacemgr :( +#include "pub_core_debuginfo.h" #include "pub_core_aspacemgr.h" // For VG_(is_addressable)() #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h index 7f5af754e..13690dfd0 100644 --- a/coregrind/pub_core_aspacemgr.h +++ b/coregrind/pub_core_aspacemgr.h @@ -87,6 +87,8 @@ extern SysRes VG_(mprotect_native) ( void *start, SizeT length, UInt prot ); #define SF_CODE (1 << 14) // segment contains cached code #define SF_DEVICE (1 << 15) // device mapping; avoid careless touching +typedef struct _Segment Segment; + struct _Segment { UInt prot; // VKI_PROT_* UInt flags; // SF_* diff --git a/coregrind/pub_core_debuginfo.h b/coregrind/pub_core_debuginfo.h index 65ab647fe..f5de7f1ed 100644 --- a/coregrind/pub_core_debuginfo.h +++ b/coregrind/pub_core_debuginfo.h @@ -41,10 +41,9 @@ #include "pub_tool_debuginfo.h" -typedef struct _Segment Segment; - extern Bool VG_(is_object_file) ( const void *hdr ); -extern SegInfo * VG_(read_seg_symbols) ( Segment *seg ); +extern SegInfo *VG_(read_seg_symbols) ( Addr addr, SizeT len, + OffT offset, const Char* filename); extern void VG_(seginfo_incref) ( SegInfo * ); extern void VG_(seginfo_decref) ( SegInfo *, Addr a );