Bug 1066760 - Add base address and fall back to system dladdr in __wrap_dladdr; r=froydnj

This commit is contained in:
Jim Chen 2014-09-24 14:12:54 -04:00
parent 1cc43c5dbb
commit f3c570c80b
3 changed files with 11 additions and 2 deletions

View File

@ -36,6 +36,7 @@ public:
virtual ~CustomElf();
virtual void *GetSymbolPtr(const char *symbol) const;
virtual bool Contains(void *addr) const;
virtual void *GetBase() const { return GetPtr(0); }
#ifdef __ARM_EABI__
virtual const void *FindExidx(int *pcount) const;

View File

@ -90,9 +90,11 @@ int
__wrap_dladdr(void *addr, Dl_info *info)
{
RefPtr<LibHandle> handle = ElfLoader::Singleton.GetHandleByPtr(addr);
if (!handle)
return 0;
if (!handle) {
return dladdr(addr, info);
}
info->dli_fname = handle->GetPath();
info->dli_fbase = handle->GetBase();
return 1;
}

View File

@ -117,6 +117,11 @@ public:
*/
virtual bool Contains(void *addr) const = 0;
/**
* Returns the base address of the loaded library.
*/
virtual void *GetBase() const = 0;
/**
* Returns the file name of the library without the containing directory.
*/
@ -267,6 +272,7 @@ public:
virtual ~SystemElf();
virtual void *GetSymbolPtr(const char *symbol) const;
virtual bool Contains(void *addr) const { return false; /* UNIMPLEMENTED */ }
virtual void *GetBase() const { return nullptr; /* UNIMPLEMENTED */ }
#ifdef __ARM_EABI__
virtual const void *FindExidx(int *pcount) const;