forked from OSchip/llvm-project
Fix TestNamespace and TestThreadJump for remote Windows to Android.
Summary: Update DYLDRendezvous and SOEntry to use FileSpecs instead of storing paths as strings, which caused incorrect comparison results due to denormalization. Reviewers: clayborg, vharron, ovyalov Reviewed By: ovyalov Subscribers: jwolfe, emaste, tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D10267 llvm-svn: 239195
This commit is contained in:
parent
56df435693
commit
55c1c3495d
|
@ -120,9 +120,10 @@ DYLDRendezvous::DYLDRendezvous(Process *process)
|
||||||
Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer();
|
Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer();
|
||||||
if (exe_mod)
|
if (exe_mod)
|
||||||
{
|
{
|
||||||
exe_mod->GetPlatformFileSpec().GetPath(m_exe_path, PATH_MAX);
|
m_exe_file_spec = exe_mod->GetPlatformFileSpec();
|
||||||
if (log)
|
if (log)
|
||||||
log->Printf ("DYLDRendezvous::%s exe module executable path set: '%s'", __FUNCTION__, m_exe_path);
|
log->Printf ("DYLDRendezvous::%s exe module executable path set: '%s'",
|
||||||
|
__FUNCTION__, m_exe_file_spec.GetCString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -294,13 +295,13 @@ DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry)
|
||||||
|
|
||||||
switch (os_type) {
|
switch (os_type) {
|
||||||
case llvm::Triple::FreeBSD:
|
case llvm::Triple::FreeBSD:
|
||||||
return ::strcmp(entry.path.c_str(), m_exe_path) == 0;
|
return entry.file_spec == m_exe_file_spec;
|
||||||
case llvm::Triple::Linux:
|
case llvm::Triple::Linux:
|
||||||
switch (env_type) {
|
switch (env_type) {
|
||||||
case llvm::Triple::Android:
|
case llvm::Triple::Android:
|
||||||
return ::strcmp(entry.path.c_str(), m_exe_path) == 0;
|
return entry.file_spec == m_exe_file_spec;
|
||||||
default:
|
default:
|
||||||
return entry.path.empty();
|
return !entry.file_spec;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -405,9 +406,9 @@ DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry)
|
||||||
|
|
||||||
if (!(addr = ReadPointer(addr, &entry.prev)))
|
if (!(addr = ReadPointer(addr, &entry.prev)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
entry.path = ReadStringFromMemory(entry.path_addr);
|
entry.file_spec.SetFile(ReadStringFromMemory(entry.path_addr), false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +484,7 @@ DYLDRendezvous::DumpToLog(Log *log) const
|
||||||
|
|
||||||
for (int i = 1; I != E; ++I, ++i)
|
for (int i = 1; I != E; ++I, ++i)
|
||||||
{
|
{
|
||||||
log->Printf("\n SOEntry [%d] %s", i, I->path.c_str());
|
log->Printf("\n SOEntry [%d] %s", i, I->file_spec.GetCString());
|
||||||
log->Printf(" Base : %" PRIx64, I->base_addr);
|
log->Printf(" Base : %" PRIx64, I->base_addr);
|
||||||
log->Printf(" Path : %" PRIx64, I->path_addr);
|
log->Printf(" Path : %" PRIx64, I->path_addr);
|
||||||
log->Printf(" Dyn : %" PRIx64, I->dyn_addr);
|
log->Printf(" Dyn : %" PRIx64, I->dyn_addr);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
// Other libraries and framework includes
|
// Other libraries and framework includes
|
||||||
#include "lldb/lldb-defines.h"
|
#include "lldb/lldb-defines.h"
|
||||||
#include "lldb/lldb-types.h"
|
#include "lldb/lldb-types.h"
|
||||||
|
#include "lldb/Host/FileSpec.h"
|
||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
class Process;
|
class Process;
|
||||||
|
@ -142,18 +143,18 @@ public:
|
||||||
/// This object is a rough analogue to the struct link_map object which
|
/// This object is a rough analogue to the struct link_map object which
|
||||||
/// actually lives in the inferiors memory.
|
/// actually lives in the inferiors memory.
|
||||||
struct SOEntry {
|
struct SOEntry {
|
||||||
lldb::addr_t link_addr; ///< Address of this link_map.
|
lldb::addr_t link_addr; ///< Address of this link_map.
|
||||||
lldb::addr_t base_addr; ///< Base address of the loaded object.
|
lldb::addr_t base_addr; ///< Base address of the loaded object.
|
||||||
lldb::addr_t path_addr; ///< String naming the shared object.
|
lldb::addr_t path_addr; ///< String naming the shared object.
|
||||||
lldb::addr_t dyn_addr; ///< Dynamic section of shared object.
|
lldb::addr_t dyn_addr; ///< Dynamic section of shared object.
|
||||||
lldb::addr_t next; ///< Address of next so_entry.
|
lldb::addr_t next; ///< Address of next so_entry.
|
||||||
lldb::addr_t prev; ///< Address of previous so_entry.
|
lldb::addr_t prev; ///< Address of previous so_entry.
|
||||||
std::string path; ///< File name of shared object.
|
lldb_private::FileSpec file_spec; ///< File spec of shared object.
|
||||||
|
|
||||||
SOEntry() { clear(); }
|
SOEntry() { clear(); }
|
||||||
|
|
||||||
bool operator ==(const SOEntry &entry) {
|
bool operator ==(const SOEntry &entry) {
|
||||||
return this->path == entry.path;
|
return file_spec == entry.file_spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
@ -163,7 +164,7 @@ public:
|
||||||
dyn_addr = 0;
|
dyn_addr = 0;
|
||||||
next = 0;
|
next = 0;
|
||||||
prev = 0;
|
prev = 0;
|
||||||
path.clear();
|
file_spec.Clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -190,8 +191,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
lldb_private::Process *m_process;
|
lldb_private::Process *m_process;
|
||||||
|
|
||||||
// Cached copy of executable pathname
|
// Cached copy of executable file spec
|
||||||
char m_exe_path[PATH_MAX];
|
lldb_private::FileSpec m_exe_file_spec;
|
||||||
|
|
||||||
/// Location of the r_debug structure in the inferiors address space.
|
/// Location of the r_debug structure in the inferiors address space.
|
||||||
lldb::addr_t m_rendezvous_addr;
|
lldb::addr_t m_rendezvous_addr;
|
||||||
|
|
|
@ -414,8 +414,7 @@ DynamicLoaderPOSIXDYLD::RefreshModules()
|
||||||
E = m_rendezvous.loaded_end();
|
E = m_rendezvous.loaded_end();
|
||||||
for (I = m_rendezvous.loaded_begin(); I != E; ++I)
|
for (I = m_rendezvous.loaded_begin(); I != E; ++I)
|
||||||
{
|
{
|
||||||
FileSpec file(I->path.c_str(), true);
|
ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr);
|
||||||
ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr);
|
|
||||||
if (module_sp.get())
|
if (module_sp.get())
|
||||||
{
|
{
|
||||||
loaded_modules.AppendIfNeeded(module_sp);
|
loaded_modules.AppendIfNeeded(module_sp);
|
||||||
|
@ -432,9 +431,8 @@ DynamicLoaderPOSIXDYLD::RefreshModules()
|
||||||
E = m_rendezvous.unloaded_end();
|
E = m_rendezvous.unloaded_end();
|
||||||
for (I = m_rendezvous.unloaded_begin(); I != E; ++I)
|
for (I = m_rendezvous.unloaded_begin(); I != E; ++I)
|
||||||
{
|
{
|
||||||
FileSpec file(I->path.c_str(), true);
|
ModuleSpec module_spec{I->file_spec};
|
||||||
ModuleSpec module_spec (file);
|
ModuleSP module_sp =
|
||||||
ModuleSP module_sp =
|
|
||||||
loaded_modules.FindFirstModule (module_spec);
|
loaded_modules.FindFirstModule (module_spec);
|
||||||
|
|
||||||
if (module_sp.get())
|
if (module_sp.get())
|
||||||
|
@ -525,9 +523,7 @@ DynamicLoaderPOSIXDYLD::LoadAllCurrentModules()
|
||||||
|
|
||||||
for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
|
for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I)
|
||||||
{
|
{
|
||||||
const char *module_path = I->path.c_str();
|
ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr);
|
||||||
FileSpec file(module_path, false);
|
|
||||||
ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr);
|
|
||||||
if (module_sp.get())
|
if (module_sp.get())
|
||||||
{
|
{
|
||||||
module_list.Append(module_sp);
|
module_list.Append(module_sp);
|
||||||
|
@ -537,7 +533,7 @@ DynamicLoaderPOSIXDYLD::LoadAllCurrentModules()
|
||||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
|
||||||
if (log)
|
if (log)
|
||||||
log->Printf("DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
|
log->Printf("DynamicLoaderPOSIXDYLD::%s failed loading module %s at 0x%" PRIx64,
|
||||||
__FUNCTION__, module_path, I->base_addr);
|
__FUNCTION__, I->file_spec.GetCString(), I->base_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue