Fixed an issue where we were resolving paths when we should have been.
So the issue here was that we have lldb_private::FileSpec that by default was
always resolving a path when using the:
FileSpec::FileSpec (const char *path);
and in the:
void FileSpec::SetFile(const char *pathname, bool resolve = true);
This isn't what we want in many many cases. One example is you have "/tmp" on
your file system which is really "/private/tmp". You compile code in that
directory and end up with debug info that mentions "/tmp/file.c". Then you
type:
(lldb) breakpoint set --file file.c --line 5
If your current working directory is "/tmp", then "file.c" would be turned
into "/private/tmp/file.c" which won't match anything in the debug info.
Also, it should have been just a FileSpec with no directory and a filename
of "file.c" which could (and should) potentially match any instances of "file.c"
in the debug info.
So I removed the constructor that just takes a path:
FileSpec::FileSpec (const char *path); // REMOVED
You must now use the other constructor that has a "bool resolve" parameter that you must always supply:
FileSpec::FileSpec (const char *path, bool resolve);
I also removed the default parameter to SetFile():
void FileSpec::SetFile(const char *pathname, bool resolve);
And fixed all of the code to use the right settings.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116944 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 6a68e3b..1c0f79d 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -381,7 +381,7 @@
if (m_opaque_sp)
{
ArchSpec arch;
- FileSpec file_spec (filename);
+ FileSpec file_spec (filename, true);
arch.SetArchFromTargetTriple(target_triple);
TargetSP target_sp;
Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
@@ -396,7 +396,7 @@
SBTarget target;
if (m_opaque_sp)
{
- FileSpec file (filename);
+ FileSpec file (filename, true);
ArchSpec arch = lldb_private::Target::GetDefaultArchitecture ();
TargetSP target_sp;
Error error;
@@ -439,7 +439,7 @@
SBTarget target;
if (m_opaque_sp)
{
- FileSpec file (filename);
+ FileSpec file (filename, true);
ArchSpec arch = lldb_private::Target::GetDefaultArchitecture ();
TargetSP target_sp;
Error error;
@@ -495,7 +495,7 @@
ArchSpec arch;
if (arch_name)
arch.SetArch(arch_name);
- TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename), arch_name ? &arch : NULL));
+ TargetSP target_sp (m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture (FileSpec(filename, false), arch_name ? &arch : NULL));
sb_target.reset(target_sp);
}
return sb_target;
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 36fcf1b..fb504f2 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -28,8 +28,14 @@
m_opaque_ap.reset (new FileSpec (rhs.get()));
}
+// Deprected!!!
SBFileSpec::SBFileSpec (const char *path) :
- m_opaque_ap(new FileSpec (path))
+ m_opaque_ap(new FileSpec (path, true))
+{
+}
+
+SBFileSpec::SBFileSpec (const char *path, bool resolve) :
+ m_opaque_ap(new FileSpec (path, resolve))
{
}
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index fa64cba..9b78220 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -355,7 +355,7 @@
{
if (module_name && module_name[0])
{
- FileSpec module_file_spec(module_name);
+ FileSpec module_file_spec(module_name, false);
*sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, symbol_name, eFunctionNameTypeFull | eFunctionNameTypeBase, false);
}
else
@@ -376,7 +376,7 @@
if (module_name && module_name[0])
{
- FileSpec module_file_spec(module_name);
+ FileSpec module_file_spec(module_name, false);
*sb_bp = m_opaque_sp->CreateBreakpoint (&module_file_spec, regexp, false);
}
@@ -523,7 +523,7 @@
ModuleSP module_sp;
if (module_name != NULL)
{
- FileSpec module_file_spec (module_name);
+ FileSpec module_file_spec (module_name, false);
module_sp = m_opaque_sp->GetImages().FindFirstModuleForFileSpec (module_file_spec, NULL);
}
@@ -602,7 +602,7 @@
ModuleSP module_sp;
if (module_name != NULL)
{
- FileSpec module_file_spec (module_name);
+ FileSpec module_file_spec (module_name, false);
module_sp = m_opaque_sp->GetImages().FindFirstModuleForFileSpec (module_file_spec, NULL);
}