[Lldb-commits] [lldb] r170633 - /lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Enrico Granata
egranata at apple.com
Wed Dec 19 18:07:45 PST 2012
Author: enrico
Date: Wed Dec 19 20:07:45 2012
New Revision: 170633
URL: http://llvm.org/viewvc/llvm-project?rev=170633&view=rev
Log:
<rdar://problem/12903081>
When looking for the Python script to load for a given module, replace dots with underscores if there are any after stripping the extension
This means that for a module named foo.devel.xyz a file named foo_devel.py will be what we try to load
Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=170633&r1=170632&r2=170633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Dec 19 20:07:45 2012
@@ -58,6 +58,9 @@
const UUID *uuid = module_spec.GetUUIDPtr();
const char* module_directory = exec_fspec->GetDirectory().GetCString();
+ // XXX some extensions might be meaningful and should not be stripped - if this ever bites us
+ // we should be ready to deal with it accordingly (i.e. by having a per-platform list of those
+ // magic special extensions that actually mean something)
const char* module_basename = exec_fspec->GetFileNameStrippingExtension().GetCString();
if (!module_directory || !module_basename)
@@ -69,6 +72,21 @@
arch ? arch->GetArchitectureName() : "<NULL>",
uuid);
+ // FIXME: for Python, we cannot allow dots in the middle of the filenames we import
+ // theoretically, different scripting languages will have different sets of
+ // forbidden tokens in filenames, and that should be dealt with by each ScriptInterpreter
+ // for now, we just replace dots with underscores, but if we ever support anything
+ // other than Python we will need to rework this
+ std::auto_ptr<char> module_basename_fixed_ap(new char[strlen(module_basename)+1]);
+ char* module_basename_fixed = module_basename_fixed_ap.get();
+ strcpy(module_basename_fixed, module_basename);
+ while (*module_basename_fixed)
+ {
+ if (*module_basename_fixed == '.')
+ *module_basename_fixed = '_';
+ module_basename_fixed++;
+ }
+ module_basename_fixed = module_basename_fixed_ap.get();
FileSpec symbol_fspec (Symbols::LocateExecutableSymbolFile(module_spec));
@@ -80,7 +98,7 @@
{
// for OSX we are going to be in .dSYM/Contents/Resources/DWARF/<basename>
// let us go to .dSYM/Contents/Resources/Python/<basename>.py and see if the file exists
- path_string.Printf("%s/../Python/%s.py",symbol_fspec.GetDirectory().AsCString(""),module_basename);
+ path_string.Printf("%s/../Python/%s.py",symbol_fspec.GetDirectory().AsCString(""),module_basename_fixed);
script_fspec.SetFile(path_string.GetData(), true);
if (!script_fspec.Exists())
script_fspec.Clear();
@@ -96,7 +114,7 @@
// we are going to be in foo.framework/Versions/X/foo
path_string.Clear();
// let's go to foo.framework/Versions/X/Resources/Python/foo.py
- path_string.Printf("%s/Resources/Python/%s.py",module_directory,module_basename);
+ path_string.Printf("%s/Resources/Python/%s.py",module_directory,module_basename_fixed);
script_fspec.SetFile(path_string.GetData(), true);
if (!script_fspec.Exists())
script_fspec.Clear();
More information about the lldb-commits
mailing list