Kaydet (Commit) 3dfb38a4 authored tarafından Kay Ramme's avatar Kay Ramme

added getUrlFromAddress (#88338#)

üst d2ab706b
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: module.hxx,v $ * $RCSfile: module.hxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: obr $ $Date: 2001-05-14 08:55:38 $ * last change: $Author: kr $ $Date: 2001-09-03 11:08:37 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -79,6 +79,10 @@ class Module ...@@ -79,6 +79,10 @@ class Module
Module& operator = ( const Module&); Module& operator = ( const Module&);
public: public:
static sal_Bool getUrlFromAddress(void * addr, ::rtl::OUString & libraryUrl) {
return osl_getModuleURLFromAddress(addr, &libraryUrl.pData);
}
Module(): m_Module(0){} Module(): m_Module(0){}
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: module.c,v $ * $RCSfile: module.c,v $
* *
* $Revision: 1.18 $ * $Revision: 1.19 $
* *
* last change: $Author: obr $ $Date: 2001-05-18 07:47:11 $ * last change: $Author: kr $ $Date: 2001-09-03 11:08:37 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -438,3 +438,30 @@ void* SAL_CALL osl_psz_getSymbol(oslModule hModule, const sal_Char* pszSymbolNam ...@@ -438,3 +438,30 @@ void* SAL_CALL osl_psz_getSymbol(oslModule hModule, const sal_Char* pszSymbolNam
#endif /* MACOSX */ #endif /* MACOSX */
} }
sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibraryUrl)
{
sal_Bool result = sal_False;
Dl_info dl_info;
if(result = dladdr(addr, &dl_info))
{
rtl_uString * workDir = NULL;
osl_getProcessWorkingDir(&workDir);
#ifdef DEBUG
OSL_TRACE("module.c::osl_getModuleUrl - %s\n", dl_info.dli_fname);
#endif
rtl_string2UString(ppLibraryUrl, dl_info.dli_fname, strlen(dl_info.dli_fname), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS);
osl_getFileURLFromSystemPath(*ppLibraryUrl, ppLibraryUrl); // convert it to be a file url
osl_getAbsoluteFileURL(workDir, *ppLibraryUrl, ppLibraryUrl); // ensure it is an abosolute file url
result = sal_True;
}
return result;
}
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: system.h,v $ * $RCSfile: system.h,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: svesik $ $Date: 2001-05-14 15:30:58 $ * last change: $Author: kr $ $Date: 2001-09-03 11:08:37 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
#endif #endif
#ifdef LINUX #ifdef LINUX
#define __USE_GNU
#if GLIBC >= 2 #if GLIBC >= 2
# include <shadow.h> # include <shadow.h>
# include <asm/sigcontext.h> # include <asm/sigcontext.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment