diff options
| author | Greg Clayton <gclayton@apple.com> | 2010-10-20 20:54:39 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2010-10-20 20:54:39 +0000 |
| commit | 274060b6f110c6023fc63e4803d120949750867f (patch) | |
| tree | 30a22eb4bc4585b04aed031edc1e77b6874a0156 /lldb/source/Commands/CommandObjectBreakpoint.cpp | |
| parent | 6b4120915e47fe01a4ad398cdd3f0ba19944a4b4 (diff) | |
| download | llvm-274060b6f110c6023fc63e4803d120949750867f.zip llvm-274060b6f110c6023fc63e4803d120949750867f.tar.gz llvm-274060b6f110c6023fc63e4803d120949750867f.tar.bz2 | |
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.
llvm-svn: 116944
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
| -rw-r--r-- | lldb/source/Commands/CommandObjectBreakpoint.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index c642ae5..55e83fe 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -307,7 +307,7 @@ CommandObjectBreakpointSet::Execute ModuleSP module_sp = target->GetExecutableModule(); Breakpoint *bp = NULL; - FileSpec module; + FileSpec module_spec; bool use_module = false; int num_modules = m_options.m_modules.size(); @@ -354,15 +354,15 @@ CommandObjectBreakpointSet::Execute } else { - file.SetFile(m_options.m_filename.c_str()); + file.SetFile(m_options.m_filename.c_str(), false); } if (use_module) { for (int i = 0; i < num_modules; ++i) { - module.SetFile(m_options.m_modules[i].c_str()); - bp = target->CreateBreakpoint (&module, + module_spec.SetFile(m_options.m_modules[i].c_str(), false); + bp = target->CreateBreakpoint (&module_spec, file, m_options.m_line_num, m_options.m_ignore_inlines).get(); @@ -405,8 +405,11 @@ CommandObjectBreakpointSet::Execute { for (int i = 0; i < num_modules; ++i) { - module.SetFile(m_options.m_modules[i].c_str()); - bp = target->CreateBreakpoint (&module, m_options.m_func_name.c_str(), name_type_mask, Breakpoint::Exact).get(); + module_spec.SetFile(m_options.m_modules[i].c_str(), false); + bp = target->CreateBreakpoint (&module_spec, + m_options.m_func_name.c_str(), + name_type_mask, + Breakpoint::Exact).get(); if (bp) { StreamString &output_stream = result.GetOutputStream(); @@ -435,8 +438,8 @@ CommandObjectBreakpointSet::Execute { for (int i = 0; i < num_modules; ++i) { - module.SetFile(m_options.m_modules[i].c_str()); - bp = target->CreateBreakpoint (&module, regexp).get(); + module_spec.SetFile(m_options.m_modules[i].c_str(), false); + bp = target->CreateBreakpoint (&module_spec, regexp).get(); if (bp) { StreamString &output_stream = result.GetOutputStream(); |
