Split all of the core of LLDB.framework/lldb.so into a

static archive that can be linked against. LLDB.framework/lldb.so
exports a very controlled API. Splitting the API into a static
library allows other tools (debugserver for now) to use the power
of the LLDB debugger core, yet not export it as its API is not
portable or maintainable. The Host layer and many of the other
internal only APIs can now be statically linked against.

Now LLDB.framework/lldb.so links against "liblldb-core.a" instead
of compiling the .o files only for the shared library. This fix
is only for compiling with Xcode as the Makefile based build already
does this.

The Xcode projecdt compiler has been changed to LLVM. Anyone using
Xcode 3 will need to manually change the compiler back to GCC 4.2,
or update to Xcode 4.

llvm-svn: 127963
This commit is contained in:
Greg Clayton 2011-03-20 04:57:14 +00:00
parent 76c90c65e2
commit 7a5388bf75
15 changed files with 965 additions and 596 deletions

File diff suppressed because it is too large Load Diff

View File

@ -711,6 +711,8 @@ public:
case eFormatVectorOfFloat32:
case eFormatVectorOfFloat64:
case eFormatVectorOfUInt128:
case eFormatOSType:
case eFormatComplexInteger:
result.AppendError("unsupported format for writing memory");
result.SetStatus(eReturnStatusFailed);
return false;

View File

@ -419,6 +419,7 @@ Communication::ConnectionStatusAsCString (lldb::ConnectionStatus status)
case eConnectionStatusTimedOut: return "timed out";
case eConnectionStatusNoConnection: return "no connection";
case eConnectionStatusLostConnection: return "lost connection";
case eConnectionStatusEndOfFile: return "end of file";
}
static char unknown_state_string[64];

View File

@ -2291,6 +2291,10 @@ DWARFExpression::Evaluate
switch (source_value_type)
{
case Value::eValueTypeScalar:
case Value::eValueTypeFileAddress:
break;
case Value::eValueTypeLoadAddress:
switch (target_value_type)
{

View File

@ -232,7 +232,7 @@ CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result)
switch (state)
{
case eStateInvalid:
case eStateSuspended:
case eStateCrashed:
case eStateStopped:

View File

@ -10214,7 +10214,7 @@ EmulateInstructionARM::ReadCoreReg(uint32_t num, bool *success)
reg_num = LLDB_REGNUM_GENERIC_PC;
break;
default:
if (0 <= num && num < SP_REG)
if (num < SP_REG)
{
reg_kind = eRegisterKindDWARF;
reg_num = dwarf_r0 + num;
@ -10223,7 +10223,7 @@ EmulateInstructionARM::ReadCoreReg(uint32_t num, bool *success)
{
assert(0 && "Invalid register number");
*success = false;
return ~0u;
return UINT32_MAX;
}
break;
}

View File

@ -307,8 +307,7 @@ PlatformRemoteiOS::GetDeviceSupportDirectoryForOSVersion()
"%s/%i.%i",
m_device_support_directory_for_os_version.c_str(),
major,
minor,
update);
minor);
file_spec.SetFile(resolved_path, resolve_path);
if (file_spec.Exists() && file_spec.GetPath(resolved_path, sizeof(resolved_path)))

View File

@ -111,6 +111,10 @@ RegisterContextMacOSXFrameBackchain::ReadRegisterValue (uint32_t reg, Scalar &va
switch (reg_info->encoding)
{
case eEncodingInvalid:
case eEncodingVector:
break;
case eEncodingUint:
switch (reg_info->byte_size)
{

View File

@ -295,6 +295,9 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit
switch (exe_symbol->GetType())
{
default:
break;
case eSymbolTypeCode:
{
// For each N_FUN, or function that we run into in the debug map

View File

@ -124,6 +124,7 @@ Type::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name)
s->Printf(", type_uid = 0x%8.8x", m_encoding_uid);
switch (m_encoding_uid_type)
{
case eEncodingInvalid: break;
case eEncodingIsUID: s->PutCString(" (unresolved type)"); break;
case eEncodingIsConstUID: s->PutCString(" (unresolved const type)"); break;
case eEncodingIsRestrictUID: s->PutCString(" (unresolved restrict type)"); break;
@ -171,6 +172,7 @@ Type::Dump (Stream *s, bool show_context)
*s << ", type_data = " << (uint64_t)m_encoding_uid;
switch (m_encoding_uid_type)
{
case eEncodingInvalid: break;
case eEncodingIsUID: s->PutCString(" (unresolved type)"); break;
case eEncodingIsConstUID: s->PutCString(" (unresolved const type)"); break;
case eEncodingIsRestrictUID: s->PutCString(" (unresolved restrict type)"); break;
@ -269,6 +271,9 @@ Type::GetByteSize()
{
switch (m_encoding_uid_type)
{
case eEncodingInvalid:
case eEncodingIsSyntheticUID:
break;
case eEncodingIsUID:
case eEncodingIsConstUID:
case eEncodingIsRestrictUID:

View File

@ -1586,7 +1586,7 @@ Process::Launch
DidLaunch ();
m_dyld_ap.reset (DynamicLoader::FindPlugin(this, false));
m_dyld_ap.reset (DynamicLoader::FindPlugin(this, NULL));
if (m_dyld_ap.get())
m_dyld_ap->DidLaunch();
@ -1796,7 +1796,7 @@ Process::CompleteAttach ()
// We have complete the attach, now it is time to find the dynamic loader
// plug-in
m_dyld_ap.reset (DynamicLoader::FindPlugin(this, false));
m_dyld_ap.reset (DynamicLoader::FindPlugin(this, NULL));
if (m_dyld_ap.get())
m_dyld_ap->DidAttach();

View File

@ -285,6 +285,10 @@ RegisterContext::ReadRegisterValue (uint32_t reg, Scalar &value)
uint32_t offset = 0;
switch (reg_info->encoding)
{
case eEncodingInvalid:
case eEncodingVector:
break;
case eEncodingUint:
switch (reg_info->byte_size)
{

View File

@ -3351,4 +3351,102 @@ RNBRemote::HandlePacket_qHostInfo (const char *p)
strm << "ptrsize:" << std::dec << sizeof(void *) << ';';
return SendPacket (strm.str());
}
//
//struct ProcessInfo
//{
// nub_process_t pid;
// std::string name;
// std::string user;
// std::string group;
// uint32_t cpu; // mach-o cpu type
// uint32_t sub; // mach-o cpu subtype
//
// void
// Clear()
// {
// pid = 0;
// name.clear();
// user.clear();
// group.clear();
// cpu = 0;
// sub = 0;
// }
//};
//
//static bool
//GetMacOSXProcessName (ProcessInfo &proc_info,
// const char *name_match) // can be NULL
//{
// char process_name[MAXCOMLEN * 2 + 1];
// int name_len = ::proc_name(proc_info.pid, process_name, MAXCOMLEN * 2);
// if (name_len == 0)
// return false;
//
// if (name_match == NULL || strcmp (name_match, process_name) == 0)
// {
// proc_info.name.assign (process_name, name_len);
// return true;
// }
// proc_info.name.clear();
// return false;
//}
//
//
//static bool
//GetMacOSXProcessCPUType (ProcessInfo &proc_info)
//{
// // Make a new mib to stay thread safe
// int mib[CTL_MAXNAME]={0,};
// size_t mib_len = CTL_MAXNAME;
// if (::sysctlnametomib("sysctl.proc_cputype", mib, &mib_len))
// return false;
//
// mib[mib_len] = proc_info.pid;
// mib_len++;
//
// cpu_type_t cpu = 0;
// cpu_type_t sub = 0;
// size_t cpu_len = sizeof(cpu);
// if (::sysctl (mib, mib_len, &cpu, &cpu_len, 0, 0) == 0)
// {
// switch (cpu)
// {
// case llvm::MachO::CPUTypeI386: sub = llvm::MachO::CPUSubType_I386_ALL; break;
// case llvm::MachO::CPUTypeX86_64: sub = llvm::MachO::CPUSubType_X86_64_ALL; break;
// default: break;
// }
// proc_info.cpu = cpu;
// proc_info.sub = sub;
// return true;
// }
// proc_info.cpu = 0;
// proc_info.sub = 0;
// return false;
//}
rnb_err_t
RNBRemote::HandlePacket_qProcessInfo (const char *p)
{
return RNBRemote::HandlePacket_UNIMPLEMENTED (p);
}
rnb_err_t
RNBRemote::HandlePacket_qfProcessInfoAll (const char *p)
{
return RNBRemote::HandlePacket_UNIMPLEMENTED (p);
}
rnb_err_t
RNBRemote::HandlePacket_qfProcessInfoName (const char *p)
{
return RNBRemote::HandlePacket_UNIMPLEMENTED (p);
}
rnb_err_t
RNBRemote::HandlePacket_qsProcessInfo (const char *p)
{
return RNBRemote::HandlePacket_UNIMPLEMENTED (p);
}

View File

@ -91,6 +91,10 @@ public:
query_shlib_notify_info_addr, // 'qShlibInfoAddr'
query_step_packet_supported, // 'qStepPacketSupported'
query_host_info, // 'qHostInfo'
platform_proc_info_for_pid, // 'qProcessInfo:<PID>' -- get process info for process by ID
platform_proc_info_first_all, // 'qfProcessInfoAll' -- list all processes
platform_proc_info_first_name, // 'qfProcessInfoName:<HEXNAME>' -- list all processes that match "name"
platform_proc_info_subsequent, // 'qsProcessInfo' -- get subsequent matches for 'qfProcessInfo*' queries
pass_signals_to_inferior, // 'QPassSignals'
start_noack_mode, // 'QStartNoAckMode'
prefix_reg_packets_with_tid, // 'QPrefixRegisterPacketsWithThreadID
@ -161,6 +165,10 @@ public:
rnb_err_t HandlePacket_qThreadExtraInfo (const char *p);
rnb_err_t HandlePacket_qThreadStopInfo (const char *p);
rnb_err_t HandlePacket_qHostInfo (const char *p);
rnb_err_t HandlePacket_qProcessInfo (const char *p);
rnb_err_t HandlePacket_qfProcessInfoAll (const char *p);
rnb_err_t HandlePacket_qfProcessInfoName (const char *p);
rnb_err_t HandlePacket_qsProcessInfo (const char *p);
rnb_err_t HandlePacket_QStartNoAckMode (const char *p);
rnb_err_t HandlePacket_QThreadSuffixSupported (const char *p);
rnb_err_t HandlePacket_QSetLogging (const char *p);
@ -227,6 +235,18 @@ protected:
HandlePacketCallback async; // Function to call when inferior is running
std::string abbrev;
std::string printable_name;
bool
IsPlatformPacket () const
{
switch (type)
{
case set_logging_mode:
case query_host_info:
return true;
}
return false;
}
Packet() :
type(invalid_packet),
normal (NULL),

View File

@ -42,6 +42,7 @@ typedef enum
eRNBRunLoopModeInferiorAttaching,
eRNBRunLoopModeInferiorLaunching,
eRNBRunLoopModeInferiorExecuting,
eRNBRunLoopModePlatformMode,
eRNBRunLoopModeExit
} RNBRunLoopMode;
@ -565,6 +566,40 @@ RNBRunLoopInferiorExecuting (RNBRemote *remote)
}
RNBRunLoopMode
RNBRunLoopPlatform (RNBRemote *remote)
{
RNBRunLoopMode mode = eRNBRunLoopModePlatformMode;
RNBContext& ctx = remote->Context();
while (mode == eRNBRunLoopModePlatformMode)
{
std::string set_events_str;
const uint32_t event_mask = RNBContext::event_read_packet_available |
RNBContext::event_read_thread_exiting;
DNBLogThreadedIf (LOG_RNB_EVENTS, "%s ctx.Events().WaitForSetEvents(0x%08x) ...",__FUNCTION__, event_mask);
nub_event_t set_events = ctx.Events().WaitForSetEvents(event_mask);
DNBLogThreadedIf (LOG_RNB_EVENTS, "%s ctx.Events().WaitForSetEvents(0x%08x) => 0x%08x (%s)",__FUNCTION__, event_mask, set_events, ctx.EventsAsString(set_events, set_events_str));
if (set_events)
{
if (set_events & RNBContext::event_read_packet_available)
{
if (remote->HandleReceivedPacket() == rnb_not_connected)
mode = eRNBRunLoopModeExit;
}
if (set_events & RNBContext::event_read_thread_exiting)
{
mode = eRNBRunLoopModeExit;
}
ctx.Events().ResetEvents(set_events);
}
}
return eRNBRunLoopModeExit;
}
//----------------------------------------------------------------------
// Convenience function to set up the remote listening port
// Returns 1 for success 0 for failure.
@ -670,6 +705,7 @@ static struct option g_long_options[] =
{ "setsid", no_argument, NULL, 'S' }, // call setsid() to make debugserver run in its own session
{ "disable-aslr", no_argument, NULL, 'D' }, // Use _POSIX_SPAWN_DISABLE_ASLR to avoid shared library randomization
{ "working-dir", required_argument, NULL, 'W' }, // The working directory that the inferior process should have (only if debugserver launches the process)
{ "platform", required_argument, NULL, 'p' }, // Put this executable into a remote platform mode
{ NULL, 0, NULL, 0 }
};
@ -924,6 +960,10 @@ main (int argc, char *argv[])
case 'D':
g_disable_aslr = 1;
break;
case 'p':
start_mode = eRNBRunLoopModePlatformMode;
break;
}
}
@ -1027,7 +1067,8 @@ main (int argc, char *argv[])
}
// If we know we're waiting to attach, we don't need any of this other info.
if (start_mode != eRNBRunLoopModeInferiorAttaching)
if (start_mode != eRNBRunLoopModeInferiorAttaching &&
start_mode != eRNBRunLoopModePlatformMode)
{
if (argc == 0 || g_lockdown_opt)
{
@ -1125,16 +1166,17 @@ main (int argc, char *argv[])
}
else
#endif
if (listen_port != INT32_MAX)
{
if (!StartListening (remote, listen_port))
mode = eRNBRunLoopModeExit;
}
else if (str[0] == '/')
{
if (remote->Comm().OpenFile (str))
mode = eRNBRunLoopModeExit;
}
if (listen_port != INT32_MAX)
{
if (!StartListening (remote, listen_port))
mode = eRNBRunLoopModeExit;
}
else if (str[0] == '/')
{
if (remote->Comm().OpenFile (str))
mode = eRNBRunLoopModeExit;
}
if (mode != eRNBRunLoopModeExit)
{
RNBLogSTDOUT ("Got a connection, waiting for process information for launching or attaching.\n");
@ -1286,6 +1328,22 @@ main (int argc, char *argv[])
mode = RNBRunLoopInferiorExecuting(remote);
break;
case eRNBRunLoopModePlatformMode:
if (listen_port != INT32_MAX)
{
if (!StartListening (remote, listen_port))
mode = eRNBRunLoopModeExit;
}
else if (str[0] == '/')
{
if (remote->Comm().OpenFile (str))
mode = eRNBRunLoopModeExit;
}
if (mode != eRNBRunLoopModeExit)
mode = RNBRunLoopPlatform (remote);
break;
default:
mode = eRNBRunLoopModeExit;
case eRNBRunLoopModeExit: