[lldb-dev] [PATCH] Host.cpp and RegisterContextLinux_x86_64.cpp fixes

Stephen Wilson wilsons at start.ca
Mon Feb 7 20:41:28 PST 2011


Greg Clayton <gclayton at apple.com> writes:

> With revision 125064 I have modified the way Host::DynamicLibaryOpen
> works. It now takes an abtract options that can be logical OR'ed
> together that allow one to specify lazy, local/global, and if
> Host::DynamicLibraryGetSymbol lookups should only find matches in the
> shared library that was opened. Systems that support RTLD_FIRST will
> use it, and ones that don't will do a bit of extra work to make sure
> this open request (find only symbols in this shared library) will be
> honored.
>
> Stephen, please try it out on Linux and see if this works as you would
> expect.

Tested with the patch below.  I think ensuring that one of RTLD_LAZY or
RTLD_NOW is set should be correct for darwin as well.

> I also switched over to either defining LLDB_CONFIG_XXX values, or not
> defining them to stay inline with current open source practices so we
> can soon use autoconf or cmake to configure LLDB.

Nice!  Thanks a lot for doing that!

>
> Greg Clayton

diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index b017461..6c157ef 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -673,6 +673,8 @@ Host::DynamicLibraryOpen (const FileSpec &file_spec, uint32_t options, Error &er
         
         if (options & eDynamicLibraryOpenOptionLazy)
             mode |= RTLD_LAZY;
+        else
+            mode |= RTLD_NOW;
     
         if (options & eDynamicLibraryOpenOptionLocal)
             mode |= RTLD_LOCAL;
@@ -744,7 +746,7 @@ Host::DynamicLibraryGetSymbol (void *opaque, const char *symbol_name, Error &err
             // This host doesn't support limiting searches to this shared library
             // so we need to verify that the match came from this shared library
             // if it was requested in the Host::DynamicLibraryOpen() function.
-            if (dylib_info->options & eDynamicLibraryOpenOptionLimitGetSymbol)
+            if (dylib_info->open_options & eDynamicLibraryOpenOptionLimitGetSymbol)
             {
                 FileSpec match_dylib_spec (Host::GetModuleFileSpecForHostAddress (symbol_addr));
                 if (match_dylib_spec != dylib_info->file_spec)



More information about the lldb-dev mailing list