summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-05-25 17:04:00 +0000
committerGreg Clayton <gclayton@apple.com>2012-05-25 17:04:00 +0000
commitdebb88107981694c5e16ce6030180b1ed8c98fd1 (patch)
tree982339eb9e6a119bb255751288cdbad62cdfaf54 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parenta6da3ff896640b7bd3693748ee5685b0527483a0 (diff)
downloadbcm5719-llvm-debb88107981694c5e16ce6030180b1ed8c98fd1.tar.gz
bcm5719-llvm-debb88107981694c5e16ce6030180b1ed8c98fd1.zip
Fixed an issue where we might have easy access to the string table data for a mach file from memory even though we have a process. So now we don't read the string table strings from memory when we don't have to.
llvm-svn: 157482
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 418a93ccda6..ff643f4d283 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1359,21 +1359,25 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
- if (process)
+ const bool have_strtab_data = strtab_data.GetByteSize() > 0;
+ if (!have_strtab_data)
{
- if (strtab_addr == LLDB_INVALID_ADDRESS)
+ if (process)
+ {
+ if (strtab_addr == LLDB_INVALID_ADDRESS)
+ {
+ if (log)
+ module_sp->LogMessage(log.get(), "failed to locate the strtab in memory");
+ return 0;
+ }
+ }
+ else
{
if (log)
- module_sp->LogMessage(log.get(), "failed to locate the strtab in memory");
+ module_sp->LogMessage(log.get(), "failed to read strtab data");
return 0;
}
}
- else if (strtab_data.GetByteSize() == 0)
- {
- if (log)
- module_sp->LogMessage(log.get(), "failed to read strtab data");
- return 0;
- }
const ConstString &g_segment_name_TEXT = GetSegmentNameTEXT();
const ConstString &g_segment_name_DATA = GetSegmentNameDATA();
@@ -1449,14 +1453,7 @@ ObjectFileMachO::ParseSymtab (bool minimize)
SymbolType type = eSymbolTypeInvalid;
const char *symbol_name = NULL;
- if (process)
- {
- const addr_t str_addr = strtab_addr + nlist.n_strx;
- Error str_error;
- if (process->ReadCStringFromMemory(str_addr, memory_symbol_name, str_error))
- symbol_name = memory_symbol_name.c_str();
- }
- else
+ if (have_strtab_data)
{
symbol_name = strtab_data.PeekCStr(nlist.n_strx);
@@ -1476,6 +1473,13 @@ ObjectFileMachO::ParseSymtab (bool minimize)
if (symbol_name[0] == '\0')
symbol_name = NULL;
}
+ else
+ {
+ const addr_t str_addr = strtab_addr + nlist.n_strx;
+ Error str_error;
+ if (process->ReadCStringFromMemory(str_addr, memory_symbol_name, str_error))
+ symbol_name = memory_symbol_name.c_str();
+ }
const char *symbol_name_non_abi_mangled = NULL;
SectionSP symbol_section;
OpenPOWER on IntegriCloud