1 2010-01-29 Greg Clayton <gclayton@apple.com>
3 * MachProcess.cpp (MachProcess::PrepareForAttach): No longer use the
4 SBSLaunchApplication macro from the SpringBoard.framework, use the actual
5 function name SBSLaunchApplicationForDebugging.
6 (MachProcess::CleanupAfterAttach): Ditto.
7 (MachProcess::SBForkChildForPTraceDebugging): Ditto.
8 (debugserver-entitlements.plist): Added the "seatbelt-profiles" entitlement
9 so debugserver can be sandboxed.
11 2009-07-06 Greg Clayton <gclayton@apple.com>
13 * MachTask.cpp (MachTask::GetDYLDAllImageInfosAddress): Hack around bad
14 kernel code that renamed the first member of the TASK_DYLD_INFO without
15 any way to detect it has changed.
17 2009-06-29 Greg Clayton <gclayton@apple.com>
19 * DNB.cpp (GetAllInfosMatchingName): Correctly truncate process name string
20 to MAXCOMLEN when searching kinfo_proc structs for process matches by name.
21 * MachProcess.cpp (MachProcess::PrepareForAttach): Added logging when
22 attaching to a program by name.
24 2009-06-25 Greg Clayton <gclayton@apple.com>
26 * DNB.cpp (DNBProcessLaunch): Added a stat on the incoming path that we are
27 about to launch to make sure the file exists. If the file doesn't, then an
28 appropriate error string is returned. Also if we fail to get the task for
29 our process ID, we return an error string right away instead of letting the
30 debug session go for a little bit and then later failing after a few more
33 2009-04-07 Jim Ingham <jingham@apple.com>
35 * RNBRemote.h: Add vAttachWait
36 * RNBRemote.cpp (RNBRemote::CreatePacketTable): Add vattachwait.
37 (RNBRemoteShouldCancelCallback): New function.
38 (RNBRemote::HandlePacket_v): Handle vattachwait.
39 * RNBSocket.cpp (RNBSocket::Read): Mark the connection as closed when the
41 * DNB.cpp (DNBProcessAttachByName): New function.
42 (DNBProcessAttach): Make this handle catching the attach when done and
43 dealing with timeout & return conditions.
44 (GetAllInfos): New function.
45 (GetAlInfosMatchingName): New function.
46 (DNBProcessAttachWait): New function.
47 DNB.h: Declare DNBProcessAttachByName, DNBProcessAttachWait, change
48 signature of DNBProcessAttach.
49 * MachProcess.cpp (MachProcess::PrepareForAttach): New function.
50 (MachProcess::CheckForProcess): New function.
51 (MachProcess::CleanupAfterAttach): New function.
52 (CopyBundleIDForPath): New function.
53 (MachProcess::SBForkChildForPTraceDebugging): Convert to using
55 * MachProcess.h: Declare PrepareForAttach, CleanupAfterAttach and
57 * DNBTimer.h (TimeOfDayLaterThan): New function.
58 * test-remotenub.cpp (RNBRunLoopGetStartModeFromRemote): Rename from
59 RNBRunLoopGetArgsFromRemote, and handle vattachwait.
60 (RNBRunLoopLaunchAttaching): Code was moved from here into DNBProcessAttach.
61 (StartListening): New function.
62 (GetAllProcessInfos, GetAllProcessInfosMatchingName): Moved to
64 (main): Handle attach waitfor, and make debugserver with only a host and
65 port wait on commands from gdb.
67 2009-04-03 Greg Clayton <gclayton@apple.com>
69 * RNBRemote.h (PacketEnum): Added enum for qShlibInfoAddr.
70 * RNBRemote.cpp (RNBRemote::CreatePacketTable) Added the qShlibInfoAddr
71 packet definition to m_packets.
72 (RNBRemote::GetPacket): Log when we run into an unimplemented packet.
73 (RNBRemote::HandleReceivedPacket): Only log the packet when logging
75 (RNBRemote::HandlePacket_q): Add support for the new qShlibInfoAddr packet.
76 * DNB.h (DNBProcessGetSharedLibraryInfoAddress): New prototype.
77 * DNB.cpp (DNBProcessGetSharedLibraryInfoAddress): New function.
78 * MachTask.h (MachProcess::GetDYLDAllImageInfosAddress): New prototype.
79 * MachTask.cpp (MachProcess::GetDYLDAllImageInfosAddress): New function.
81 2009-04-01 Greg Clayton <gclayton@apple.com>
83 * test-remotenub.cpp (main): Display the detailed error message if any when
86 2009-03-25 Greg Clayton <gclayton@apple.com>
88 * test-remotenub.cpp (RNBRunLoopGetArgsFromRemote): Cleaned up logging and
89 removed time deltas form the messages.
90 (RNBRunLoopLaunchAttaching): Ditto.
91 (RNBRunLoopLaunchInferior): Ditto and also use new DNBProcessLaunch that
92 takes an error string pointer.
93 * RNBContext.h (class RNBContext): Removed the m_timer member.
94 * RNBContext.cpp (RNBContext::StartProcessStatusThread): Cleaned up logging
95 and removed time deltas form the messages.
96 (RNBContext::ThreadFunctionProcessStatus): Ditto.
97 * RNBSocket.h (class RNBSocket): Removed unused m_last_errno member and
99 * RNBSocket.cpp (RNBSocket::Listen): Cleaned up logging and
100 removed time deltas form the messages.
101 (RNBSocket::ConnectToService): Ditto.
102 (RNBSocket::Read): Ditto.
103 (RNBSocket::Write): Ditto.
104 (RNBSocket::SaveErrno): Removed.
105 (RNBSocket::ClosePort): Don't call RNBSocket::SaveErrno().
106 * RNBRemote.cpp (RNBRemote::RNBRemote): Cleaned up logging and
107 removed time deltas form the messages.
108 (RNBRemote::~RNBRemote): Ditto.
109 (RNBRemote::SendPacket): Ditto.
110 (RNBRemote::GetPacketPayload): Ditto.
111 (RNBRemote::GetPacket): Ditto): Ditto.
112 (RNBRemote::HandleAsyncPacket): Ditto.
113 (RNBRemote::HandleReceivedPacket): Ditto.
114 (RNBRemote::CommDataReceived): Ditto.
115 * DNB.cpp (DNBProcessLaunch): Changed to take a eror string pointer with
116 size for more descriptive error reporting (instead of a uint32_t pointer).
117 * DNB.h (DNBProcessLaunch): Ditto.
118 * DNBError.cpp (DNBError::AsString): Now returns NULL if there is no error.
119 * DNBError.h (DNBError::SetErrorString): New accessor to allow custom error
121 * arm/DNBArchImpl.cpp (DNBArchMachARM::GetGPRState): Improved logging.
122 * MachProcess.cpp (MachProcess::SBForkChildForPTraceDebugging): Improved
123 error messages when a file doesn't exist, or when unable to extract the
125 * PThreadEvent.cpp (class PThreadEvent): Commented out all logging calls.
127 2009-03-07 Greg Clayton <gclayton@apple.com>
129 * test-remotenub.cpp (GetAllProcessInfosMatchingName): New function that
130 returns matching kinfo_proc structs given a process name.
131 (main): Enhanced the --attach option to be able to take a PROCNAME or
132 a PID. Changed the --waitfor=PROCNAME option to ignore any existing
133 processes with PROCNAME so we only catch new process invocations.
135 2009-03-07 Greg Clayton <gclayton@apple.com>
137 * RNBRemote.cpp (RNBRemote::HandlePacket_p): Use the correct get current
138 thread function call so we get the correct thread registers.
140 2009-03-03 Greg Clayton <gclayton@apple.com>
142 * test-remotenub.cpp (g_isatty): New global that gets set to non-zero if
143 STDOUT is a TTY in the beginning of main.
144 (RNBLogSTDOUT): New macro that logs to STDOUT if g_isatty is non-zero, else
146 (RNBLogSTDERR): New macro that logs to STDERR if g_isatty is non-zero, else
148 (RNBRunLoopGetArgsFromRemote): Use new RNBLogSTDOUT/RNBLogSTDERR macros.
149 (GetAllProcessInfos): Get all process info structs for everything on the
151 (main): Implemented new --waitfor=NAME option to allow waiting for a process
152 to run by polling the system processes. The new --waitfor-interval=N option
153 allows fine control over the polling interval where N is the number of mirco
154 seconds (usec) to wait between polls (defaults to 1000). The new
155 --waitfor-duration=N allows a timeout in seconds to be specified when
156 waiting for a process (defaults to infinite).
158 2009-03-02 Greg Clayton <gclayton@apple.com>
160 * DNBArchImpl.cpp (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup):
161 Take care of a case where no instructions execute in a Thumb IT block and
162 the last of which is a branch.
164 2009-02-10 Greg Clayton <gclayton@apple.com>
166 * RNBRemote.h (PacketEnum): Added 'detach' enumeration.
167 (RNBRemote::HandlePacket_D): New member function prototype.
168 * RNBRemote.cpp (RNBRemote::CreatePacketTable): Added detach support.
169 (RNBRemote::HandlePacket_D): New function for detach support.
171 2009-02-10 Greg Clayton <gclayton@apple.com>
173 * RNBRemote.cpp (RNBRemote::HandlePacket_UNIMPLEMENTED): Log this
174 packet with the packet that is unimplemented.
175 (RNBRemote::GetPacket): Call RNBRemote::HandlePacket_UNIMPLEMENTED()
176 when we don't recognize a packet.
177 (RNBRemote::HandleReceivedPacket): Don't reply to packets we don't
178 recognize with unimplemented in this function as that should have
179 already been done for us in RNBRemote::GetPacket().
181 2009-02-10 Greg Clayton <gclayton@apple.com>
183 * RNBRemote.h (PacketEnum): Added query_step_packet_supported.
184 * RNBRemot.cpp (RNBRemote::CreatePacketTable): Added new
185 qStepPacketSupported packet.
186 (RNBRemote::HandlePacket_q): Added support for the new
187 "qStepPacketSupported" packet.
188 (RNBRemote::HandlePacket_G): Some cleanup when reading registers
189 to avoid spurious console logging.
191 2009-01-30 Greg Clayton <gclayton@apple.com>
193 * debugserver-entitlements.plist: Changed the entitlement
194 "run-invalid-allow" to "run-unsigned-code".
196 2009-01-23 Greg Clayton <gclayton@apple.com>
198 * DNBArchImpl.cpp (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup):
199 Merged Yusuf's changes to make software single stepping work.
200 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Call new
201 DNBResolveExecutablePath function to resolve executable paths.
202 * DNB.h (DNBResolveExecutablePath): New function prototype.
203 * DNB.cpp (DNBResolveExecutablePath): New function that will resolve
204 relative paths and also executable paths for executables that aren't relative
205 but yet are in the shell PATH environment variable.
207 2009-01-22 Greg Clayton <gclayton@apple.com>
209 * DNBArchImpl.h (class DBNArchMachARM): Renamed member variable
210 m_chained_hw_single_step_addr to m_hw_single_chained_step_addr. Added
211 new member variables: m_sw_single_step_itblock_break_id, m_last_decode_pc,
212 and m_sw_single_step_itblock_break_count. Renamed m_thumbStaticData to
213 m_last_decode_thumb, and renamed m_decodedInstruction to m_last_decode_arm.
214 (DBNArchMachARM::DecodeITBlockInstructions): New prototype.
215 (DBNArchMachARM::DecodeInstructionUsingDisassembler): New prototype.
216 (DBNArchMachARM::BreakpointHit): New prototype.
217 * DNBArchImpl.cpp (DNBArchMachARM::ThreadDidStop): Disable any of the
218 many software single step breakpoints if any are set.
219 (DNBArchMachARM::StepNotComplete): Changed renamed member accesses.
220 (DNBArchMachARM::DecodeITBlockInstructions): New function for software
221 single stepping through Thumb IT blocks.
222 (DNBArchMachARM::EnableHardwareSingleStep): Cleaned up logging.
223 (DNBArchMachARM::ComputeNextPC): Ditto.
224 (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup): Now
225 properly handles Thumb IT software single stepping.
226 (DNBArchMachARM::SetSingleStepSoftwareBreakpoints): Ditto.
227 (DNBArchMachARM::DecodeInstructionUsingDisassembler): New function.
228 (DNBArchMachARM::BreakpointHit): New breakpoint callback function.
230 2009-01-21 Greg Clayton <gclayton@apple.com>
232 * MachProcess.cpp (MachProcess::PrivateResume): Set the process state before
233 we actually resume so we are sure to get the events in the correct order.
235 2009-01-16 Greg Clayton <gclayton@apple.com>
237 * RNBRemote.cpp (RNBRemote::HandlePacket_last_signal): Include only
238 registers which are to be expedited in the T packets.
239 (RNBRemote::HandlePacket_p): Enable for all targets.
240 (struct register_map_entry): Added an expedite member so we know which
241 registers need to be sent up to the host with each stop reply packet.
242 (register_map): Updated each array members' expedite member with an
245 2009-01-16 Greg Clayton <gclayton@apple.com>
247 * RNBRemote.cpp (RNBRemote::HandlePacket_s): Enabled the step command ("s"
248 packet) for ARM now that libdebugnub.dylib can do both hardware and software
251 2009-01-13 Greg Clayton <gclayton@apple.com>
253 *DNBArchImpl.cpp (bit): New function.
254 (bits): New function.
255 (DNBArchMachARM::ConditionPassed): Use new "bit" function.
256 (DNBArchMachARM::ComputeNextPC): Use new "bit" function, remove inline
257 assembly for "RSC" instruction so this compiles for armv7 (which defaults
259 (DNBArchMachARM::NumSupportedHardwareBreakpoints): Use new "bits" function.
260 (DNBArchMachARM::NumSupportedHardwareWatchpoints): Use new "bits" function.
262 2009-01-12 Greg Clayton <gclayton@apple.com>
264 * DNBArch.h (DNBArchProtocol::NumSupportedHardwareBreakpoints()): Removed
265 the "const" qualifier to allow arches to auto detect how many hardware
266 breakpoints they have.
267 (DNBArchProtocol::NumSupportedHardwareWatchpoints()): Removed the "const"
268 qualifier to allow arches to auto detect how many hardware watchpoints they
270 * DNBArchImpl.h (DNBArchMachARM::NumSupportedHardwareBreakpoints()): Auto
271 detect how many BRP pairs are available and disable for armv7 for the time
272 being (rdar://problem/6372672).
273 (DNBArchMachARM::NumSupportedHardwareWatchpoints()): Auto detect how many
274 WRP pairs are available and disable for armv7 for the time being
275 (rdar://problem/6372672).
277 2009-01-09 Greg Clayton <gclayton@apple.com>
279 * test-remotenub.cpp (main): Filled in short argument versions for
280 --applist (-t) and --lockdown (-k) options.
281 * DNBArchImpl.h (DNBArchMachARM::ConditionPassed): New protected
283 (DNBArchMachARM::ComputeNextPC): New protected member function.
284 (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup): New
285 protected member function.
286 (DNBArchMachARM::m_thumbStaticData): New protected member variable.
287 (DNBArchMachARM::m_decodedInstruction): New protected member variable.
288 * DNBArchImpl.cpp (DNBArchMachARM::ThreadDidStop): Added extra code that
289 will log and exit when we are verifying software single stepping (a
290 compile time option).
291 (DNBArchMachARM::ConditionPassed): New function.
292 (DNBArchMachARM::ComputeNextPC): New function.
293 (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup): New
295 (DNBArchMachARM::SetSingleStepSoftwareBreakpoints): Added the guts of the
296 software single stepping.
297 (DNBArchMachARM::NumSupportedHardwareBreakpoints): Prepared for adding
299 (DNBArchMachARM::NumSupportedHardwareWatchpoints): Prepared for adding
302 2008-12-11 Greg Clayton <gclayton@apple.com>
304 * DNB.h (DNBProcessWaitForEvent): Renamed to DNBProcessWaitForEvents.
305 (DNBProcessSetEvents): Removed (deprecated).
306 (DNBProcessGetWaitForResetMask): Removed (unused).
307 (DNBProcessSetWaitForResetMask): Removed (unused).
308 (DNBProcessInterruptEvents): New function prototype.
309 * DNB.cpp (DNBProcessWaitForEvent): Renamed to DNBProcessWaitForEvents.
310 (DNBProcessSetEvents): Removed (deprecated).
311 (DNBProcessGetWaitForResetMask): Removed (unused).
312 (DNBProcessSetWaitForResetMask): Removed (unused).
313 (DNBProcessInterruptEvents): New function that can be used to
314 asynchronously interrupt infinite wait for events calls.
315 RNBRemote.cpp (RNBRemote::HandlePacket_v): Call DNBProcessWaitForEvents.
316 RNBContext.cpp (RNBContext::ThreadFunctionProcessStatus): Ditto.
317 test-remotenub.cpp (RNBRunLoopLaunchInferior): Ditto.
318 (RNBRunLoopLaunchAttaching): Ditto.
320 2008-12-11 Greg Clayton <gclayton@apple.com>
322 * DNB.cpp (GetProcessMap): Use new PTHREAD_MUTEX_LOCKER macro to ease
323 debugging of deadlocks.
324 (DNBProcessLaunch): Improved logging.
325 (DNBProcessMemoryRead): Call MachProcess::ReadMemory so breakpoint
326 opcodes can be removed from memory.
327 (DNBProcessMemoryWrite): Call MachProcess::WriteMemory so that we work
328 around enabled software breakpoint traps.
329 * DNBLog.cpp (GetLogThreadedMutex): New function.
330 (_DNBLogThreaded): Use new PTHREAD_MUTEX_LOCKER macro to ease
331 debugging of deadlocks.
332 (_DNBLogThreadedIf): Ditto.
333 * DNBBreakpoint.h (DNBBreakpoint::IntersectsRange): New function.
334 * DNBBreakpoint.cpp (DNBBreakpointList::FindIDByAddress): Improved
336 * MacOSX/MachThread.cpp (MachThread::MachThread): Improved logging.
337 (MachThread::~MachThread): Ditto.
338 (MachThread::Suspend): Ditto.
339 (MachThread::Resume): Ditto.
340 (MachThread::RestoreSuspendCount): Ditto.
341 (MachThread::GetState): Use new PTHREAD_MUTEX_LOCKER macro to ease
342 debugging of deadlocks.
343 (MachThread::SetState): Ditto.
344 * MacOSX/MachVMMemory.cpp (MachVMMemory::Read): Improved logging.
345 (MachVMMemory::Write): Ditto.
346 (MachVMMemory::WriteRegion): Ditto.
347 * MacOSX/MachProcess.cpp (MachProcess::GetState): Use new
348 PTHREAD_MUTEX_LOCKER macro to ease debugging of deadlocks.
349 (MachProcess::SetState): Ditto.
350 (MachProcess::Clear): Ditto.
351 (MachProcess::PrivateResume): Ditto.
352 (MachProcess::ReplyToAllExceptions): Ditto.
353 (MachProcess::ExceptionMessageReceived): Ditto.
354 (MachProcess::AppendSTDOUT): Ditto.
355 (MachProcess::GetAvailableSTDOUT): Ditto.
356 (MachProcess::ThreadFunctionSTDIO): Renamed from to
357 MachProcess::STDIOThread.
358 (MachProcess::StartSTDIOThread): Improved logging.
359 (MachProcess::CreateBreakpoint): Ditto.
360 (MachProcess::CreateWatchpoint): Ditto.
361 (MachProcess::DisableAllBreakpoints): Ditto.
362 (MachProcess::DisableBreakpoint): Ditto.
363 (MachProcess::DisableWatchpoint): Ditto.
364 (MachProcess::EnableBreakpoint): Ditto.
365 (MachProcess::EnableWatchpoint): Ditto.
366 (MachProcess::LaunchForDebug): Ditto.
367 (MachProcess::PosixSpawnChildForPTraceDebugging): Ditto.
368 (MachProcess::Detach): Reset the running event bit after resuming prior
369 to issuing the SIGSTOP to avoid a pause.
370 (MachProcess::RemoveTrapsFromBuffer): New function that removes
371 breakpoint traps from a memory buffer.
372 (MachProcess::ReadMemory): Read memory from the task, then removes any
373 breakpoint traps prior to returning the buffer.
374 (MachProcess::WriteMemory): Write memory and any needed data to the
375 breakpoint saved opcodes for any software breakpoint traps that are
377 * MacOSX/MachProcess.h (MachProcess::ThreadFunctionException): Removed.
378 (MachProcess::ThreadFunctionSTDIO): Renamed to MachProcess::STDIOThread().
379 (MachProcess::RemoveTrapsFromBuffer): New function.
380 * MacOSX/MachVMRegion.cpp (MachVMRegion::SetProtections): Improved
382 (MachVMRegion::RestoreProtections): Ditto.
383 (MachVMRegion::GetRegionForAddress): Ditto.
384 * MacOSX/MachException.cpp (catch_mach_exception_raise_state): Improved
386 (catch_mach_exception_raise_state_identity): Ditto.
387 (catch_mach_exception_raise): Ditto.
388 (MachException::Message::Dump): Ditto.
389 (MachException::Data::GetStopInfo): Ditto.
390 (MachException::Message::Receive): Ditto.
391 (MachException::Message::Reply): Ditto.
392 (MachException::Data::Dump): Ditto.
393 (MachException::PortInfo::Save): Ditto.
394 (MachException::PortInfo::Restore): Ditto.
395 * MacOSX/MachTask.cpp (MachTask::Suspend): Improved logging.
396 (MachTask::Resume): Ditto.
397 (MachTask::ReadMemory): Ditto.
398 (MachTask::WriteMemory): Ditto.
399 (MachTask::TaskPortForProcessID): Ditto.
400 (MachTask::BasicInfo): Ditto.
401 (MachTask::StartExceptionThread): Ditto.
402 (MachTask::ShutDownExcecptionThread): Ditto and use pthread_cancel to
403 interrupt the exception thread.
404 (MachTask::ExceptionThread): Ditto and revert back to infinite timeout
405 as pthread_cancel will break us out of infinite mach_msg receive calls.
406 * MacOSX/MachThreadList.cpp (MachThreadList::UpdateThreadList): Improved
408 (MachThreadList::CurrentThread): Use new PTHREAD_MUTEX_LOCKER macro to
409 ease debugging of deadlocks.
410 * DNBTimer.h (DNBTimer::DNBTimer): Initialize the mutex with a recursive
412 (DNBTimer::Reset): Use new PTHREAD_MUTEX_LOCKER macro to ease debugging
414 (DNBTimer::TotalMicroSeconds): Ditto.
415 (DNBTimer::GetTime): Ditto.
416 (DNBTimer::ElapsedMicroSeconds): Ditto.
417 (DNBTimer::GetTimeOfDay): New class function.
418 * DNBError.cpp (DNBError::LogThreaded): Improved logging.
420 * PThreadMutex.h: Added the ability to debug deadlocks by defining
421 DEBUG_PTHREAD_MUTEX_DEADLOCKS.
422 * FunctionProfiler.cpp
423 * PThreadEvent.cpp (PThreadEvent::NewEventBit): Use new
424 PTHREAD_MUTEX_LOCKER macro to ease debugging of deadlocks.
425 (PThreadEvent::FreeEventBits): Ditto.
426 (PThreadEvent::GetEventBits): Ditto.
427 (PThreadEvent::ReplaceEventBits): Ditto.
428 (PThreadEvent::SetEvents): Ditto.
429 (PThreadEvent::ResetEvents): Ditto.
430 (PThreadEvent::WaitForSetEvents): Ditto.
431 (PThreadEvent::WaitForEventsToReset): Ditto.
433 2008-12-05 Greg Clayton <gclayton@apple.com>
435 * DNBDefs.h (LOG_TASK): New log bit.
436 * DNB.cpp (DNBProcessIsAlive): User newly abstracted MachTask class.
437 (DNBProcessMemoryRead): Ditto.
438 (DNBProcessMemoryWrite): Ditto.
439 * DNBArchImpl.cpp (DNBArchMachARM::EnableHardwareSingleStep): Ditto.
440 (DNBArchMachARM::SetSingleStepSoftwareBreakpoints) Ditto.
441 * MachException.cpp (MachException::Message::Receive): Cleaned up logging
442 so it doesn't always log timeout errors.
443 (MachException::Message::Reply): Use abstracted MachTask class for any
444 task related queries.
445 (MachException::PortInfo::Save): Cleaned up logging.
446 (MachException::PortInfo::Restore): Cleaned up logging and now return an
447 error instead of the number of restored port infos.
448 * MachProcess.cpp (class MachProcess): Abstracted out all of the task_t
449 related stuff (suspend, resume, exception ports, exception thread, and
450 more) into a new class MachTask.
451 (MachProcess::Task): Now returns a reference to a MachTask class.
452 (MachProcess::Clear): Uses new abstracted MachTask class.
453 (MachProcess::Detach): Ditto.
454 (MachProcess::PrivateResume): Ditto.
455 (MachProcess::DisableBreakpoint): Ditto.
456 (MachProcess::ExceptionMessageReceived): Ditto.
457 (MachProcess::ExceptionMessageBundleComplete): Ditto.
458 (MachProcess::AttachForDebug): Ditto.
459 (MachProcess::LaunchForDebug): Ditto.
460 (MachProcess::SBLaunchForDebug): Ditto.
461 (MachProcess::TaskIsValid): Removed (replaced by similar functionality
462 in the new MachTask class).
463 (MachProcess::ExceptionPort): Ditto.
464 (MachProcess::ExceptionPortIsValid): Ditto.
465 (MachProcess::StartExceptionThread): Ditto.
466 (MachProcess::Suspend): Ditto.
467 (MachProcess::TaskResume): Ditto.
468 (MachProcess::TaskBasicInfo): Ditto.
469 (MachProcess::TaskBasicInfo): Ditto.
470 (MachProcess::ReadMemory): Ditto.
471 (MachProcess::WriteMemory): Ditto.
472 (MachProcess::ThreadFunctionException): Ditto.
474 2008-12-04 Greg Clayton <gclayton@apple.com>
476 * DNB.h (DNBProcessSetEvents): New API function prototype.
477 * DNB.cpp (DNBProcessSetEvents): New API function.
478 (DNBProcessHalt): Send our process a SIGINT instead of suspending
480 * DNBDefs.h (NUB_STATE_IS_STOPPED): Removed up duplicate entry in macro.
481 (eEventPrcoessAsyncInterrupt): New prcoess event bit that allows async
482 interrupting of infinite DNBProcessWaitForEvent() function calls.
483 * MachException.cpp (MachException::Message::Receive): Improved logging.
484 (MachException::Message::Reply): Improved logging.
485 * MachProcess.h (MachProcess::TaskBasicInfo): New member and static
487 * MachProcess.cpp (MachProcess::TaskIsValid): Use new TaskBasicInfo()
489 (MachProcess::Resume): Removed the detach parameter from the PrivateResume()
491 (MachProcess::Kill): Added a absolute timeout pointer to allow callers to
492 wait for the signal to be received if the timeout is non-NULL.
493 (MachProcess::TaskBasicInfo): New member and static function.
494 (MachProcess::TaskResume): New function that resumes the task by making sure
495 the suspend count is correctly ref counted.
496 (MachProcess::Detach): When detaching from a process make sure it is
497 stopped (SIGSTOP) first, then we can successfully detach. The exception
498 thread now also properly exits.
499 (MachProcess::PrivateResume): Call new TaskResume function, and removed the
500 detach functionality.
501 (MachProcess::DisableBreakpoint): Only notify the thread list that a
502 breakpoint has changed if the breakpoint is going to be removed.
503 (MachProcess::ThreadFunctionException): Added a permanent 1 second timeout
504 for each call to mach_msg() so we can exit the thread in the event that
505 we detach from a process/task.
506 * test-debugnub (main): Modified to show an example of how to detach using
507 a signal_handler to asynchronously receive a SIGINT and properly interrupt
508 and detach from a running process.
510 2008-11-26 Greg Clayton <gclayton@apple.com>
512 * DNBDefs.h (LOG_STEP): New logging define.
513 * DNBError.cpp (DNBError::LogThreaded): If there is no error, then
514 log with "success: " as a prefix instead of "error: ".
515 * arm/DBNArchImpl.cpp (DNBArchMachARM::EnableHardwareSingleStep): Log using
516 new LOG_STEP instead of LOG_BREAKPOINTS.
517 (DNBArchMachARM::SetSingleStepSoftwareBreakpoints): Ditto.
518 * MachException.cpp (MachException::Message::Dump): Log exception header
519 and reply header on two separate lines.
520 * MachProcess.cpp (IsSBProcess): Check for NULL CFArrayRef returned from
521 SBSCopyApplicationDisplayIdentifiers for SkankPhone.
522 (MachProcess::Suspend): Check if process state is not running instead of
523 having to receive an event after a timeout if one is given.
524 (MachProcess::Detach): Deallocate the exception port when detaching and
525 restore the inferior task exception ports prior to clearing and detaching.
526 (MachProcess::PrivateResume): Grab the task's basic info and make sure we
527 get the resume the correct number of times.
528 (MachProcess::DisableBreakpoint): Removed unused variable opcode_restored
529 and make sure the breakpoint is enabled before we start warning that
530 our opcode wasn't there.
531 * ppc/DBNArchImpl.cpp (DNBArchMachPPC::EnableHardwareSingleStep): Log
532 using LOG_STEP instead of LOAD_BREAKPOINTS.
533 * RNBServices.cpp (IsSBProcess): Check for NULL CFArrayRef returned from
534 SBSCopyApplicationDisplayIdentifiers for SkankPhone.
536 2008-11-26 Greg Clayton <gclayton@apple.com>
538 * MachProcess.h (MachProcess::Suspend): Now takes an optional absolute
539 timeout that, if non-NULL, will case the function to return after the
540 process has been suspended and is in a stopped state. If the timeout is
541 NULL, then no waiting will occur.
542 * MachProcess.cpp (MachProcess::Suspend): Ditto.
543 (MachProcess::Detach): Now replies to all exceptions, un-suspends all
544 threads and resumes the task.
545 (MachProcess::ReplyToAllExceptions): New function.
546 (MachProcess::PrivateResume): Now takes an additional parameter named
547 detach that will do the right thing when detaching from a process.
548 * DNBArchImpl.h (DNBArchMachI386::ThreadWillResume): Returns void.
549 * DNBArchImpl.cpp (DNBArchMachI386::ThreadWillResume): Returns void.
550 * RNBServices.cpp (ListApplications): #ifdef-ed for ARM only as it
551 currently uses SpringBoard.
552 (IsSBProcess): Ditto.
553 * test-remotenub.cpp (RNBRunLoopLaunchInferior): #ifdef-ed around
554 ARM parts so it compiles for i386.
557 2008-11-24 Greg Clayton <gclayton@apple.com>
559 * DNBArchProtocol.h (DNBArchProtocol::ThreadWillResume): Now returns void.
560 * DNBArchImpl.cpp (DNBArchMachARM::ThreadWillResume): Returns void and
561 has hollowed out support for software single step.
562 (DNBArchMachARM::ThreadDidStop): Has a debug mode that uses hardware single
563 step to verify software single step that can be enabled by defining
564 DNB_ARCH_MACH_ARM_DEBUG_SW_STEP.
565 (DNBArchMachARM::SetSingleStepSoftwareBreakpoints): New function.
566 * DNBArchImpl.h (DNBArchMachARM::ThreadWillResume): Returns void.
567 (DNBArchMachARM::SetSingleStepSoftwareBreakpoints): New prototype.
568 (DNBArchMachARM::m_sw_single_step_next_pc): New member variable.
569 (DNBArchMachARM::m_sw_single_step_break_id): New member variable.
570 * MachThread.cpp (MachThread::ThreadWillResume): Now returns void.
571 * MachThread.h (MachThread::ThreadWillResume): Now returns void.
573 2008-11-19 Greg Clayton <gclayton@apple.com>
575 * DNBError.h (FlavorType): Added SpringBoard error type for arm builds.
576 * DNBError.cpp (DNBError::AsString): Now returns SpringBoard error strings
577 if the error type is SpringBoard.
578 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Set the error into
579 RNBContext as either a POSIX error or a SpringBoard error.
580 * RNBContext.h (m_launch_status): Changed this member to be a DNBError
581 instead of a uint32_t.
582 (RNBContext::LaunchStatus): Now returns a reference to the DNBError object
584 * RNBContext.cpp (RNBContext::LaunchStatusAsString): Let DNBError handle
585 any error string descriptions, including SpringBoard errors.
586 * RNBRemote.cpp (RNBRemote::HandlePacket_q): Use new error class in
588 (RNBRemote::HandlePacket_C): Return without an erroneous error when resuming
589 a process with a signal.
590 * DNBArch.h (DNBArchProtocol::StepNotComplete): New protocol function with
591 default return value.
592 * DNBArchImpl.cpp (DNBArchMachARM::StepNotComplete): New function.
593 (DNBArchMachARM::EnableHardwareSingleStep): Handle hardware single stepping
594 over 32 bit thumb instructions better so we always do a true instruction
596 * MachProcess.cpp (MachProcess::ExceptionMessageBundleComplete): Now resumes
597 if single stepping wasn't able to complete in a single run.
598 * MachThread.cpp (MachThread::ShouldStop): Fills in new step_more parameter
599 if stepping is not complete.
600 * MachThreadList.cpp (MachThreadList::ShouldStop): Pass step_more parameter
601 to each MachThread::ShouldStop call.
603 2008-11-13 Greg Clayton <gclayton@apple.com>
605 * MachProcess.cpp (MachProcess::PosixSpawnChildForPTraceDebugging): Don't
606 call posix_spawnattr_setbinpref_np when launching with posix_spawn on ARM
607 targets as it currently selects the incorrect slice due to multiple slices
608 that contain the same cputype, yet they all have differing cpusubtypes.
610 2008-11-04 Greg Clayton <gclayton@apple.com>
612 * RNBRemote.h (GetContinueThread): Don't return the current thread when
613 the continue thread is zero or -1.
614 * RNBRemote.cpp (RNBRemote::HandlePacket_c): Resume the process if we
615 have no continue thread set.
616 (RNBRemote::HandlePacket_s): Ditto.
617 (RNBRemote::HandlePacket_C): Ditto unless a continue address is specified
618 in which case we will only succeed if we have one thread when the continue
619 with signal and address doesn't have a continue thread specified.
620 (RNBRemote::HandlePacket_S): Ditto.
621 * DNB.cpp (DNBProcessResumeWithSignal): New function.
622 (DNBProcessResume): Added better logging.
623 (DNBProcessHalt): Ditto.
624 (DNBThreadResume): Ditto.
625 (DNBThreadResumeWithSignal): Ditto.
626 * DNB.h (DNBProcessResumeWithSignal): New prototype.
627 * DNBError.cpp (DNBError::LogThreaded): New function.
628 * DNBError.h (DNBError::LogThreaded): New prototype.
629 * DNBLog.cpp (_DNBLogThreaded): Added sequence ID for threaded logs.
630 (_DNBLogThreadedIf): Ditto.
631 * MachException.cpp (MachException::Data::GetStopInfo): Use new SoftSignal()
633 (MachException::Data::DumpStopReason): Ditto.
634 (MachException::Message::Reply): Added better logging and log using the
635 soft signal if our task matches that in the exception.
636 (MachException::Data::Dump): Added better logging.
637 * MachException.h (IsSoftSignal): Removed.
638 (SoftSignal): New function that returns the soft signal in the exception
639 data if there is one, or zero otherwise.
640 * MachProcess.cpp (MachProcess::Suspend): Improved logging.
641 (MachProcess::Resume): Ditto.
642 (MachProcess::PrivateResume): Handle the case where the process is told
643 to resume with a signal by matching the signal up to the thread that had
644 the soft signal if no thread id is specified.
645 * MachThread.cpp (MachThread::Suspend): Improved logging.
646 (MachThread::Resume): Improved logging.
647 (MachThread::RestoreSuspendCount): Improved logging.
648 (MachThread::Resume): Improved logging.
649 (MachThread::Dump): Improved logging.
650 * MachThreadList.cpp (MachThreadList::Dump): Improved logging.
652 2008-10-22 Greg Clayton <gclayton@apple.com>
654 * test-remotenub.cpp (RNBRunLoopMode): Added a new enum value
655 eRNBRunLoopModeInferiorAttaching.
656 (g_long_options): Added "--attach=PID" for attaching to existing processes
657 and "--launch=(auto|posix|fork|springboard)" options.
658 (RNBRunLoopLaunchInferior): Now launches process with new
659 nub_launch_flavor_t enum that can be overridden with the --launch option.
660 (RNBRunLoopLaunchAttaching): New function for attaching to existing
662 (main): Added command line option support for the "--attach" and "--launch"
663 options and added attach to pid support and better logging.
664 * DNB.cpp/h: (DNBProcessLaunch): Added nub_launch_flavor_t and error
665 parameter for more precise control when launching processes.
666 (DNBProcessSBLaunch): Removed function as launching with SpringBoard can
667 now be done using DNBProcessLaunch with launch_flavor being set to
668 eLaunchTypeSpringBoard (arm only).
669 (DNBProcessSBAttach): Removed function (SpringBoard processes are now auto
670 detected in the MachProcess::AttachForDebug function on ARM).
671 * DNBDefs.h (NUB_GENERIC_ERROR): New generic error definition.
672 (nub_launch_flavor_t): New enumeration used for control over process
674 * MachProcess.cpp (IsSBProcess): New function.
675 (MachProcess::AttachForDebug): Removed flags parameter that was being used
676 for SpringBoard flags and we now detect if a process belongs to SpringBoard
677 by calling IsSBProcess.
678 (MachProcess::LaunchForDebug): Now has launch parameter that tells it how
679 to launch the inferior process and there is also an error code that gets
680 returned. This function can now launch using fork + exec, posix_spawn,
681 or SpringBoard on ARM targets.
682 (MachProcess::SBLaunchForDebug): Now uses DNBError reference instead of
683 uint32_t pointer for the error code.
684 (MachProcess::SBForkChildForPTraceDebugging): Ditto.
686 2008-10-22 Greg Clayton <gclayton@apple.com>
688 * MacOSX/arm/DNBArchImpl.cpp (DNBArchMachARM::GetRegisterValue): Set
689 register value to a uint32 value instead of a float64 value for s0 -
692 2008-10-17 Greg Clayton <gclayton@apple.com>
694 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Don't listen for
695 the qLaunchSuccess if we aren't doing a lockdown connection.
697 2008-10-13 Greg Clayton <gclayton@apple.com>
699 * RNBRemote.h (class RNBRemote): Added m_watchpoints member.
700 * DNB.cpp (DNBBreakpointSet): Added boolean hardware parameter for
701 requesting that a hardware breakpoint be set.
702 (DNBWatchpointSet): New function.
703 (DNBWatchpointClear): New function.
704 (DNBWatchpointGetHitCount): New function.
705 (DNBWatchpointGetIgnoreCount): New function.
706 (DNBWatchpointSetIgnoreCount): New function.
707 (DNBWatchpointSetCallback): New function.
708 (DNBWatchpointPrint): New function.
709 * DNBRegisterInfo.cpp (DNBRegisterValueClass::Dump): Modified to emit
710 a single DNBLog() call so there aren't multiple newlines when logging
712 * RNBContext.cpp (RNBContext::ThreadFunctionProcessStatus): Use new
713 process state changed events.
714 * DNBBreakpoint.h (class DNBBreakpoint): Removed m_state member and
715 added m_tid, m_enabled, m_hw_preferred, m_is_watchpoint, m_watch_read,
716 m_watch_write, and m_hw_index.
717 (DNBBreakpoint::ThreadID()): New accessor.
718 (DNBBreakpoint::IsEnabled()): New accessor.
719 (DNBBreakpoint::SetEnabled()): New accessor.
720 (DNBBreakpoint::IsWatchpoint()): New accessor.
721 (DNBBreakpoint::IsBreakpoint()): New accessor.
722 (DNBBreakpoint::SetIsWatchpoint()): New accessor.
723 (DNBBreakpoint::WatchpointRead()): New accessor.
724 (DNBBreakpoint::WatchpointWrite()): New accessor.
725 (DNBBreakpoint::HardwarePreferred()): New accessor.
726 (DNBBreakpoint::IsHardware()): New accessor.
727 (DNBBreakpoint::GetHardwareIndex()): New accessor.
728 (DNBBreakpoint::SetHardwareIndex()): New accessor.
729 (DNBBreakpoint::ThreadID()): New accessor.
730 (DNBBreakpoint::GetState()): Removed accessor.
731 (DNBBreakpoint::SetState()): Removed accessor.
732 (DNBBreakpoint::AddBreakpoint()): Renamed to Add().
733 (DNBBreakpoint::RemoveBreakpoint()): Renamed to Remove().
734 (DNBBreakpoint::FindBreakIDForAddress()): Renamed to FindIDByAddress().
735 (DNBBreakpoint::ShouldStopAtBreakpoint()): Renamed to ShouldStop().
736 (DNBBreakpoint::SetBreakpointCallback()): Renamed to SetCallback().
737 (DNBBreakpoint::FindBreakpointWithAddress()): Renamed to
739 (DNBBreakpoint::FindBreakpointWithBreakID()): Renamed to FindByID().
740 (DNBBreakpoint::GetBreakpointAtIndex()): Renamed to GetByIndex().
741 * FunctionProfiler.h: New header for subclass of DNBRuntimeAction.
742 * RNBRemote.cpp (RNBRemote::HandlePacket_v): Use new process state
744 (RNBRemote::HandlePacket_z): Implement the hardware breakpoint and
745 watchpoint commands z1, Z1, z2, Z2, z3 and Z3
746 * PThreadEvent.h (PThreadEvent::GetEventBits): Made member function
748 (PThreadEvent::WaitForSetEvents): Ditto.
749 (PThreadEvent::WaitForEventsToReset): Ditto.
750 (PThreadEvent::WaitForResetAck): Ditto.
751 (PThreadEvent::m_mutex): Made class member mutable.
752 (PThreadEvent::m_set_condition): Made class member mutable.
753 (PThreadEvent::m_reset_condition): New mutable class member.
754 * ProfileObjectiveC.cpp
755 * DNBArch.h (DNBArch::NotifyException): Now has default implementation
757 (DNBArch::NumSupportedHardwareBreakpoints): New virtual member
758 function with a default implementation.
759 (DNBArch::NumSupportedHardwareWatchpoints): Ditto.
760 (DNBArch::EnableHardwareBreakpoint): Ditto.
761 (DNBArch::EnableHardwareWatchpoint): Ditto.
762 (DNBArch::DisableHardwareBreakpoint): Ditto.
763 (DNBArch::DisableHardwareWatchpoint): Ditto.
764 * DNB.h (DNBBreakpointSet): New take a HARDWARE parameter that allows
765 requests for setting hardware breakpoints.
766 (DNBWatchpointSet): New function prototype.
767 (DNBWatchpointClear): New function prototype.
768 (DNBWatchpointGetHitCount): New function prototype.
769 (DNBWatchpointGetIgnoreCount): New function prototype.
770 (DNBWatchpointSetIgnoreCount): New function prototype.
771 (DNBWatchpointSetCallback): New function prototype.
772 (DNBWatchpointPrint): New function prototype.
773 * MacOSX/arm/DNBArchImpl.cpp: Added hardware breakpoint and watchpoint
775 (DNBArchMachARM::GetCPUType): New function.
776 (DNBArchMachARM::DumpDBGState): New function.
777 (DNBArchMachARM::GetDBGState): New function.
778 (DNBArchMachARM::SetDBGState): New function.
779 (DNBArchMachARM::EnableHardwareSingleStep): New function.
780 (DNBArchMachARM::EnableHardwareBreakpoint): New function.
781 (DNBArchMachARM::NotifyException): Removed.
782 (DNBArchMachARM::DisableHardwareBreakpoint): New function.
783 (DNBArchMachARM::EnableHardwareWatchpoint): New function.
784 (DNBArchMachARM::DisableHardwareWatchpoint): New function.
785 * MacOSX/MachThread.cpp (MachThread::Suspend): Added better logging.
786 (MachThread::Resume): Ditto.
787 (MachThread::RestoreSuspendCount): Ditto.
788 (MachThread::Dump): Ditto.
789 (MachThread::EnableHardwareBreakpoint): New function.
790 (MachThread::EnableHardwareWatchpoint): New function.
791 (MachThread::DisableHardwareBreakpoint): New function.
792 (MachThread::DisableHardwareWatchpoint): New function.
793 * MacOSX/MachThreadList.h (MachThreadList::GetLastError): Removed.
794 (MachThread::EnableHardwareBreakpoint): New prototype.
795 (MachThread::DisableHardwareBreakpoint): New prototype.
796 (MachThread::EnableHardwareWatchpoint): New prototype.
797 (MachThread::DisableHardwareWatchpoint): New prototype.
798 (class MachThread): Remove m_err member variable.
799 * MacOSX/ppc/DNBArchImpl.cpp (DNBArchMachPPC::GetCPUType) New
801 (DNBArchMachPPC::NotifyException): Removed.
802 * MacOSX/ppc/DNBArchImpl.h (DNBArchMachPPC::NotifyException): Removed.
803 * MacOSX/MachThread.h (MachThread::EnableHardwareBreakpoint): New
805 (MachThread::EnableHardwareWatchpoint): New prototype.
806 (MachThread::DisableHardwareBreakpoint): New prototype.
807 (MachThread::DisableHardwareWatchpoint): New prototype.
808 (class MachThread): Renambed class member m_exception to
810 * MacOSX/MachProcess.cpp (MachProcess::SetState): Updated to use new
811 process event enumerations.
812 (MachProcess::PrivateResume): Added better logging.
813 (MachProcess::CreateBreakpoint): Added bool HARDWARE parameter for
814 requesting hardware breakpoints.
815 (MachProcess::CreateWatchpoint): New function.
816 (MachProcess::DisableAllWatchpoints): New function.
817 (MachProcess::DisableWatchpoint): New function.
818 (MachProcess::DumpWatchpoint): New function.
819 (MachProcess::EnableBreakpoint): Enabled breakpoints in hardware if
820 requested and supported.
821 (MachProcess::DisableBreakpoint): Disable hardware breakpoints if that
822 is how they were set.
823 (MachProcess::EnableWatchpoint): New function.
824 (MachProcess::ExceptionMessageBundleComplete): Wait for the
825 eEventProcessRunningStateChanged event to be reset before changing
826 state to stopped to avoid race condition with very fast start/stops.
827 (MachProcess::LaunchForDebug): Added posix_spawn support.
828 (MachProcess::PosixSpawnChildForPTraceDebugging): New function.
829 * MacOSX/i386/DNBArchImpl.cpp (DNBArchMachI386::GetCPUType): New
831 * MacOSX/i386/DNBArchImpl.h (DNBArchMachI386::GetCPUType): New
833 * MacOSX/MachProcess.h (PosixSpawnChildForPTraceDebugging): New
835 * MacOSX/MachException.cpp (class MachException::ThreadMessage):
836 Renamed class to MachException::Data.
837 * MacOSX/MachThreadList.cpp (class MachThreadList): Removed m_err
839 (MachThreadList::EnableHardwareBreakpoint): New function.
840 (MachThreadList::DisableHardwareBreakpoint): New function.
841 (MachThreadList::EnableHardwareWatchpoint): New function.
842 (MachThreadList::DisableHardwareWatchpoint): New function.
843 * MacOSX/MachException.h (class MachException::ThreadMessage):
844 Renamed class to MachException::Data.
845 * DNBDefs.h (nub_watch_t): New typedef.
846 (INVALID_NUB_HW_INDEX): New macro definition.
847 (WATCH_TYPE_READ): New macro definition.
848 (WATCH_TYPE_WRITE): New macro definition.
849 (NUB_STATE_IS_RUNNING): New macro to see if state is a running state.
850 (NUB_STATE_IS_STOPPED): New macro to see if state is a stopped state.
851 (eEventProcessStateChanged): Deprecated.
852 (eEventProcessRunningStateChanged): New process event state.
853 (eEventProcessStoppedStateChanged): New process event state.
854 (LOG_WATCHPOINTS): New macro definition for logging watchpoints.
855 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Use new process
857 * FunctionProfiler.cpp: New class that allows single stepping through
858 an address range for tracing exact call graphs.
860 2008-09-22 Greg Clayton <gclayton@apple.com>
862 * RNBRemote.h (GetContinueThread): If the continue thread is zero or
863 -1 then return GetCurrentThread().
864 * RNBRemote.cpp (m_packets): Made the vCont functions call
865 RNBRemote::HandlePacket_v().
866 (RNBRemote::HandlePacket_H): Cleaned up whitespace.
867 (RNBRemote::HandlePacket_last_signal): Return actual signal values for
868 EXE_SOFTWARE/EXC_SOFT_SIGNAL mach exceptions.
869 (RNBRemote::HandlePacket_v): Implemented the 'vCont?' and 'vCont;'
871 (RNBRemote::HandlePacket_c): Handle the case where an address is
873 (RNBRemote::HandlePacket_C): Implemented the continue with signal
874 including when an address is provided.
875 (RNBRemote::HandlePacket_S): Implemented the step with signal
876 including when an address is provided.
877 * DNB.cpp (DNBProcessResume): Pass 0 as the signal when resuming
878 a process without specifying a thread.
879 (DNBThreadResume): Pass 0 as the signal when resuming a specific thread.
880 (DNBThreadResumeWithSignal): New function.
881 * DNB.h (DNBThreadResumeWithSignal): New prototype.
882 * MachException.h (MachException::Message::Reply): Added a signal
884 * MachException.cpp (MachException::Message::Reply): Update the thread
885 with the new SIGNAL parameter instead of always zero so signals can be
886 passed on to programs.
887 * MachProcess.h (MachProcess::Resume): Added a signal parameter.
888 * MachProcess.h (MachProcess::PrivateResume): Added a signal parameter.
889 * MachProcess.cpp (MachProcess::Resume): Pass new SIGNAL parameter to
890 MachProcess::PrivateResume.
891 * MachProcess.cpp (MachProcess::PrivateResume): Pass new SIGNAL
892 parameter to the mach exception reply.
894 2008-08-08 Greg Clayton <gclayton@apple.com>
896 * DNB.cpp (gProcessMap): Removed static C++ global.
897 (GetProcessMap): New Function.
898 (AddProcessToMap): New function.
899 (RemoveProcessFromMap): New function.
900 (GetProcessSP): Use new GetProcessMap function to get process list.
902 2008-07-30 Greg Clayton <gclayton@apple.com>
904 * debugserver-entitlements.plist (get-task-allow): Removed.
905 (run-invalid-allow): Added boolean value set to TRUE.
907 2008-04-18 Greg Clayton <gclayton@apple.com>
909 * MachProcess.cpp (MachProcess::Task): Added getuid(), geteuid(),
910 getgid(), getegid() to the log message if task for pid fails.
912 2008-04-07 Greg Clayton <gclayton@apple.com>
914 * RNBContext.cpp (RNBContext::LaunchStatusAsString): Removed unused
917 2008-04-04 Greg Clayton <gclayton@apple.com>
919 * CFString.cpp/h (UTF8): Made a static function that can convert
920 a CFStringRef to UTF8.
922 2008-04-04 Greg Clayton <gclayton@apple.com>
924 * test-remotenub.cpp (main): Make sure we exit after we send the
927 2008-04-04 Greg Clayton <gclayton@apple.com>
929 * RNBServices.h (IsSBProcess): New prototype;
930 * RNBServices.cpp (IsSBProcess): New function that returns true it
931 SpringBoard owns or knows about the process.
932 * RNBRemote.cpp (RNBRemote::HandlePacket_v): Made attach work correctly.
933 * DNB.cpp (DNBProcessSBAttach): New function for use when attaching to
934 a process owned by SpringBoard.
935 (DNBProcessAttach): Fixed an issue where a local was shadowing a
937 * DNB.h (DNBProcessSBAttach): New prototype.
938 * MachProcess.cpp (MachProcess::AttachForDebug): AttachForDebug now
939 takes some flags so it knows to enable SpringBoard functionality.
940 * MachProcess.h (MachProcess::AttachForDebug): Added flags parameter
943 2008-04-04 Greg Clayton <gclayton@apple.com>
945 * test-remotenub.cpp (RNBRunLoopGetArgsFromRemote): Handle the new
946 attach packet and watch for connection being lost.
947 (main): handle the --applist option when there we aren't using lockdown
948 by printing the results to stdout and exiting with appropriate error code
949 if we failed. Also handle the new prototype for ListApplications.
950 * RNBServices.h (ListApplications): Change first parameter to be a std::string
951 that will get the contents of the plist so we can use this for more than
953 * RNBServices.cpp (ListApplications): Change first parameter to be a std::string
954 that will get the contents of the plist so we can use this for more than
955 just lockdown and also fixed the logic so we actually create a full list of
956 applications instead of just overwriting the first entry.
957 * RNBRemote.h (PacketEnum): Added a new 'vattach' enum for the "vAttach;PID"
959 (RNBRemote::HandlePacket_v): New prototype;
960 * RNBRemote.cpp (RNBRemote::CreatePacketTable): add the vattach packet definition
962 (RNBRemote::HandlePacket_v): New function that handles attach to a process.
964 2008-04-03 Jim Ingham <jingham@apple.com>
966 * RNBRemote.h: Add query_launch_success to packet enum.
967 * RNBRemote.cpp (RNBRemote::CreatePacketTable_): Add query_launch_success.
968 (HandlePacket_q): Handle query_launch_success.
969 * DNB.cpp (DNBProcessSBLaunch): Pass in launch_retval.
970 * DNB.h: Change prototype of DNBProcessSBLaunch to take launch_retval.
971 * RNBContext.cpp (RNBContext::LaunchStatusAsString): New function.
972 * RNBContext.h (RNBContext): Add m_launch_status & accessors.
973 * macosx/MachProcess.cpp (MachProcess::SBLaunchForDebug): Pass launch_retval.
974 (MachProcess::SBForkChildForPTraceDebugging): Accept & set launch_retval.
975 * Macosx/MachProcess.h: Change prototypes of SBLaunchForDebug &
976 ForkChildForPTraceDebugging to accept launch_retval.
977 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Get the launch status and
978 put it in the context, then wait for the qLaunchStatus packet.
980 2008-04-03 Greg Clayton <gclayton@apple.com>
982 * com.apple.debugserver.plist: Changed plist so debugserver
984 * com.apple.debugserver.applist.plist: Ditto.
986 2008-04-03 Greg Clayton <gclayton@apple.com>
988 * MachProcess.cpp: (MachProcess::SBForkChildForPTraceDebugging):
989 Increased SBS application launch timeout to 30 seconds.
991 2008-03-27 Christopher Friesen <friesen@apple.com>
993 * RNBServices.h: Pass tasks from SpringBoard as a plist
994 * RNBServices.cpp: Ditto.
995 * test-remotenub.cpp: added --applist flag
996 * com.apple.debugserver.applist.plist: Agent plist
998 2008-03-17 Jim Ingham <jingham@apple.com>
1000 * DNB.h: Pass envp to DNBProcessLaunch & DNBProcessSBLaunch.
1002 * MachProcess.h: Ditto for *LaunchForDebug and
1003 *ForkChildForPtraceDebugging.
1004 * MachProcess.cpp (MachProcess::LaunchForDebug): Pass on envp.
1005 (MachProcess::SBLaunchForDebug): Ditto.
1006 (MachProcess::ForkChildForPtraceDebugging): Accept envp, haven't actually
1007 implemented the passing yet.
1008 (MachProcess::SBForkChildForPtraceDebuggin): Accept envp, convert to
1009 CFDictionary and pass to SBSLaunchApplication.
1010 * RNBContext.h: Add environment to the context.
1011 * RBNContext.cpp (RNBContext::EnvironmentAtIndex): New function.
1012 * RNBRemote.h: Add set_environment_variable to the PacketEnum.
1013 * RNBRemote.cpp (RNBRemote::CreatePacketTable): Add QEnvironment:.
1014 * (RNBRemote::HandlePacket_Q): Ingest the environment variable.
1015 * test-remotenub.cpp (RNBRunLoppLaunchInferior): Convert the env
1016 array in the context into an array, and pass it to the DNBProcess*Launch
1019 2008-03-17 Greg Clayton <gclayton@apple.com>
1021 * DNBBreakpoint.cpp (DNBBreakpointList::GetBreakpointAtIndex): New
1022 functions (const and non-const versions).
1023 * DNBBreakpoint.h (DNBBreakpointList::GetBreakpointAtIndex): New
1024 prototypes (const and non-const versions).
1025 * DNBError.h (DNBError::Success()): Don't use KERN_SUCCESS define.
1026 (DNBError::Fail()): Don't use KERN_SUCCESS define.
1027 * MachProcess.cpp (MachProcess::DisableAllBreakpoints): New function.
1028 (MachProcess::Detach): Added initial implementation that will halt
1029 the process, disable all breakpoints and call PT_DETACH.
1030 * MachProcess.h (MachProcess::DisableAllBreakpoints): New prototype.
1032 2008-03-04 Greg Clayton <gclayton@apple.com>
1034 * RNBRemote.h (RNBRemote::SendHexEncodedBytePacket): New prototype.
1035 * RNBRemote.cpp (RNBRemote::SendHexEncodedBytePacket): New function.
1036 (RNBRemote::SendSTDOUTPacket): Use SendHexEncodedBytePacket function
1038 (RNBRemote::SendSTDERRPacket): Ditto.
1039 (RNBRemote::HandlePacket_q): Return a valid thread info string for
1040 qThreadExtraInfo queries.
1041 * DNB.cpp (DNBThreadPrintStopReason): Commented out unused function.
1042 (DNBThreadGetInfo): New function.
1043 * DNB.h (DNBThreadPrintStopReason): Commented out prototype.
1044 (DNBThreadGetInfo): New prototype.
1045 * MachProcess.cpp (MachProcess::GetThreadInfo): New function.
1046 * MachProcess.h (MachProcess::GetThreadInfo): New prototype.
1047 * MachThreadList.cpp (MachThreadList::GetThreadInfo): New function.
1048 * MachThreadList.h (MachThreadList::GetThreadInfo): New prototype.
1049 * MachThread.cpp (MachThread::GetBasicInfoAsString): New function.
1050 (MachThread::InferiorThreadID): New function.
1051 * MachThread.cpp (MachThread::GetBasicInfoAsString): New prototype.
1052 (MachThread::InferiorThreadID): New prototype.
1054 2008-02-27 Greg Clayton <gclayton@apple.com>
1056 * RNBRemote.cpp (RNBRemote::HandlePacket_last_signal): Set the
1057 current thread when we notify a thread has stopped to subsequent
1058 g and p packets get the correct data.
1060 2008-02-26 Jason Molenda (jmolenda@apple.com)
1062 * RNBRemote.h: Add query_thread_extra_info enum.
1063 * RNBRemote.cpp: Add support for qThreadExtraInfo.
1064 Currently we return 'Ok' as the packet status for
1067 2008-02-26 Jason Molenda (jmolenda@apple.com)
1069 * RNBRemote.cpp (RNBRemote::HandlePacket_q): Correct handling
1070 of qfThreadInfo/qsThreadInfo.
1072 2008-02-20 Jason Molenda (jmolenda@apple.com)
1074 * RNBRemote.h: Change default for gdb's max incoming packet size to
1075 reflect the real default size.
1076 * RNBRemote.cpp (HandlePacket_Q): Correct the string comparisons for
1077 the QSetMaxPayloadSize and QSetMaxPacketSize packets.
1079 2008-02-19 Christopher Friesen <friesen@apple.com>
1081 * CFDataFormatters.c: CoreFoundation data formatters added to project.
1083 2008-02-19 Jason Molenda (jmolenda@apple.com)
1085 * RNBRemote.h: Record the max payload size, not the max packet
1086 size for less ambiguous meaning.
1087 * RNBRemote.cpp: Add support for QSetMaxPayloadSize: packet which
1088 should have a clearer meaning than QSetMaxPacketSize.
1089 QSetMaxPacketSize will be removed once we get have a chance to get
1090 a new debugserver and gdb submitted.
1092 2008-02-18 Jason Molenda (jmolenda@apple.com)
1094 * RNBRemote.h: Make default size 1024.
1095 * RNBRemote.cpp: Questionmark packet should stay under
1096 max_packet_size - 5 to allow for start, end, checksum and nul
1099 2008-02-18 Jason Molenda (jmolenda@apple.com)
1101 * RNBRemote.h: Add m_max_packet_size to class defn.
1102 * RNBRemote.cpp: Initialize it, use it.
1104 2008-02-18 Jason Molenda (jmolenda@apple.com)
1106 * RNBRemote.h: Add set_max_packet_size.
1107 * RNBRemote.cpp: Add QSetMaxPacketSize packet handling.
1109 2008-02-18 Greg Clayton <gclayton@apple.com>
1111 * test-remotenub.cpp (HandleProcessStateChange): Call new
1112 RNBRemote::FlushSTDIO function.
1113 (RNBRunLoopInferiorExecuting): Ditto.
1114 * RNBRemote.h (RNBRemote::FlushSTDIO): New prototype.
1115 * RNBRemote.cpp (RNBRemote::FlushSTDIO): New function to
1116 centralize the stdio.
1118 2008-02-18 Greg Clayton <gclayton@apple.com>
1120 * DNB.cpp (DNBProcessWaitForEvent): Added timeout pointer as
1121 parameter that can be NULL for infinite timeout to simplify
1123 (DNBProcessTimedWaitForEvent): Removed function.
1124 * DNB.h (DNBProcessWaitForEvent): Added timeout argument.
1125 (DNBProcessTimedWaitForEvent): Removed prototype.
1126 * DNBTimer.h (DNBTimer::OffsetTimeOfDay): New function.
1127 * CFString.cpp (CFString::GetLength() const): New function.
1128 * CFString.h (CFString::GetLength() const): New prototype.
1129 * MachProcess.h (MachProcess class): Removed m_attached and
1131 * MachProcess.cpp (MachProcess::AttachForDebug): Set m_flags
1132 to indicate we attached.
1133 (MachProcess::SBLaunchForDebug): Set m_flags to indicate we
1134 attached using SpringBoard and that we attached.
1135 (MachProcess::SBForkChildForPTraceDebugging): Changed to new
1136 SpringBoardServices API.
1137 (MachProcess::ThreadFunctionException): Added code that will
1138 renew a watchdog assertion when we launch apps through
1139 SpringBoardServices.
1140 * PThreadEvent.cpp (PThreadEvent::WaitForSetEvents): Simplified
1141 PThreadEvent API to have only one version of WaitForSetEvents
1142 that has an optional timeout pointer argument.
1143 * RNBContext.cpp (RNBContext::StopProcessStatusThread): Adapt
1144 to new PThreadEvent API changes.
1145 (RNBContext::ThreadFunctionProcessStatus): Adapt to new
1146 DNBProcessWaitForEvent API changes.
1147 * RNBRemote.cpp (RNBRemote::StopReadRemoteDataThread): Adapt
1148 to new PThreadEvent API changes.
1149 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Adapt to new
1150 DNBProcessWaitForEvent API changes.
1151 (RNBRunLoopInferiorExecuting): Process STDIO first, then
1154 2008-02-14 Jason Molenda (jmolenda@apple.com)
1156 * MachProcess.cpp: (MachProcess::SBForkChildForPTraceDebugging):
1157 Set mode bits on secondary side of pty.
1159 2008-02-12 Greg Clayton <gclayton@apple.com>
1161 * DNB.cpp (DNBEnableLogging): Removed function.
1162 (DNBThreadPrintStopReason): Removed the file handle from this
1163 function and use DNBLog calls.
1164 * DNB.h (DNBEnableLogging): Removed function prototype.
1165 (DNBThreadPrintStopReason): Removed the file handle
1166 from the function prototype in favor of using DNBLog calls.
1167 * DNBDataRef.cpp (DNBDataRef::Dump): Removed file handle to use
1168 DNBLog for the logging and print a log line each time a full line
1169 is ready for output after caching it in a local buffer.
1170 * DNBDataRef.cpp (DNBDataRef::Dump): Removed file handle from
1172 * DNBDefs.h (DNBCallbackLog): New callback prototype for all
1174 DNBLog.cpp(g_debug_opt): Renamed to d_debug and made it a file
1176 (DNBLogGetDebug): New accessor function for g_debug.
1177 (DNBLogSetDebug): New accessor function for g_debug.
1178 (g_verbose): Made into a file static and added accessors.
1179 (DNBLogGetVerbose): New accessor function for g_verbose.
1180 (DNBLogSetVerbose): New accessor function for g_verbose.
1181 (DNBLogSetLogCallback): New function call that registers a logging
1182 callback for all logging in libdebugnub.dylib and any code that
1184 (DNBLogToASL): Removed function as it is deprecated in favor of
1185 using DNBLogSetLogCallback to register a callback function that
1186 implements the logging.
1187 (DNBLogToFile): Ditto.
1188 (DNBLogCloseLogFile): Ditto.
1189 (DNBLogToFile): Ditto.
1190 (DNBLogToFile): Ditto.
1191 (_DNBLogPuts): Removed unused function.
1192 (_DNBLogVAPrintf): Calls the callback function to do the logging
1193 if one has been registered.
1194 * DNBLog.h (DNBLOG_FLAG_FATAL): New defines that get passed to
1195 any registered logging callback functions.
1196 (DNBLOG_FLAG_FATAL): Ditto.
1197 (DNBLOG_FLAG_ERROR): Ditto.
1198 (DNBLOG_FLAG_WARNING): Ditto.
1199 (DNBLOG_FLAG_DEBUG): Ditto.
1200 (DNBLOG_FLAG_VERBOSE): Ditto.
1201 (DNBLOG_FLAG_THREADED): Ditto.
1202 (DNBLog*): All logging calls are now exported from libdebugnub.dylib
1203 so there aren't two copies (one in debugserver and one in debugnub).
1204 C99 vararg Macros wrap all logging calls so no var arg processing
1205 occurs when logging is disabled.
1206 * DNBRegisterInfo.cpp (DNBRegisterValueClass::Dump): Removed file
1207 handle and now use DNBLog calls.
1208 * DNBRegisterInfo.h (DNBRegisterValueClass::Dump): Removed file
1209 handle from prototype.
1210 * MachException.cpp (catch_mach_exception_raise_state_identity):
1211 Removed newlines from logging call.
1212 (catch_mach_exception_raise): Ditto.
1213 (MachException::Message::Dump): Removed file handle from params
1214 and removed newlines from logging call.
1215 (MachException::ThreadMessage::DumpStopReason): Removed file handle
1216 from params and use DNBLog for logging output.
1217 (MachException::ThreadMessage::Dump): Log using DNBLog instead of
1219 * MachProcess.cpp (MachProcess::DumpThreadStoppedReason): Ditto.
1220 (MachProcess::ReadMemory): Ditto.
1221 (MachProcess::WriteMemory): Ditto.
1222 (ExceptionMessageBundleComplete): Ditto.
1223 * MachThread.cpp (MachThread::Dump): Ditto.
1224 (MachThread::DumpRegisterState): Ditto.
1225 * MachThreadList.cpp (MachThreadList::DumpThreadStoppedReason): Ditto.
1226 (MachThreadList::Dump): Ditto.
1227 * RNBRemote.cpp (set_logging): Use new function callback registration
1228 calls when enabling ASL logging.
1229 test-remotenub.cpp (ASLLogCallback): New function to handle all ASL
1230 logging. This function gets registered with libdebugnub.dylib when we
1231 want to log using ASL.
1232 (FileLogCallback): New function to handle all file logging. This
1233 function gets registered with libdebugnub.dylib when we want to log
1235 (main): Register the logging callback functions when we want to log
1236 to file or using ASL.
1238 2008-02-12 Greg Clayton <gclayton@apple.com>
1240 * test-remotenub.cpp (main): Default to ASL logging with no log
1241 bits set to allow for warning and error logging.
1242 * RNBRemote.h (struct Breakpoint): New structure for ref counting
1243 breakpoints in Z and z packets.
1244 * RNBRemote.cpp (RNBRemote::SendPacket): Use new LOG_RNB_PACKETS
1245 defined when logging actual packet content.
1246 (RNBRemote::HandleAsyncPacket): Ditto.
1247 (RNBRemote::HandleReceivedPacket): Ditto.
1248 (RNBRemote::HandlePacket_z): Ref count the setting and removing
1249 of breakpoints with the Z and z packets using new struct
1250 RNBRemote::Breakpoint.
1251 * RNBDefs.h (LOG_RNB_PACKETS): New define for logging the sending
1252 and receiving of packets data.
1253 * DNB.cpp (DNBPrintf): Check for NULL file handle.
1254 * DNBBreakpoint.cpp (DNBBreakpoint::Dump): Ditto.
1255 (DNBBreakpointList::Dump): Ditto.
1256 * DNBDefs.h (LOG_EVENTS): New define for logging PThreadEvent.
1257 * DNBLog.cpp (g_debug_opt): Relocated outside of #if that turns off
1258 logging completely to allow option parsing code that uses it to
1261 * DNBLog.h (DNBLogToASL): Added prototype for when logging is
1262 disabled via preprocessor macro.
1263 (DNBLogToFile): Ditto.
1264 * DNBRegisterInfo.cpp (DNBRegisterValueClass::Dump): Check for NULL
1266 * MachException.cpp (MachException::ThreadMessage::DumpStopReason): Ditto.
1267 (MachException::ThreadMessage::Dump): Ditto.
1268 * MachProcess.cpp (MachProcess::CreateBreakpoint): Improved logging.
1269 (MachProcess::DisableBreakpoint): Verify the original opcode gets
1270 restored, improved logging and added unconditional logging for when
1272 (MachProcess::EnableBreakpoint): Verify the breakpoint opcode gets
1273 written, improved logging and added unconditional logging for when
1275 * MachThread.cpp (MachThread::Dump): Check for NULL file handle.
1276 * MachVMMemory.cpp (MachVMMemory::WriteRegion): Flush caches in inferior
1277 after writing to inferior memory.
1278 * PThreadEvent.cpp: Changed all logging calls to key off of LOG_EVENTS
1279 instead of LOG_VERBOSE.
1280 MachDYLD.cpp (MachDYLD::Dump): Check for NULL file handle.
1281 (MachDYLD::DYLIBInfo::Dump): Ditto.
1282 ProfileObjectiveC.cpp (ProfileObjectiveC::DumpStats): Ditto.
1284 2008-02-09 Jason Molenda (jmolenda@apple.com)
1286 * RNBRemote.cpp (set_logging): Log to ASL unconditionally when
1287 processing a QSetLogging packet.
1289 2008-02-06 Greg Clayton <gclayton@apple.com>
1291 * test-remotenub.cpp (main): Dup stdout and stderr to /dev/NULL
1292 when we use lockdown.
1294 2008-02-06 Greg Clayton <gclayton@apple.com>
1296 * RNBSocket.cpp (RNBSocket::Disconnect): Removed unused var ERR.
1297 * RNBRemote.cpp(RNBRemote::HandlePacket_Q): Removed unused var PID.
1298 * DNBError.cpp (DNBError::LogThreadedIfError): Removed unused var
1300 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Removed unused
1301 variable EXECUTABLE_LENGTH.
1302 (main): Removed unused variable ARG_IDX.
1304 2008-02-06 Chris Marcellino (cmarcellino@apple.com) and Myke Olson (molson@apple.com)
1306 * MachProcess.cpp (SBForkChildForPTraceDebugging): Bring up to date with
1307 current SpringBoardServices.framework types and imports.
1309 2008-02-05 Jason Molenda (jmolenda@apple.com)
1311 * RNBRemote.cpp (set_logging): Remove the mode=file and filename=
1312 options to the QSetLogging packet. We're only going to support logging
1313 to ASL for now. Logging to a file can still be accomplished by the
1314 -l command line argument.
1316 2008-02-02 Christopher Friesen (cfriesen@apple.com)
1318 * Added libXcodeDebugerSupport.dylib target
1319 * XCDebuggerIntrospection.[hc]: Support for Xcode's debugger introspection.
1321 2008-02-01 Jason Molenda (jmolenda@apple.com)
1323 * DNBLog.cpp (DNBLogCloseLogFile): New function to close a logfile
1325 * DNBLog.h: Prototype.
1326 * test-remotenub.cpp (main): Close the log file before exiting.
1328 2008-02-01 Jason Molenda (jmolenda@apple.com)
1330 * RNBRemote.cpp (set_logging): Recognize the "filename=" argument
1331 to the QSetLogging directive.
1332 * DNBLog.cpp (DNBLogGetLogMask): New fun.c
1333 * DNBLog.h: Prototype.
1335 2008-01-31 Jason Molenda (jmolenda@apple.com)
1337 * DNBLog.cpp: Add ASL logging as a run-time selectable option.
1338 (DNBLogToASL, DNBLogToFile): Functions to switch between logging to
1339 a file and logging via ASL.
1340 * DNBLog.h: Prototypes.
1341 * RNBRemote.cpp (set_logging): Recognize the "mode=" field to enable
1342 asl logging. Skip unrecognized keys.
1344 2008-01-31 Greg Clayton (gclayton@apple.com)
1346 * DNB.cpp (sigchld_handler): Better logging when we get a
1347 SIGCHILD and we are watching for process related logging events.
1348 * test-remotenub.cpp (RNBRunLoopInferiorExecuting): Only reset
1349 events when we still have event bits set.
1351 2008-01-29 Jason Molenda (jmolenda@apple.com)
1353 * RNBRemote.h: Add set_logging_mode.
1354 * RNBRemote.cpp (RNBRemote::CreatePacketTable): Recognize
1357 2008-01-29 Jason Molenda (jmolenda@apple.com)
1359 * RNBRemote.cpp (set_logging): New function to parse the QSetLogging
1361 (RNBRemote::HandlePacket_Q): Call it.
1363 2008-01-28 Jason Molenda (jmolenda@apple.com)
1365 * RNBRemote.h: Minimal packet size is 1024 in our gdb now.
1366 * RNBRemote.cpp: Add the stop_pc value in big-endian order to the
1367 T response packet to make it a little easier to follow where gdb
1370 2008-01-28 Greg Clayton <gclayton@apple.com>
1372 * RNBContext.h: Removed m_pid_state from RNBContext class so that
1373 it couldn't get out of sync with the actual process and its accessors
1374 SetProcessState() and GetProcessState().
1375 * RNBContext.cpp (RNBContext::ProcessStateRunning): Always return the
1376 current state of the process instead of a cached value.
1377 * test-remotenub.cpp (RNBRunLoopLaunchInferior): Remove call to
1378 deprecated RNBContext::SetProcessState().
1379 (HandleProcessStateChange): Ditto.
1381 2008-01-24 Greg Clayton (gclayton@apple.com)
1383 * RNBRemote.cpp (RNBRemote::HandlePacket_q): See if command starts with
1384 "qSymbol" (no trailing "s") and return the empty string.
1386 2008-01-24 Greg Clayton (gclayton@apple.com)
1388 * RNBRemote.cpp (RNBRemote::HandlePacket_q): See if command starts with
1389 "qSymbols" and return the empty string.
1391 2008-01-24 Greg Clayton (gclayton@apple.com)
1393 * DNBError.h (DNBError::DumpIfError): Removed prototype.
1394 * DNBError.cpp (DNBError::DumpIfError): Removed function.
1395 (DNBError::LogThreadedIfError): Output error as hex.
1396 * MachException.cpp (MachException::Message::Receive): Don't use
1397 DNBError::DumpIfError, now use DNBError::LogThreadedIfError.
1398 * MachProcess.cpp (MachProcess::StartExceptionThread): Ditto.
1399 (MachProcess::Suspend): Ditto.
1400 (MachProcess::SBForkChildForPTraceDebugging): Ditto.
1401 * MachVMMemory.cpp (MachVMMemory::Read): Cleaned up logging
1403 (MachVMMemory::Write): Ditto.
1404 (MachVMMemory::WriteRegion): Added logging.
1405 * RNBContenxt.cpp (display_thread_info): Removed function.
1406 * RNBRemote.cpp (RNBRemote::GetPacket): Commented out stderr
1407 messages to avoid SpringBoard from killing us.
1408 (RNBRemote::HandlePacket_p): Ditto.
1409 (RNBRemote::HandlePacket_P): Ditto.
1410 (RNBRemote::HandlePacket_c): Ditto.
1411 (RNBRemote::HandlePacket_A): Removed code that was already
1412 * RNBSocket.cpp (RNBSocket::Listen): Commented out stdout
1413 messages to avoid SpringBoard from killing us.
1414 (RNBSocket::ConnectToService): Ditto.
1416 2008-01-24 Jim Ingham <jingham@apple.com>
1418 * RNBRemote.cpp (RNBRemote::HandlePacket_q): Reply "" to qSymbols
1421 2008-01-23 Jason Molenda (jmolenda@apple.com)
1423 * RNBRemote.h: m_noack_mode to RNBRemote class.
1424 * RNBRemote.cpp: Change #ifdef NO_ACKS code blocks
1425 to use m_noack_mode instance variable.
1426 (RNBRemote::HandlePacket_Q): New function to handle
1427 QStartNoAckMode packet and set m_noack_mode appropriately.
1428 * test-remotenub.cpp: Remove NO_ACKS ifdefs.
1430 2008-01-22 Jason Molenda (jmolenda@apple.com)
1432 * RNBRemote.cpp (RNBRemote::CreatePacketTable): Recognize
1433 QStartNoAckMode as an unsupported remote protocol request.
1434 * RNBRemote.h: Add start_noack_mode enum entry.
1436 2008-01-22 Greg Clayton (gclayton@apple.com)
1438 * DNBLog.h: Removed C++ namespace for DNBLog (changed all DNBLog::
1439 to DNBLog) so C99 var arg macros can be used to completely disable
1440 all logging and any functions that may be called when making the
1442 * DNBLog.cpp: Ditto.
1444 * DNBBreakpoint.cpp: Ditto.
1445 * DNBError.cpp: Ditto.
1446 * MacOSX/MachDYLD.cpp: Ditto.
1447 * MacOSX/MachException.cpp: Ditto.
1448 * MacOSX/MachProcess.cpp: Ditto.
1449 * MacOSX/MachThread.cpp: Ditto.
1450 * MacOSX/MachThreadList.cpp: Ditto.
1451 * MacOSX/MachVMMemory.cpp: Ditto.
1452 * MacOSX/MachVMRegion.cpp: Ditto.
1453 * MacOSX/arm/DNBArchImpl.cpp: Ditto.
1454 * MacOSX/ppc/DNBArchImpl.cpp: Ditto.
1455 * PThreadEvent.cpp: Ditto.
1456 * RNBContext.cpp: Ditto.
1457 * RNBRemote.cpp: Ditto.
1458 * RNBSocket.cpp: Ditto.
1459 * test-remotenub.cpp: Ditto.
1461 2008-01-21 Jason Molenda (jmolenda@apple.com)
1463 * test-remotenub.cpp: Add NO_SPRINGBOARD for turning off SpringBoard
1464 dependency ala NO_ACKS.
1466 2008-01-18 Jason Molenda (jmolenda@apple.com)
1468 * RNBSocket.h (RNBSocket::RNBSocket): Take either a port # or
1469 an already-opened socket, with a boolean to indicate which it is.
1470 * RNBRemote.cpp (RNBRemote::RNBRemote): Ditto.
1471 * RNBRemote.h: Prototype update.
1472 * test-remotenub.cpp: Include lockdown.h. Take --lockdown command
1473 line arg, get the socket from liblockdown.dylib instead of opening
1474 our own socket if it is specified. --lockdown indicates that
1475 the program name/args will be provided via remote protocol instead
1476 of on the command line.
1478 2008-01-17 Jason Molenda (jmolenda@apple.com)
1480 * RNBRemote.cpp: Add NO_ACKS #ifdefs around code that computes
1481 the checksums and sends/expects the gdb remote protocol ACK packets.
1482 If NO_ACKS is defined, debugserver will not send or expect acks.
1483 * test-remotenub.cpp (main): Print a different version string
1484 if NO_ACKS is defined.
1486 2008-01-16 Greg Clayton (gclayton@apple.com)
1488 * PThreadEvent.cpp: Added this pointer to all logging calls.
1490 2008-01-16 Greg Clayton (gclayton@apple.com)
1492 * RNBSocket.cpp (RNBSocket::Connect()): Use TCP so we can try the
1493 TCP_NODELAY socket option.
1494 (RNBSocket::SetSocketOption()): New function.
1495 * RNBSocket.h (RNBSocket::SetSocketOption()): New class function.
1497 2008-01-14 Jason Molenda (jmolenda@apple.com)
1499 * RNBRemote.cpp (RNBRemote::HandlePacket_last_signal): When printing
1500 registers, skip over gdb regs which don't map to DNB regs.
1502 2008-01-14 Jim Ingham <jingham@apple.com>
1504 * ChangeLog - created.
1505 * RBNContext.h: Added m_arg_vec and accessors.
1506 * RNBContext.cpp (SetProcessID): New function.
1507 * RBNRemote.h: Added packet type to HandlePacket & HandleAsyncPacket
1508 * RNBRemote.cpp (HandlePacket, HandleAsyncPacket): Return type.
1509 (HandlePacket_A): Fix a few bugs.
1510 (HandlePacket_H): Return OK if target is not yet running.
1511 (HandlePacket_q): Return PID of 0 if target is not yet running.
1512 * testremotenub.cpp (RNBRunLoopGetArgsFromRemote): Implement.
1513 (RNBRunLoopLaunchInferior): Fetch arguments from context.
1514 (main) Store arguments in context, call RNBRunLoopGetArgsFromRemote