Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This

will allow us to represent a process/thread ID using a pointer for the OS
plug-ins where they might want to represent the process or thread ID using
the address of the process or thread structure.

llvm-svn: 145644
This commit is contained in:
Greg Clayton
2011-12-01 23:28:38 +00:00
parent 576c0f8e54
commit 61e7a58c0c
17 changed files with 47 additions and 47 deletions

View File

@@ -69,7 +69,7 @@ public:
FindThreadByID (lldb::tid_t tid, bool can_update = true);
lldb::ThreadSP
FindThreadByIndexID (lldb::tid_t index_id, bool can_update = true);
FindThreadByIndexID (uint32_t index_id, bool can_update = true);
lldb::ThreadSP
GetThreadSPForThreadPtr (Thread *thread_ptr);

View File

@@ -92,7 +92,7 @@ public:
/// than zero, or -1 if the fork fails.
/// @li \b Child process: zero.
//------------------------------------------------------------------
pid_t
lldb::pid_t
Fork (char *error_str, size_t error_len);
//------------------------------------------------------------------

View File

@@ -97,8 +97,8 @@ namespace lldb
{
typedef uint64_t addr_t;
typedef uint64_t user_id_t;
typedef int32_t pid_t;
typedef uint32_t tid_t;
typedef uint64_t pid_t;
typedef uint64_t tid_t;
typedef int32_t break_id_t;
typedef int32_t watch_id_t;
typedef void * clang_type_t;

View File

@@ -316,7 +316,7 @@ SBBreakpoint::SetThreadID (tid_t tid)
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid);
log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4llx)", m_opaque_sp.get(), tid);
}
@@ -332,7 +332,7 @@ SBBreakpoint::GetThreadID ()
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid);
log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4llx", m_opaque_sp.get(), tid);
return tid;
}

View File

@@ -187,7 +187,7 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
if (log) {
SBStream sstr;
error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%d) => SBError (%p): %s", m_opaque_sp.get(), pid, error.get(), sstr.GetData());
log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%llu) => SBError (%p): %s", m_opaque_sp.get(), pid, error.get(), sstr.GetData());
}
return error.Success();
@@ -459,7 +459,7 @@ SBProcess::GetProcessID ()
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val);
log->Printf ("SBProcess(%p)::GetProcessID () => %llu", m_opaque_sp.get(), ret_val);
return ret_val;
}
@@ -662,7 +662,7 @@ SBProcess::GetThreadByID (tid_t tid)
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4x) => SBThread (%p)",
log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4llx) => SBThread (%p)",
m_opaque_sp.get(),
tid,
sb_thread.get());

View File

@@ -333,7 +333,7 @@ SBThread::GetThreadID () const
tid = m_opaque_sp->GetID();
if (log)
log->Printf ("SBThread(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid);
log->Printf ("SBThread(%p)::GetThreadID () => 0x%4.4llx", m_opaque_sp.get(), tid);
return tid;
}

View File

@@ -412,7 +412,7 @@ BreakpointLocation::Dump(Stream *s) const
if (s == NULL)
return;
s->Printf("BreakpointLocation %u: tid = %4.4x load addr = 0x%8.8llx state = %s type = %s breakpoint "
s->Printf("BreakpointLocation %u: tid = %4.4llx load addr = 0x%8.8llx state = %s type = %s breakpoint "
"hw_index = %i hit_count = %-4u ignore_count = %-4u",
GetID(),
GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),

View File

@@ -512,7 +512,7 @@ public:
}
else
{
result.AppendErrorWithFormat ("no process found with pid = %i\n", pid);
result.AppendErrorWithFormat ("no process found with pid = %llu\n", pid);
result.SetStatus (eReturnStatusFailed);
}
}
@@ -796,12 +796,12 @@ public:
ProcessInstanceInfo proc_info;
if (platform_sp->GetProcessInfo (pid, proc_info))
{
ostrm.Printf ("Process information for process %i:\n", pid);
ostrm.Printf ("Process information for process %llu:\n", pid);
proc_info.Dump (ostrm, platform_sp.get());
}
else
{
ostrm.Printf ("error: no process information is available for process %i\n", pid);
ostrm.Printf ("error: no process information is available for process %llu\n", pid);
}
ostrm.EOL();
}

View File

@@ -85,7 +85,7 @@ DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bo
show_process_status = StateIsStoppedState(state, true);
const char *state_cstr = StateAsCString (state);
if (pid != LLDB_INVALID_PROCESS_ID)
strm.Printf ("%spid=%i", properties++ > 0 ? ", " : " ( ", pid);
strm.Printf ("%spid=%llu", properties++ > 0 ? ", " : " ( ", pid);
strm.Printf ("%sstate=%s", properties++ > 0 ? ", " : " ( ", state_cstr);
}
if (properties > 0)

View File

@@ -105,7 +105,7 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args)
// Add the process and thread if requested
if (m_options.Test (LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD))
header.Printf ("[%4.4x/%4.4x]: ", getpid(), Host::GetCurrentThreadID());
header.Printf ("[%4.4x/%4.4llx]: ", getpid(), Host::GetCurrentThreadID());
// Add the process and thread if requested
if (m_options.Test (LLDB_LOG_OPTION_PREPEND_THREAD_NAME))

View File

@@ -1306,7 +1306,7 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info)
}
#endif
lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
::pid_t pid = LLDB_INVALID_PROCESS_ID;
const char *tmp_argv[2];
char * const *argv = (char * const*)launch_info.GetArguments().GetConstArgumentVector();
char * const *envp = (char * const*)launch_info.GetEnvironmentEntries().GetConstArgumentVector();
@@ -1493,7 +1493,7 @@ Host::StartMonitoringChildProcess (Host::MonitorChildProcessCallback callback,
}
if (log)
log->Printf ("::waitpid (pid = %i, &status, 0) => pid = %i, status = 0x%8.8x (%s), signal = %i, exit_status = %i",
log->Printf ("::waitpid (pid = %llu, &status, 0) => pid = %i, status = 0x%8.8x (%s), signal = %i, exit_status = %i",
pid,
wait_pid,
status,

View File

@@ -1019,7 +1019,7 @@ GDBRemoteCommunicationClient::SendAttach
if (pid != LLDB_INVALID_PROCESS_ID)
{
char packet[64];
const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%x", pid);
const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%llx", pid);
assert (packet_len < sizeof(packet));
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
{
@@ -1334,7 +1334,7 @@ GDBRemoteCommunicationClient::GetProcessInfo (lldb::pid_t pid, ProcessInstanceIn
if (m_supports_qProcessInfoPID)
{
char packet[32];
const int packet_len = ::snprintf (packet, sizeof (packet), "qProcessInfoPID:%i", pid);
const int packet_len = ::snprintf (packet, sizeof (packet), "qProcessInfoPID:%llu", pid);
assert (packet_len < sizeof(packet));
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse (packet, packet_len, response, false))
@@ -1404,9 +1404,9 @@ GDBRemoteCommunicationClient::FindProcesses (const ProcessInstanceInfoMatch &mat
}
if (match_info.GetProcessInfo().ProcessIDIsValid())
packet.Printf("pid:%u;",match_info.GetProcessInfo().GetProcessID());
packet.Printf("pid:%llu;",match_info.GetProcessInfo().GetProcessID());
if (match_info.GetProcessInfo().ParentProcessIDIsValid())
packet.Printf("parent_pid:%u;",match_info.GetProcessInfo().GetParentProcessID());
packet.Printf("parent_pid:%llu;",match_info.GetProcessInfo().GetParentProcessID());
if (match_info.GetProcessInfo().UserIDIsValid())
packet.Printf("uid:%u;",match_info.GetProcessInfo().GetUserID());
if (match_info.GetProcessInfo().GroupIDIsValid())

View File

@@ -275,7 +275,7 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
static void
CreateProcessInfoResponse (const ProcessInstanceInfo &proc_info, StreamString &response)
{
response.Printf ("pid:%i;ppid:%i;uid:%i;gid:%i;euid:%i;egid:%i;",
response.Printf ("pid:%llu;ppid:%llu;uid:%i;gid:%i;euid:%i;egid:%i;",
proc_info.GetProcessID(),
proc_info.GetParentProcessID(),
proc_info.GetUserID(),
@@ -641,7 +641,7 @@ GDBRemoteCommunicationServer::Handle_qC (StringExtractorGDBRemote &packet)
{
lldb::pid_t pid = m_process_launch_info.GetProcessID();
StreamString response;
response.Printf("QC%x", pid);
response.Printf("QC%llx", pid);
if (m_is_platform)
{
// If we launch a process and this GDB server is acting as a platform,
@@ -707,7 +707,7 @@ GDBRemoteCommunicationServer::Handle_qLaunchGDBServer (StringExtractorGDBRemote
{
uint16_t port = (intptr_t)accept_thread_result;
char response[256];
const int response_len = ::snprintf (response, sizeof(response), "pid:%u;port:%u;", debugserver_pid, port);
const int response_len = ::snprintf (response, sizeof(response), "pid:%llu;port:%u;", debugserver_pid, port);
assert (response_len < sizeof(response));
//m_port_to_pid_map[port] = debugserver_launch_info.GetProcessID();
success = SendPacket (response, response_len) > 0;

View File

@@ -408,10 +408,10 @@ ProcessGDBRemote::DoConnectRemote (const char *remote_url)
SetPrivateState (state);
}
else
error.SetErrorStringWithFormat ("Process %i was reported after connecting to '%s', but state was not stopped: %s", pid, remote_url, StateAsCString (state));
error.SetErrorStringWithFormat ("Process %llu was reported after connecting to '%s', but state was not stopped: %s", pid, remote_url, StateAsCString (state));
}
else
error.SetErrorStringWithFormat ("Process %i was reported after connecting to '%s', but no stop reply packet was received", pid, remote_url);
error.SetErrorStringWithFormat ("Process %llu was reported after connecting to '%s', but no stop reply packet was received", pid, remote_url);
}
return error;
}
@@ -772,7 +772,7 @@ ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid)
if (error.Success())
{
char packet[64];
const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%x", attach_pid);
const int packet_len = ::snprintf (packet, sizeof(packet), "vAttach;%llx", attach_pid);
SetID (attach_pid);
m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (packet, packet_len));
}
@@ -890,7 +890,7 @@ ProcessGDBRemote::DoResume ()
if (m_gdb_comm.GetVContSupported ('c'))
{
for (tid_collection::const_iterator t_pos = m_continue_c_tids.begin(), t_end = m_continue_c_tids.end(); t_pos != t_end; ++t_pos)
continue_packet.Printf(";c:%4.4x", *t_pos);
continue_packet.Printf(";c:%4.4llx", *t_pos);
}
else
continue_packet_error = true;
@@ -901,7 +901,7 @@ ProcessGDBRemote::DoResume ()
if (m_gdb_comm.GetVContSupported ('C'))
{
for (tid_sig_collection::const_iterator s_pos = m_continue_C_tids.begin(), s_end = m_continue_C_tids.end(); s_pos != s_end; ++s_pos)
continue_packet.Printf(";C%2.2x:%4.4x", s_pos->second, s_pos->first);
continue_packet.Printf(";C%2.2x:%4.4llx", s_pos->second, s_pos->first);
}
else
continue_packet_error = true;
@@ -912,7 +912,7 @@ ProcessGDBRemote::DoResume ()
if (m_gdb_comm.GetVContSupported ('s'))
{
for (tid_collection::const_iterator t_pos = m_continue_s_tids.begin(), t_end = m_continue_s_tids.end(); t_pos != t_end; ++t_pos)
continue_packet.Printf(";s:%4.4x", *t_pos);
continue_packet.Printf(";s:%4.4llx", *t_pos);
}
else
continue_packet_error = true;
@@ -923,7 +923,7 @@ ProcessGDBRemote::DoResume ()
if (m_gdb_comm.GetVContSupported ('S'))
{
for (tid_sig_collection::const_iterator s_pos = m_continue_S_tids.begin(), s_end = m_continue_S_tids.end(); s_pos != s_end; ++s_pos)
continue_packet.Printf(";S%2.2x:%4.4x", s_pos->second, s_pos->first);
continue_packet.Printf(";S%2.2x:%4.4llx", s_pos->second, s_pos->first);
}
else
continue_packet_error = true;
@@ -2131,7 +2131,7 @@ ProcessGDBRemote::StartDebugserverProcess (const char *debugserver_url) // Th
m_debugserver_pid = LLDB_INVALID_PROCESS_ID;
if (error.Fail() || log)
error.PutToLog(log.get(), "Host::LaunchProcess (launch_info) => pid=%i, path='%s'", m_debugserver_pid, debugserver_path);
error.PutToLog(log.get(), "Host::LaunchProcess (launch_info) => pid=%llu, path='%s'", m_debugserver_pid, debugserver_path);
}
else
{
@@ -2176,7 +2176,7 @@ ProcessGDBRemote::MonitorDebugserverProcess
TargetSP target_sp (Debugger::FindTargetWithProcess(process));
if (log)
log->Printf ("ProcessGDBRemote::MonitorDebugserverProcess (baton=%p, pid=%i, signo=%i (0x%x), exit_status=%i)", callback_baton, debugserver_pid, signo, signo, exit_status);
log->Printf ("ProcessGDBRemote::MonitorDebugserverProcess (baton=%p, pid=%llu, signo=%i (0x%x), exit_status=%i)", callback_baton, debugserver_pid, signo, signo, exit_status);
if (target_sp)
{

View File

@@ -45,10 +45,10 @@ ProcessInstanceInfo::Dump (Stream &s, Platform *platform) const
{
const char *cstr;
if (m_pid != LLDB_INVALID_PROCESS_ID)
s.Printf (" pid = %i\n", m_pid);
s.Printf (" pid = %llu\n", m_pid);
if (m_parent_pid != LLDB_INVALID_PROCESS_ID)
s.Printf (" parent = %i\n", m_parent_pid);
s.Printf (" parent = %llu\n", m_parent_pid);
if (m_executable)
{
@@ -135,7 +135,7 @@ ProcessInstanceInfo::DumpAsTableRow (Stream &s, Platform *platform, bool show_ar
if (m_pid != LLDB_INVALID_PROCESS_ID)
{
const char *cstr;
s.Printf ("%-6u %-6u ", m_pid, m_parent_pid);
s.Printf ("%-6llu %-6llu ", m_pid, m_parent_pid);
if (verbose)
@@ -1163,7 +1163,7 @@ Process::SetProcessExitStatus (void *callback_baton,
{
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::SetProcessExitStatus (baton=%p, pid=%i, exited=%i, signal=%i, exit_status=%i)\n",
log->Printf ("Process::SetProcessExitStatus (baton=%p, pid=%llu, exited=%i, signal=%i, exit_status=%i)\n",
callback_baton,
pid,
exited,
@@ -3208,8 +3208,8 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr)
if (m_state == eStateStopped && ! m_restarted)
{
ThreadList &curr_thread_list = m_process_sp->GetThreadList();
int num_threads = curr_thread_list.GetSize();
int idx;
uint32_t num_threads = curr_thread_list.GetSize();
uint32_t idx;
// The actions might change one of the thread's stop_info's opinions about whether we should
// stop the process, so we need to query that as we go.
@@ -3219,7 +3219,7 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr)
// that would cause our iteration here to crash. We could make a copy of the thread list, but we'd really like
// to also know if it has changed at all, so we make up a vector of the thread ID's and check what we get back
// against this list & bag out if anything differs.
std::vector<lldb::tid_t> thread_index_array(num_threads);
std::vector<uint32_t> thread_index_array(num_threads);
for (idx = 0; idx < num_threads; ++idx)
thread_index_array[idx] = curr_thread_list.GetThreadAtIndex(idx)->GetIndexID();
@@ -3232,7 +3232,7 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr)
{
lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("Number of threads changed from %d to %d while processing event.", num_threads, curr_thread_list.GetSize());
log->Printf("Number of threads changed from %u to %u while processing event.", num_threads, curr_thread_list.GetSize());
break;
}
@@ -3242,7 +3242,7 @@ Process::ProcessEventData::DoOnRemoval (Event *event_ptr)
{
lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("The thread at position %d changed from %d to %d while processing event.",
log->Printf("The thread at position %u changed from %u to %u while processing event.",
idx,
thread_index_array[idx],
thread_sp->GetIndexID());

View File

@@ -104,7 +104,7 @@ ThreadSpec::GetDescription (Stream *s, lldb::DescriptionLevel level) const
else
{
if (GetTID() != LLDB_INVALID_THREAD_ID)
s->Printf("tid: 0x%x ", GetTID());
s->Printf("tid: 0x%llx ", GetTID());
if (GetIndex() != UINT32_MAX)
s->Printf("index: %d ", GetIndex());

View File

@@ -865,7 +865,7 @@ Driver::HandleProcessEvent (const SBEvent &event)
case eStateDetached:
{
char message[1024];
int message_len = ::snprintf (message, sizeof(message), "Process %d %s\n", process.GetProcessID(),
int message_len = ::snprintf (message, sizeof(message), "Process %llu %s\n", process.GetProcessID(),
m_debugger.StateAsCString (event_state));
m_io_channel_ap->OutWrite(message, message_len, ASYNC);
}
@@ -892,7 +892,7 @@ Driver::HandleProcessEvent (const SBEvent &event)
{
// FIXME: Do we want to report this, or would that just be annoyingly chatty?
char message[1024];
int message_len = ::snprintf (message, sizeof(message), "Process %d stopped and was programmatically restarted.\n",
int message_len = ::snprintf (message, sizeof(message), "Process %llu stopped and was programmatically restarted.\n",
process.GetProcessID());
m_io_channel_ap->OutWrite(message, message_len, ASYNC);
}
@@ -1293,7 +1293,7 @@ Driver::MainLoop ()
{
command_str.append("-p ");
char pid_buffer[32];
::snprintf (pid_buffer, sizeof(pid_buffer), "%d", m_option_data.m_process_pid);
::snprintf (pid_buffer, sizeof(pid_buffer), "%llu", m_option_data.m_process_pid);
command_str.append(pid_buffer);
}
else