Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1a902ca

Browse files
author
Greg Clayton
committedMar 9, 2015
Fix debugserver warnings on MacOSX.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@231692 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 67d7ece commit 1a902ca

32 files changed

+194
-693
lines changed
 

‎tools/debugserver/source/DNB.cpp

Lines changed: 13 additions & 519 deletions
Large diffs are not rendered by default.

‎tools/debugserver/source/DNB.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,6 @@ const DNBRegisterSetInfo *
155155
DNBGetRegisterSetInfo (nub_size_t *num_reg_sets);
156156
nub_bool_t DNBGetRegisterInfoByName (const char *reg_name, DNBRegisterInfo* info);
157157

158-
//----------------------------------------------------------------------
159-
// Printf style formatting for printing values in the inferior memory
160-
// space and registers.
161-
//----------------------------------------------------------------------
162-
nub_size_t DNBPrintf (nub_process_t pid, nub_thread_t tid, nub_addr_t addr, FILE *file, const char *format);
163-
164158
//----------------------------------------------------------------------
165159
// Other static nub information calls.
166160
//----------------------------------------------------------------------

‎tools/debugserver/source/DNBArch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ class DNBArchProtocol
6868
{
6969

7070
}
71-
virtual bool GetRegisterValue (int set, int reg, DNBRegisterValue *value) = 0;
72-
virtual bool SetRegisterValue (int set, int reg, const DNBRegisterValue *value) = 0;
71+
virtual bool GetRegisterValue (uint32_t set, uint32_t reg, DNBRegisterValue *value) = 0;
72+
virtual bool SetRegisterValue (uint32_t set, uint32_t reg, const DNBRegisterValue *value) = 0;
7373
virtual nub_size_t GetRegisterContext (void *buf, nub_size_t buf_len) = 0;
7474
virtual nub_size_t SetRegisterContext (const void *buf, nub_size_t buf_len) = 0;
7575
virtual uint32_t SaveRegisterState () = 0;

‎tools/debugserver/source/DNBBreakpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#pragma mark -- DNBBreakpoint
2323
DNBBreakpoint::DNBBreakpoint(nub_addr_t addr, nub_size_t byte_size, bool hardware) :
2424
m_retain_count (1),
25-
m_byte_size (byte_size),
25+
m_byte_size (static_cast<uint32_t>(byte_size)),
2626
m_opcode(),
2727
m_addr(addr),
2828
m_enabled(0),

‎tools/debugserver/source/DNBDataRef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class DNBDataRef
5656
m_swap = false;
5757
}
5858

59-
offset_t BytesLeft (offset_t offset) const
59+
size_t BytesLeft (size_t offset) const
6060
{
61-
const offset_t size = GetSize();
61+
const size_t size = GetSize();
6262
if (size > offset)
6363
return size - offset;
6464
return 0;

‎tools/debugserver/source/DNBTimer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class DNBTimer
8383
}
8484

8585
void
86-
GetTime (uint32_t& sec, uint32_t& usec) const
86+
GetTime (uint64_t& sec, uint32_t& usec) const
8787
{
8888
PTHREAD_MUTEX_LOCKER (locker, m_mutexAP.get());
8989
sec = m_timeval.tv_sec;

‎tools/debugserver/source/MacOSX/Genealogy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Genealogy::GetActivities(pid_t pid, const MachThreadList &thread_list, task_t ta
271271
uint32_t
272272
Genealogy::AddProcessExecutableInfo (ProcessExecutableInfoSP process_exe_info)
273273
{
274-
const uint32_t info_size = m_process_executable_infos.size();
274+
const uint32_t info_size = static_cast<uint32_t>(m_process_executable_infos.size());
275275
for (uint32_t idx = 0; idx < info_size; ++idx)
276276
{
277277
if (uuid_compare (m_process_executable_infos[idx]->image_uuid, process_exe_info->image_uuid) == 0)
@@ -284,7 +284,7 @@ Genealogy::AddProcessExecutableInfo (ProcessExecutableInfoSP process_exe_info)
284284
}
285285

286286
Genealogy::ProcessExecutableInfoSP
287-
Genealogy::GetProcessExecutableInfosAtIndex(uint32_t idx)
287+
Genealogy::GetProcessExecutableInfosAtIndex(size_t idx)
288288
{
289289
ProcessExecutableInfoSP info_sp;
290290
if (idx > 0)

‎tools/debugserver/source/MacOSX/Genealogy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Genealogy
8585
typedef std::shared_ptr<ProcessExecutableInfo> ProcessExecutableInfoSP;
8686

8787
ProcessExecutableInfoSP
88-
GetProcessExecutableInfosAtIndex(uint32_t idx);
88+
GetProcessExecutableInfosAtIndex(size_t idx);
8989

9090
uint32_t
9191
AddProcessExecutableInfo(ProcessExecutableInfoSP process_exe_info);

‎tools/debugserver/source/MacOSX/MachException.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class MachException
7777
int SoftSignal() const
7878
{
7979
if (exc_type == EXC_SOFTWARE && exc_data.size() == 2 && exc_data[0] == EXC_SOFT_SIGNAL)
80-
return exc_data[1];
80+
return static_cast<int>(exc_data[1]);
8181
return 0;
8282
}
8383
bool IsBreakpoint() const

‎tools/debugserver/source/MacOSX/MachProcess.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class MachProcess
158158
//----------------------------------------------------------------------
159159
void SetEnableAsyncProfiling (bool enable, uint64_t internal_usec, DNBProfileDataScanType scan_type);
160160
bool IsProfilingEnabled () { return m_profile_enabled; }
161-
uint64_t ProfileInterval () { return m_profile_interval_usec; }
161+
useconds_t ProfileInterval () { return m_profile_interval_usec; }
162162
bool StartProfileThread ();
163163
static void * ProfileThread (void *arg);
164164
void SignalAsyncProfileData (const char *info);
@@ -310,7 +310,7 @@ class MachProcess
310310
std::string m_stdout_data;
311311

312312
bool m_profile_enabled; // A flag to indicate if profiling is enabled
313-
uint64_t m_profile_interval_usec; // If enable, the profiling interval in microseconds
313+
useconds_t m_profile_interval_usec; // If enable, the profiling interval in microseconds
314314
DNBProfileDataScanType m_profile_scan_type; // Indicates what needs to be profiled
315315
pthread_t m_profile_thread; // Thread ID for the thread that profiles the inferior
316316
PThreadMutex m_profile_data_mutex; // Multithreaded protection for profile info data

‎tools/debugserver/source/MacOSX/MachProcess.mm

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,43 @@
4040
#include "CFData.h"
4141
#include "CFString.h"
4242

43-
static CFStringRef CopyBundleIDForPath (const char *app_bundle_path, DNBError &err_str);
43+
#if defined (WITH_SPRINGBOARD) || defined (WITH_BKS)
44+
// This returns a CFRetained pointer to the Bundle ID for app_bundle_path,
45+
// or NULL if there was some problem getting the bundle id.
46+
static CFStringRef
47+
CopyBundleIDForPath (const char *app_bundle_path, DNBError &err_str)
48+
{
49+
CFBundle bundle(app_bundle_path);
50+
CFStringRef bundleIDCFStr = bundle.GetIdentifier();
51+
std::string bundleID;
52+
if (CFString::UTF8(bundleIDCFStr, bundleID) == NULL)
53+
{
54+
struct stat app_bundle_stat;
55+
char err_msg[PATH_MAX];
56+
57+
if (::stat (app_bundle_path, &app_bundle_stat) < 0)
58+
{
59+
err_str.SetError(errno, DNBError::POSIX);
60+
snprintf(err_msg, sizeof(err_msg), "%s: \"%s\"", err_str.AsString(), app_bundle_path);
61+
err_str.SetErrorString(err_msg);
62+
DNBLogThreadedIf(LOG_PROCESS, "%s() error: %s", __FUNCTION__, err_msg);
63+
}
64+
else
65+
{
66+
err_str.SetError(-1, DNBError::Generic);
67+
snprintf(err_msg, sizeof(err_msg), "failed to extract CFBundleIdentifier from %s", app_bundle_path);
68+
err_str.SetErrorString(err_msg);
69+
DNBLogThreadedIf(LOG_PROCESS, "%s() error: failed to extract CFBundleIdentifier from '%s'", __FUNCTION__, app_bundle_path);
70+
}
71+
return NULL;
72+
}
73+
74+
DNBLogThreadedIf(LOG_PROCESS, "%s() extracted CFBundleIdentifier: %s", __FUNCTION__, bundleID.c_str());
75+
CFRetain (bundleIDCFStr);
76+
77+
return bundleIDCFStr;
78+
}
79+
#endif // #if defined 9WITH_SPRINGBOARD) || defined (WITH_BKS)
4480

4581
#ifdef WITH_SPRINGBOARD
4682

@@ -412,7 +448,7 @@
412448
MachProcess::SetEnableAsyncProfiling(bool enable, uint64_t interval_usec, DNBProfileDataScanType scan_type)
413449
{
414450
m_profile_enabled = enable;
415-
m_profile_interval_usec = interval_usec;
451+
m_profile_interval_usec = static_cast<useconds_t>(interval_usec);
416452
m_profile_scan_type = scan_type;
417453

418454
if (m_profile_enabled && (m_profile_thread == NULL))
@@ -1515,7 +1551,7 @@
15151551
{
15161552
char s[1024];
15171553
s[sizeof(s)-1] = '\0'; // Ensure we have NULL termination
1518-
int bytes_read = 0;
1554+
ssize_t bytes_read = 0;
15191555
if (stdout_fd >= 0 && FD_ISSET (stdout_fd, &read_fds))
15201556
{
15211557
do
@@ -1524,12 +1560,12 @@
15241560
if (bytes_read < 0)
15251561
{
15261562
int read_errno = errno;
1527-
DNBLogThreadedIf(LOG_PROCESS, "read (stdout_fd, ) => %d errno: %d (%s)", bytes_read, read_errno, strerror(read_errno));
1563+
DNBLogThreadedIf(LOG_PROCESS, "read (stdout_fd, ) => %zd errno: %d (%s)", bytes_read, read_errno, strerror(read_errno));
15281564
}
15291565
else if (bytes_read == 0)
15301566
{
15311567
// EOF...
1532-
DNBLogThreadedIf(LOG_PROCESS, "read (stdout_fd, ) => %d (reached EOF for child STDOUT)", bytes_read);
1568+
DNBLogThreadedIf(LOG_PROCESS, "read (stdout_fd, ) => %zd (reached EOF for child STDOUT)", bytes_read);
15331569
stdout_fd = -1;
15341570
}
15351571
else if (bytes_read > 0)
@@ -1548,12 +1584,12 @@
15481584
if (bytes_read < 0)
15491585
{
15501586
int read_errno = errno;
1551-
DNBLogThreadedIf(LOG_PROCESS, "read (stderr_fd, ) => %d errno: %d (%s)", bytes_read, read_errno, strerror(read_errno));
1587+
DNBLogThreadedIf(LOG_PROCESS, "read (stderr_fd, ) => %zd errno: %d (%s)", bytes_read, read_errno, strerror(read_errno));
15521588
}
15531589
else if (bytes_read == 0)
15541590
{
15551591
// EOF...
1556-
DNBLogThreadedIf(LOG_PROCESS, "read (stderr_fd, ) => %d (reached EOF for child STDERR)", bytes_read);
1592+
DNBLogThreadedIf(LOG_PROCESS, "read (stderr_fd, ) => %zd (reached EOF for child STDERR)", bytes_read);
15571593
stderr_fd = -1;
15581594
}
15591595
else if (bytes_read > 0)
@@ -2309,7 +2345,7 @@
23092345

23102346
cpu_type_t cpu;
23112347
size_t cpu_len = sizeof(cpu);
2312-
if (::sysctl (mib, len, &cpu, &cpu_len, 0, 0))
2348+
if (::sysctl (mib, static_cast<u_int>(len), &cpu, &cpu_len, 0, 0))
23132349
cpu = 0;
23142350
return cpu;
23152351
}
@@ -2389,43 +2425,6 @@
23892425
return pid;
23902426
}
23912427

2392-
#if defined (WITH_SPRINGBOARD) || defined (WITH_BKS)
2393-
// This returns a CFRetained pointer to the Bundle ID for app_bundle_path,
2394-
// or NULL if there was some problem getting the bundle id.
2395-
static CFStringRef
2396-
CopyBundleIDForPath (const char *app_bundle_path, DNBError &err_str)
2397-
{
2398-
CFBundle bundle(app_bundle_path);
2399-
CFStringRef bundleIDCFStr = bundle.GetIdentifier();
2400-
std::string bundleID;
2401-
if (CFString::UTF8(bundleIDCFStr, bundleID) == NULL)
2402-
{
2403-
struct stat app_bundle_stat;
2404-
char err_msg[PATH_MAX];
2405-
2406-
if (::stat (app_bundle_path, &app_bundle_stat) < 0)
2407-
{
2408-
err_str.SetError(errno, DNBError::POSIX);
2409-
snprintf(err_msg, sizeof(err_msg), "%s: \"%s\"", err_str.AsString(), app_bundle_path);
2410-
err_str.SetErrorString(err_msg);
2411-
DNBLogThreadedIf(LOG_PROCESS, "%s() error: %s", __FUNCTION__, err_msg);
2412-
}
2413-
else
2414-
{
2415-
err_str.SetError(-1, DNBError::Generic);
2416-
snprintf(err_msg, sizeof(err_msg), "failed to extract CFBundleIdentifier from %s", app_bundle_path);
2417-
err_str.SetErrorString(err_msg);
2418-
DNBLogThreadedIf(LOG_PROCESS, "%s() error: failed to extract CFBundleIdentifier from '%s'", __FUNCTION__, app_bundle_path);
2419-
}
2420-
return NULL;
2421-
}
2422-
2423-
DNBLogThreadedIf(LOG_PROCESS, "%s() extracted CFBundleIdentifier: %s", __FUNCTION__, bundleID.c_str());
2424-
CFRetain (bundleIDCFStr);
2425-
2426-
return bundleIDCFStr;
2427-
}
2428-
#endif // #if defined 9WITH_SPRINGBOARD) || defined (WITH_BKS)
24292428
#ifdef WITH_SPRINGBOARD
24302429

24312430
pid_t

‎tools/debugserver/source/MacOSX/MachTask.mm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
203203
{
204204
DNBDataRef data((uint8_t*)buf, n, false);
205-
data.Dump(0, n, addr, DNBDataRef::TypeUInt8, 16);
205+
data.Dump(0, static_cast<DNBDataRef::offset_t>(n), addr, DNBDataRef::TypeUInt8, 16);
206206
}
207207
}
208208
return n;
@@ -224,7 +224,7 @@
224224
if (DNBLogCheckLogBit(LOG_MEMORY_DATA_LONG) || (DNBLogCheckLogBit(LOG_MEMORY_DATA_SHORT) && size <= 8))
225225
{
226226
DNBDataRef data((uint8_t*)buf, n, false);
227-
data.Dump(0, n, addr, DNBDataRef::TypeUInt8, 16);
227+
data.Dump(0, static_cast<DNBDataRef::offset_t>(n), addr, DNBDataRef::TypeUInt8, 16);
228228
}
229229
}
230230
return n;
@@ -411,16 +411,16 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, task_t tas
411411

412412
if (scanType & eProfileThreadsCPU)
413413
{
414-
int num_threads = threads_id.size();
415-
for (int i=0; i<num_threads; i++)
414+
const size_t num_threads = threads_id.size();
415+
for (size_t i=0; i<num_threads; i++)
416416
{
417417
profile_data_stream << "thread_used_id:" << std::hex << threads_id[i] << std::dec << ';';
418418
profile_data_stream << "thread_used_usec:" << threads_used_usec[i] << ';';
419419

420420
if (scanType & eProfileThreadName)
421421
{
422422
profile_data_stream << "thread_used_name:";
423-
int len = threads_name[i].size();
423+
const size_t len = threads_name[i].size();
424424
if (len)
425425
{
426426
const char *thread_name = threads_name[i].c_str();
@@ -890,7 +890,6 @@ static void get_threads_profile_data(DNBProfileDataScanType scanType, task_t tas
890890
// Our task has died, exit the thread.
891891
break;
892892
}
893-
continue;
894893
}
895894

896895
#if defined (WITH_SPRINGBOARD) && !defined (WITH_BKS)

‎tools/debugserver/source/MacOSX/MachThread.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ MachThread::SetSuspendCountBeforeResume(bool others_stopped)
9797
if (MachPortNumberIsValid(m_mach_port_number) == false)
9898
return false;
9999

100-
size_t times_to_resume;
100+
integer_t times_to_resume;
101101

102102
if (others_stopped)
103103
{
@@ -538,7 +538,7 @@ MachThread::SetState(nub_state_t state)
538538
DNBLogThreadedIf(LOG_THREAD, "MachThread::SetState ( %s ) for tid = 0x%8.8" PRIx64 "", DNBStateAsString(state), m_unique_id);
539539
}
540540

541-
uint32_t
541+
nub_size_t
542542
MachThread::GetNumRegistersInSet(int regSet) const
543543
{
544544
if (regSet < m_num_reg_sets)
@@ -575,7 +575,7 @@ MachThread::DumpRegisterState(int regSet)
575575
if (m_arch_ap->RegisterSetStateIsValid(regSet))
576576
{
577577
const size_t numRegisters = GetNumRegistersInSet(regSet);
578-
size_t regIndex = 0;
578+
uint32_t regIndex = 0;
579579
DNBRegisterValueClass reg;
580580
for (regIndex = 0; regIndex < numRegisters; ++regIndex)
581581
{

‎tools/debugserver/source/MacOSX/MachThread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class MachThread
8383
bool NotifyException(MachException::Data& exc);
8484
const MachException::Data& GetStopException() { return m_stop_exception; }
8585

86-
uint32_t GetNumRegistersInSet(int regSet) const;
86+
nub_size_t GetNumRegistersInSet(int regSet) const;
8787
const char * GetRegisterSetName(int regSet) const;
8888
const DNBRegisterInfo *
8989
GetRegisterInfo(int regSet, int regIndex) const;

0 commit comments

Comments
 (0)
This repository has been archived.