xref: /openbsd-src/gnu/llvm/lldb/tools/debugserver/source/ChangeLog (revision dda2819751e49c83612958492e38917049128b41)
1061da546Spatrick2010-01-29  Greg Clayton  <gclayton@apple.com>
2061da546Spatrick
3061da546Spatrick	* MachProcess.cpp (MachProcess::PrepareForAttach): No longer use the
4061da546Spatrick	SBSLaunchApplication macro from the SpringBoard.framework, use the actual
5061da546Spatrick	function name SBSLaunchApplicationForDebugging.
6061da546Spatrick	(MachProcess::CleanupAfterAttach): Ditto.
7061da546Spatrick	(MachProcess::SBForkChildForPTraceDebugging): Ditto.
8061da546Spatrick	(debugserver-entitlements.plist): Added the "seatbelt-profiles" entitlement
9061da546Spatrick	so debugserver can be sandboxed.
10061da546Spatrick
11061da546Spatrick2009-07-06  Greg Clayton  <gclayton@apple.com>
12061da546Spatrick
13061da546Spatrick	* MachTask.cpp (MachTask::GetDYLDAllImageInfosAddress): Hack around bad
14061da546Spatrick	kernel code that renamed the first member of the TASK_DYLD_INFO without
15061da546Spatrick	any way to detect it has changed.
16061da546Spatrick
17061da546Spatrick2009-06-29  Greg Clayton  <gclayton@apple.com>
18061da546Spatrick
19061da546Spatrick	* DNB.cpp (GetAllInfosMatchingName): Correctly truncate process name string
20061da546Spatrick	to MAXCOMLEN when searching kinfo_proc structs for process matches by name.
21061da546Spatrick	* MachProcess.cpp (MachProcess::PrepareForAttach): Added logging when
22061da546Spatrick	attaching to a program by name.
23061da546Spatrick
24061da546Spatrick2009-06-25  Greg Clayton  <gclayton@apple.com>
25061da546Spatrick
26061da546Spatrick	* DNB.cpp (DNBProcessLaunch): Added a stat on the incoming path that we are
27061da546Spatrick	about to launch to make sure the file exists. If the file doesn't, then an
28061da546Spatrick	appropriate error string is returned. Also if we fail to get the task for
29061da546Spatrick	our process ID, we return an error string right away instead of letting the
30061da546Spatrick	debug session go for a little bit and then later failing after a few more
31061da546Spatrick	packets.
32061da546Spatrick
33061da546Spatrick2009-04-07  Jim Ingham  <jingham@apple.com>
34061da546Spatrick
35061da546Spatrick    * RNBRemote.h: Add vAttachWait
36061da546Spatrick	* RNBRemote.cpp (RNBRemote::CreatePacketTable): Add vattachwait.
37061da546Spatrick	(RNBRemoteShouldCancelCallback): New function.
38061da546Spatrick	(RNBRemote::HandlePacket_v): Handle vattachwait.
39061da546Spatrick	* RNBSocket.cpp (RNBSocket::Read): Mark the connection as closed when the
40061da546Spatrick	port goes away.
41061da546Spatrick	* DNB.cpp (DNBProcessAttachByName): New function.
42061da546Spatrick	(DNBProcessAttach): Make this handle catching the attach when done and
43061da546Spatrick	dealing with timeout & return conditions.
44061da546Spatrick	(GetAllInfos): New function.
45061da546Spatrick	(GetAlInfosMatchingName): New function.
46061da546Spatrick	(DNBProcessAttachWait): New function.
47061da546Spatrick	DNB.h: Declare DNBProcessAttachByName, DNBProcessAttachWait, change
48061da546Spatrick	signature of DNBProcessAttach.
49061da546Spatrick	* MachProcess.cpp (MachProcess::PrepareForAttach): New function.
50061da546Spatrick	(MachProcess::CheckForProcess): New function.
51061da546Spatrick	(MachProcess::CleanupAfterAttach): New function.
52061da546Spatrick	(CopyBundleIDForPath): New function.
53061da546Spatrick	(MachProcess::SBForkChildForPTraceDebugging): Convert to using
54061da546Spatrick	CopyBundleIDForPath.
55061da546Spatrick	* MachProcess.h: Declare PrepareForAttach, CleanupAfterAttach and
56061da546Spatrick	CheckForProcess.
57061da546Spatrick    * DNBTimer.h (TimeOfDayLaterThan): New function.
58061da546Spatrick	* test-remotenub.cpp (RNBRunLoopGetStartModeFromRemote): Rename from
59061da546Spatrick	RNBRunLoopGetArgsFromRemote, and handle vattachwait.
60061da546Spatrick	(RNBRunLoopLaunchAttaching): Code was moved from here into DNBProcessAttach.
61061da546Spatrick	(StartListening): New function.
62061da546Spatrick	(GetAllProcessInfos, GetAllProcessInfosMatchingName): Moved to
63061da546Spatrick	DNBProcess.cpp.
64061da546Spatrick	(main): Handle attach waitfor, and make debugserver with only a host and
65061da546Spatrick	port wait on commands from gdb.
66061da546Spatrick
67061da546Spatrick2009-04-03  Greg Clayton  <gclayton@apple.com>
68061da546Spatrick
69061da546Spatrick	* RNBRemote.h (PacketEnum): Added enum for qShlibInfoAddr.
70061da546Spatrick	* RNBRemote.cpp (RNBRemote::CreatePacketTable) Added the qShlibInfoAddr
71061da546Spatrick	packet definition to m_packets.
72061da546Spatrick	(RNBRemote::GetPacket): Log when we run into an unimplemented packet.
73061da546Spatrick	(RNBRemote::HandleReceivedPacket): Only log the packet when logging
74061da546Spatrick	LOG_RNB_REMOTE.
75061da546Spatrick	(RNBRemote::HandlePacket_q): Add support for the new qShlibInfoAddr packet.
76061da546Spatrick	* DNB.h (DNBProcessGetSharedLibraryInfoAddress): New prototype.
77061da546Spatrick	* DNB.cpp (DNBProcessGetSharedLibraryInfoAddress): New function.
78061da546Spatrick	* MachTask.h (MachProcess::GetDYLDAllImageInfosAddress): New prototype.
79061da546Spatrick	* MachTask.cpp (MachProcess::GetDYLDAllImageInfosAddress): New function.
80061da546Spatrick
81061da546Spatrick2009-04-01  Greg Clayton  <gclayton@apple.com>
82061da546Spatrick
83061da546Spatrick	* test-remotenub.cpp (main): Display the detailed error message if any when
84061da546Spatrick	attaching fails.
85061da546Spatrick
86061da546Spatrick2009-03-25  Greg Clayton  <gclayton@apple.com>
87061da546Spatrick
88061da546Spatrick	* test-remotenub.cpp (RNBRunLoopGetArgsFromRemote): Cleaned up logging and
89061da546Spatrick	removed time deltas form the messages.
90061da546Spatrick	(RNBRunLoopLaunchAttaching): Ditto.
91061da546Spatrick	(RNBRunLoopLaunchInferior): Ditto and also use new DNBProcessLaunch that
92061da546Spatrick	takes an error string pointer.
93061da546Spatrick	* RNBContext.h (class RNBContext): Removed the m_timer member.
94061da546Spatrick	* RNBContext.cpp (RNBContext::StartProcessStatusThread): Cleaned up logging
95061da546Spatrick	and removed time deltas form the messages.
96061da546Spatrick	(RNBContext::ThreadFunctionProcessStatus): Ditto.
97061da546Spatrick	* RNBSocket.h (class RNBSocket): Removed unused m_last_errno member and
98061da546Spatrick	accessor functions.
99061da546Spatrick	* RNBSocket.cpp (RNBSocket::Listen): Cleaned up logging  and
100061da546Spatrick	removed time deltas form the messages.
101061da546Spatrick	(RNBSocket::ConnectToService): Ditto.
102061da546Spatrick	(RNBSocket::Read): Ditto.
103061da546Spatrick	(RNBSocket::Write): Ditto.
104061da546Spatrick	(RNBSocket::SaveErrno): Removed.
105061da546Spatrick	(RNBSocket::ClosePort): Don't call RNBSocket::SaveErrno().
106061da546Spatrick	* RNBRemote.cpp (RNBRemote::RNBRemote): Cleaned up logging  and
107061da546Spatrick	removed time deltas form the messages.
108061da546Spatrick	(RNBRemote::~RNBRemote): Ditto.
109061da546Spatrick	(RNBRemote::SendPacket): Ditto.
110061da546Spatrick	(RNBRemote::GetPacketPayload): Ditto.
111061da546Spatrick	(RNBRemote::GetPacket): Ditto): Ditto.
112061da546Spatrick	(RNBRemote::HandleAsyncPacket): Ditto.
113061da546Spatrick	(RNBRemote::HandleReceivedPacket): Ditto.
114061da546Spatrick	(RNBRemote::CommDataReceived): Ditto.
115061da546Spatrick	* DNB.cpp (DNBProcessLaunch): Changed to take a eror string pointer with
116*dda28197Spatrick	size for more descriptive error reporting (instead of a uint32_t pointer).
117061da546Spatrick	* DNB.h (DNBProcessLaunch): Ditto.
118061da546Spatrick	* DNBError.cpp (DNBError::AsString): Now returns NULL if there is no error.
119061da546Spatrick	* DNBError.h (DNBError::SetErrorString): New accessor to allow custom error
120061da546Spatrick	strings.
121061da546Spatrick	* arm/DNBArchImpl.cpp (DNBArchMachARM::GetGPRState): Improved logging.
122061da546Spatrick	* MachProcess.cpp (MachProcess::SBForkChildForPTraceDebugging): Improved
123061da546Spatrick	error messages when a file doesn't exist, or when unable to extract the
124061da546Spatrick	CFBundleIdentifier.
125061da546Spatrick	* PThreadEvent.cpp (class PThreadEvent): Commented out all logging calls.
126061da546Spatrick
127061da546Spatrick2009-03-07  Greg Clayton  <gclayton@apple.com>
128061da546Spatrick
129061da546Spatrick	* test-remotenub.cpp (GetAllProcessInfosMatchingName): New function that
130061da546Spatrick	returns matching kinfo_proc structs given a process name.
131061da546Spatrick	(main): Enhanced the --attach option to be able to take a PROCNAME or
132061da546Spatrick	a PID. Changed the --waitfor=PROCNAME option to ignore any existing
133061da546Spatrick	processes with PROCNAME so we only catch new process invocations.
134061da546Spatrick
135061da546Spatrick2009-03-07  Greg Clayton  <gclayton@apple.com>
136061da546Spatrick
137061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_p): Use the correct get current
138061da546Spatrick	thread function call so we get the correct thread registers.
139061da546Spatrick
140061da546Spatrick2009-03-03  Greg Clayton  <gclayton@apple.com>
141061da546Spatrick
142061da546Spatrick	* test-remotenub.cpp (g_isatty): New global that gets set to non-zero if
143061da546Spatrick	STDOUT is a TTY in the beginning of main.
144061da546Spatrick	(RNBLogSTDOUT): New macro that logs to STDOUT if g_isatty is non-zero, else
145061da546Spatrick	it logs to asl.
146061da546Spatrick	(RNBLogSTDERR): New macro that logs to STDERR if g_isatty is non-zero, else
147061da546Spatrick	it logs to asl.
148061da546Spatrick	(RNBRunLoopGetArgsFromRemote): Use new RNBLogSTDOUT/RNBLogSTDERR macros.
149061da546Spatrick	(GetAllProcessInfos): Get all process info structs for everything on the
150061da546Spatrick	system.
151061da546Spatrick	(main): Implemented new --waitfor=NAME option to allow waiting for a process
152061da546Spatrick	to run by polling the system processes. The new --waitfor-interval=N option
153061da546Spatrick	allows fine control over the polling interval where N is the number of mirco
154061da546Spatrick	seconds (usec) to wait between polls (defaults to 1000). The new
155061da546Spatrick	--waitfor-duration=N allows	a timeout in seconds to be specified when
156061da546Spatrick	waiting for a process (defaults	to infinite).
157061da546Spatrick
158061da546Spatrick2009-03-02  Greg Clayton  <gclayton@apple.com>
159061da546Spatrick
160061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup):
161061da546Spatrick	Take care of a case where no instructions execute in a Thumb IT block and
162061da546Spatrick	the last of which is a branch.
163061da546Spatrick
164061da546Spatrick2009-02-10  Greg Clayton  <gclayton@apple.com>
165061da546Spatrick
166061da546Spatrick	* RNBRemote.h (PacketEnum): Added 'detach' enumeration.
167061da546Spatrick	(RNBRemote::HandlePacket_D): New member function prototype.
168061da546Spatrick	* RNBRemote.cpp (RNBRemote::CreatePacketTable): Added detach support.
169061da546Spatrick	(RNBRemote::HandlePacket_D): New function for detach support.
170061da546Spatrick
171061da546Spatrick2009-02-10  Greg Clayton  <gclayton@apple.com>
172061da546Spatrick
173061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_UNIMPLEMENTED): Log this
174061da546Spatrick	packet with the packet that is unimplemented.
175061da546Spatrick	(RNBRemote::GetPacket): Call RNBRemote::HandlePacket_UNIMPLEMENTED()
176061da546Spatrick	when we don't recognize a packet.
177061da546Spatrick	(RNBRemote::HandleReceivedPacket): Don't reply to packets we don't
178061da546Spatrick	recognize with unimplemented in this function as that should have
179061da546Spatrick	already been done for us in RNBRemote::GetPacket().
180061da546Spatrick
181061da546Spatrick2009-02-10  Greg Clayton  <gclayton@apple.com>
182061da546Spatrick
183061da546Spatrick	* RNBRemote.h (PacketEnum): Added query_step_packet_supported.
184061da546Spatrick	* RNBRemot.cpp (RNBRemote::CreatePacketTable): Added new
185061da546Spatrick	qStepPacketSupported packet.
186061da546Spatrick	(RNBRemote::HandlePacket_q): Added support for the new
187061da546Spatrick	"qStepPacketSupported" packet.
188061da546Spatrick	(RNBRemote::HandlePacket_G): Some cleanup when reading registers
189061da546Spatrick	to avoid spurious console logging.
190061da546Spatrick
191061da546Spatrick2009-01-30  Greg Clayton  <gclayton@apple.com>
192061da546Spatrick
193061da546Spatrick	* debugserver-entitlements.plist: Changed the entitlement
194061da546Spatrick	"run-invalid-allow" to "run-unsigned-code".
195061da546Spatrick
196061da546Spatrick2009-01-23  Greg Clayton  <gclayton@apple.com>
197061da546Spatrick
198061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup):
199061da546Spatrick	Merged Yusuf's changes to make software single stepping work.
200061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Call new
201061da546Spatrick	DNBResolveExecutablePath function to resolve executable paths.
202061da546Spatrick	* DNB.h (DNBResolveExecutablePath): New function prototype.
203061da546Spatrick	* DNB.cpp (DNBResolveExecutablePath): New function that will resolve
204061da546Spatrick	relative paths and also executable paths for executables that aren't relative
205061da546Spatrick	but yet are in the shell PATH environment variable.
206061da546Spatrick
207061da546Spatrick2009-01-22  Greg Clayton  <gclayton@apple.com>
208061da546Spatrick
209061da546Spatrick	* DNBArchImpl.h (class DBNArchMachARM): Renamed member variable
210061da546Spatrick	m_chained_hw_single_step_addr to m_hw_single_chained_step_addr. Added
211061da546Spatrick	new member variables: m_sw_single_step_itblock_break_id, m_last_decode_pc,
212061da546Spatrick	and m_sw_single_step_itblock_break_count. Renamed m_thumbStaticData to
213061da546Spatrick	m_last_decode_thumb, and renamed m_decodedInstruction to m_last_decode_arm.
214061da546Spatrick	(DBNArchMachARM::DecodeITBlockInstructions): New prototype.
215061da546Spatrick	(DBNArchMachARM::DecodeInstructionUsingDisassembler): New prototype.
216061da546Spatrick    (DBNArchMachARM::BreakpointHit): New prototype.
217061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::ThreadDidStop): Disable any of the
218061da546Spatrick	many software single step breakpoints if any are set.
219061da546Spatrick	(DNBArchMachARM::StepNotComplete): Changed renamed member accesses.
220061da546Spatrick	(DNBArchMachARM::DecodeITBlockInstructions): New function for software
221061da546Spatrick	single stepping through Thumb IT blocks.
222061da546Spatrick	(DNBArchMachARM::EnableHardwareSingleStep): Cleaned up logging.
223061da546Spatrick	(DNBArchMachARM::ComputeNextPC): Ditto.
224061da546Spatrick	(DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup): Now
225061da546Spatrick	properly handles Thumb IT software single stepping.
226061da546Spatrick	(DNBArchMachARM::SetSingleStepSoftwareBreakpoints): Ditto.
227061da546Spatrick	(DNBArchMachARM::DecodeInstructionUsingDisassembler): New function.
228061da546Spatrick	(DNBArchMachARM::BreakpointHit): New breakpoint callback function.
229061da546Spatrick
230061da546Spatrick2009-01-21  Greg Clayton  <gclayton@apple.com>
231061da546Spatrick
232061da546Spatrick	* MachProcess.cpp (MachProcess::PrivateResume): Set the process state before
233061da546Spatrick	we actually resume so we are sure to get the events in the correct order.
234061da546Spatrick
235061da546Spatrick2009-01-16  Greg Clayton  <gclayton@apple.com>
236061da546Spatrick
237061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_last_signal): Include only
238061da546Spatrick	registers which are to be expedited in the T packets.
239061da546Spatrick	(RNBRemote::HandlePacket_p): Enable for all targets.
240061da546Spatrick	(struct register_map_entry): Added an expedite member so we know which
241061da546Spatrick	registers need to be sent up to the host with each stop reply packet.
242061da546Spatrick	(register_map): Updated each array members' expedite member with an
243061da546Spatrick	appropriate value.
244061da546Spatrick
245061da546Spatrick2009-01-16  Greg Clayton  <gclayton@apple.com>
246061da546Spatrick
247061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_s): Enabled the step command ("s"
248061da546Spatrick	packet) for ARM now that libdebugnub.dylib can do both hardware and software
249061da546Spatrick	single stepping.
250061da546Spatrick
251061da546Spatrick2009-01-13  Greg Clayton  <gclayton@apple.com>
252061da546Spatrick
253061da546Spatrick	*DNBArchImpl.cpp (bit): New function.
254061da546Spatrick	(bits): New function.
255061da546Spatrick	(DNBArchMachARM::ConditionPassed): Use new "bit" function.
256061da546Spatrick	(DNBArchMachARM::ComputeNextPC): Use new "bit" function, remove inline
257061da546Spatrick	assembly for "RSC" instruction so this compiles for armv7 (which defaults
258061da546Spatrick	to thumb)
259061da546Spatrick	(DNBArchMachARM::NumSupportedHardwareBreakpoints): Use new "bits" function.
260061da546Spatrick	(DNBArchMachARM::NumSupportedHardwareWatchpoints): Use new "bits" function.
261061da546Spatrick
262061da546Spatrick2009-01-12  Greg Clayton  <gclayton@apple.com>
263061da546Spatrick
264061da546Spatrick	* DNBArch.h (DNBArchProtocol::NumSupportedHardwareBreakpoints()): Removed
265061da546Spatrick	the "const" qualifier to allow arches to auto detect how many hardware
266061da546Spatrick	breakpoints they have.
267061da546Spatrick	(DNBArchProtocol::NumSupportedHardwareWatchpoints()): Removed the "const"
268061da546Spatrick	qualifier to allow arches to auto detect how many hardware watchpoints they
269061da546Spatrick	have.
270061da546Spatrick	* DNBArchImpl.h (DNBArchMachARM::NumSupportedHardwareBreakpoints()): Auto
271*dda28197Spatrick	detect how many BRP pairs are available and disable for armv7 for the time
272061da546Spatrick	being (rdar://problem/6372672).
273061da546Spatrick	(DNBArchMachARM::NumSupportedHardwareWatchpoints()): Auto detect how many
274*dda28197Spatrick	WRP pairs are available and disable for armv7 for the time being
275061da546Spatrick	(rdar://problem/6372672).
276061da546Spatrick
277061da546Spatrick2009-01-09  Greg Clayton  <gclayton@apple.com>
278061da546Spatrick
279061da546Spatrick	* test-remotenub.cpp (main): Filled in short argument versions for
280061da546Spatrick	--applist (-t) and --lockdown (-k) options.
281061da546Spatrick	* DNBArchImpl.h (DNBArchMachARM::ConditionPassed): New protected
282061da546Spatrick	member function.
283061da546Spatrick	(DNBArchMachARM::ComputeNextPC): New protected member function.
284061da546Spatrick	(DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup): New
285061da546Spatrick	protected member function.
286061da546Spatrick	(DNBArchMachARM::m_thumbStaticData): New protected member variable.
287061da546Spatrick	(DNBArchMachARM::m_decodedInstruction): New protected member variable.
288061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::ThreadDidStop): Added extra code that
289061da546Spatrick	will log and exit when we are verifying software single stepping (a
290061da546Spatrick	compile time option).
291061da546Spatrick	(DNBArchMachARM::ConditionPassed): New function.
292061da546Spatrick	(DNBArchMachARM::ComputeNextPC): New function.
293061da546Spatrick	(DNBArchMachARM::EvaluateNextInstructionForSoftwareBreakpointSetup): New
294061da546Spatrick	function.
295061da546Spatrick	(DNBArchMachARM::SetSingleStepSoftwareBreakpoints): Added the guts of the
296061da546Spatrick	software single stepping.
297061da546Spatrick	(DNBArchMachARM::NumSupportedHardwareBreakpoints): Prepared for adding
298061da546Spatrick	auto detection code.
299061da546Spatrick	(DNBArchMachARM::NumSupportedHardwareWatchpoints): Prepared for adding
300061da546Spatrick	auto detection code.
301061da546Spatrick
302061da546Spatrick2008-12-11  Greg Clayton  <gclayton@apple.com>
303061da546Spatrick
304061da546Spatrick	* DNB.h (DNBProcessWaitForEvent): Renamed to DNBProcessWaitForEvents.
305061da546Spatrick	(DNBProcessSetEvents): Removed (deprecated).
306061da546Spatrick	(DNBProcessGetWaitForResetMask): Removed (unused).
307061da546Spatrick	(DNBProcessSetWaitForResetMask): Removed (unused).
308061da546Spatrick	(DNBProcessInterruptEvents): New function prototype.
309061da546Spatrick	* DNB.cpp (DNBProcessWaitForEvent): Renamed to DNBProcessWaitForEvents.
310061da546Spatrick	(DNBProcessSetEvents): Removed (deprecated).
311061da546Spatrick	(DNBProcessGetWaitForResetMask): Removed (unused).
312061da546Spatrick	(DNBProcessSetWaitForResetMask): Removed (unused).
313061da546Spatrick	(DNBProcessInterruptEvents): New function that can be used to
314061da546Spatrick	asynchronously interrupt infinite wait for events calls.
315061da546Spatrick	RNBRemote.cpp (RNBRemote::HandlePacket_v): Call DNBProcessWaitForEvents.
316061da546Spatrick	RNBContext.cpp (RNBContext::ThreadFunctionProcessStatus): Ditto.
317061da546Spatrick	test-remotenub.cpp (RNBRunLoopLaunchInferior): Ditto.
318061da546Spatrick	(RNBRunLoopLaunchAttaching): Ditto.
319061da546Spatrick
320061da546Spatrick2008-12-11  Greg Clayton  <gclayton@apple.com>
321061da546Spatrick
322061da546Spatrick	* DNB.cpp (GetProcessMap): Use new PTHREAD_MUTEX_LOCKER macro to ease
323061da546Spatrick	debugging of deadlocks.
324061da546Spatrick	(DNBProcessLaunch): Improved logging.
325061da546Spatrick	(DNBProcessMemoryRead): Call MachProcess::ReadMemory so breakpoint
326061da546Spatrick	opcodes can be removed from memory.
327061da546Spatrick	(DNBProcessMemoryWrite): Call MachProcess::WriteMemory so that we work
328061da546Spatrick	around enabled software breakpoint traps.
329061da546Spatrick	* DNBLog.cpp (GetLogThreadedMutex): New function.
330061da546Spatrick	(_DNBLogThreaded): Use new PTHREAD_MUTEX_LOCKER macro to ease
331061da546Spatrick	debugging of deadlocks.
332061da546Spatrick	(_DNBLogThreadedIf): Ditto.
333061da546Spatrick	* DNBBreakpoint.h (DNBBreakpoint::IntersectsRange): New function.
334061da546Spatrick	* DNBBreakpoint.cpp	(DNBBreakpointList::FindIDByAddress): Improved
335061da546Spatrick	logging.
336061da546Spatrick	* MacOSX/MachThread.cpp (MachThread::MachThread): Improved logging.
337061da546Spatrick	(MachThread::~MachThread): Ditto.
338061da546Spatrick	(MachThread::Suspend): Ditto.
339061da546Spatrick	(MachThread::Resume): Ditto.
340061da546Spatrick	(MachThread::RestoreSuspendCount): Ditto.
341061da546Spatrick	(MachThread::GetState): Use new PTHREAD_MUTEX_LOCKER macro to ease
342061da546Spatrick	debugging of deadlocks.
343061da546Spatrick	(MachThread::SetState): Ditto.
344061da546Spatrick	* MacOSX/MachVMMemory.cpp (MachVMMemory::Read): Improved logging.
345061da546Spatrick	(MachVMMemory::Write): Ditto.
346061da546Spatrick	(MachVMMemory::WriteRegion): Ditto.
347061da546Spatrick	* MacOSX/MachProcess.cpp (MachProcess::GetState): Use new
348061da546Spatrick	PTHREAD_MUTEX_LOCKER macro to ease debugging of deadlocks.
349061da546Spatrick	(MachProcess::SetState): Ditto.
350061da546Spatrick	(MachProcess::Clear): Ditto.
351061da546Spatrick	(MachProcess::PrivateResume): Ditto.
352061da546Spatrick	(MachProcess::ReplyToAllExceptions): Ditto.
353061da546Spatrick	(MachProcess::ExceptionMessageReceived): Ditto.
354061da546Spatrick	(MachProcess::AppendSTDOUT): Ditto.
355061da546Spatrick	(MachProcess::GetAvailableSTDOUT): Ditto.
356061da546Spatrick	(MachProcess::ThreadFunctionSTDIO): Renamed from to
357061da546Spatrick	MachProcess::STDIOThread.
358061da546Spatrick	(MachProcess::StartSTDIOThread): Improved logging.
359061da546Spatrick	(MachProcess::CreateBreakpoint): Ditto.
360061da546Spatrick	(MachProcess::CreateWatchpoint): Ditto.
361061da546Spatrick	(MachProcess::DisableAllBreakpoints): Ditto.
362061da546Spatrick	(MachProcess::DisableBreakpoint): Ditto.
363061da546Spatrick	(MachProcess::DisableWatchpoint): Ditto.
364061da546Spatrick	(MachProcess::EnableBreakpoint): Ditto.
365061da546Spatrick	(MachProcess::EnableWatchpoint): Ditto.
366061da546Spatrick	(MachProcess::LaunchForDebug): Ditto.
367061da546Spatrick	(MachProcess::PosixSpawnChildForPTraceDebugging): Ditto.
368061da546Spatrick	(MachProcess::Detach): Reset the running event bit after resuming prior
369061da546Spatrick	to issuing the SIGSTOP to avoid a pause.
370061da546Spatrick	(MachProcess::RemoveTrapsFromBuffer): New function that removes
371061da546Spatrick	breakpoint traps from a memory buffer.
372061da546Spatrick	(MachProcess::ReadMemory): Read memory from the task, then removes any
373061da546Spatrick	breakpoint traps prior to returning the buffer.
374061da546Spatrick	(MachProcess::WriteMemory): Write memory and any needed data to the
375061da546Spatrick	breakpoint saved opcodes for any software breakpoint traps that are
376061da546Spatrick	enabled.
377061da546Spatrick	* MacOSX/MachProcess.h (MachProcess::ThreadFunctionException): Removed.
378061da546Spatrick	(MachProcess::ThreadFunctionSTDIO): Renamed to MachProcess::STDIOThread().
379061da546Spatrick	(MachProcess::RemoveTrapsFromBuffer): New function.
380061da546Spatrick	* MacOSX/MachVMRegion.cpp (MachVMRegion::SetProtections): Improved
381061da546Spatrick	logging.
382061da546Spatrick	(MachVMRegion::RestoreProtections): Ditto.
383061da546Spatrick	(MachVMRegion::GetRegionForAddress): Ditto.
384061da546Spatrick	* MacOSX/MachException.cpp (catch_mach_exception_raise_state): Improved
385061da546Spatrick	logging.
386061da546Spatrick	(catch_mach_exception_raise_state_identity): Ditto.
387061da546Spatrick	(catch_mach_exception_raise): Ditto.
388061da546Spatrick	(MachException::Message::Dump): Ditto.
389061da546Spatrick	(MachException::Data::GetStopInfo): Ditto.
390061da546Spatrick	(MachException::Message::Receive): Ditto.
391061da546Spatrick	(MachException::Message::Reply): Ditto.
392061da546Spatrick	(MachException::Data::Dump): Ditto.
393061da546Spatrick	(MachException::PortInfo::Save): Ditto.
394061da546Spatrick	(MachException::PortInfo::Restore): Ditto.
395061da546Spatrick	* MacOSX/MachTask.cpp (MachTask::Suspend): Improved logging.
396061da546Spatrick	(MachTask::Resume): Ditto.
397061da546Spatrick	(MachTask::ReadMemory): Ditto.
398061da546Spatrick	(MachTask::WriteMemory): Ditto.
399061da546Spatrick	(MachTask::TaskPortForProcessID): Ditto.
400061da546Spatrick	(MachTask::BasicInfo): Ditto.
401061da546Spatrick	(MachTask::StartExceptionThread): Ditto.
402061da546Spatrick	(MachTask::ShutDownExcecptionThread): Ditto and use pthread_cancel to
403061da546Spatrick	interrupt the exception thread.
404061da546Spatrick	(MachTask::ExceptionThread): Ditto and revert back to infinite timeout
405061da546Spatrick	as pthread_cancel will break us out of infinite mach_msg receive calls.
406061da546Spatrick	* MacOSX/MachThreadList.cpp	(MachThreadList::UpdateThreadList): Improved
407061da546Spatrick	logging.
408061da546Spatrick	(MachThreadList::CurrentThread): Use new PTHREAD_MUTEX_LOCKER macro to
409061da546Spatrick	ease debugging of deadlocks.
410061da546Spatrick	* DNBTimer.h (DNBTimer::DNBTimer): Initialize the mutex with a recursive
411061da546Spatrick	pthread.
412061da546Spatrick	(DNBTimer::Reset): Use new PTHREAD_MUTEX_LOCKER macro to ease debugging
413061da546Spatrick	of deadlocks.
414061da546Spatrick	(DNBTimer::TotalMicroSeconds): Ditto.
415061da546Spatrick	(DNBTimer::GetTime): Ditto.
416061da546Spatrick	(DNBTimer::ElapsedMicroSeconds): Ditto.
417061da546Spatrick	(DNBTimer::GetTimeOfDay): New class function.
418061da546Spatrick	* DNBError.cpp (DNBError::LogThreaded): Improved logging.
419061da546Spatrick	* test-dbgnub.cpp
420061da546Spatrick	* PThreadMutex.h: Added the ability to debug deadlocks by defining
421061da546Spatrick	DEBUG_PTHREAD_MUTEX_DEADLOCKS.
422061da546Spatrick	* FunctionProfiler.cpp
423061da546Spatrick	* PThreadEvent.cpp (PThreadEvent::NewEventBit): Use new
424061da546Spatrick	PTHREAD_MUTEX_LOCKER macro to ease debugging of deadlocks.
425061da546Spatrick	(PThreadEvent::FreeEventBits): Ditto.
426061da546Spatrick	(PThreadEvent::GetEventBits): Ditto.
427061da546Spatrick	(PThreadEvent::ReplaceEventBits): Ditto.
428061da546Spatrick	(PThreadEvent::SetEvents): Ditto.
429061da546Spatrick	(PThreadEvent::ResetEvents): Ditto.
430061da546Spatrick	(PThreadEvent::WaitForSetEvents): Ditto.
431061da546Spatrick	(PThreadEvent::WaitForEventsToReset): Ditto.
432061da546Spatrick
433061da546Spatrick2008-12-05  Greg Clayton  <gclayton@apple.com>
434061da546Spatrick
435061da546Spatrick	* DNBDefs.h (LOG_TASK): New log bit.
436061da546Spatrick	* DNB.cpp (DNBProcessIsAlive): User newly abstracted MachTask class.
437061da546Spatrick	(DNBProcessMemoryRead): Ditto.
438061da546Spatrick	(DNBProcessMemoryWrite): Ditto.
439061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::EnableHardwareSingleStep): Ditto.
440061da546Spatrick	(DNBArchMachARM::SetSingleStepSoftwareBreakpoints) Ditto.
441061da546Spatrick	* MachException.cpp (MachException::Message::Receive): Cleaned up logging
442061da546Spatrick	so it doesn't always log timeout errors.
443061da546Spatrick	(MachException::Message::Reply): Use abstracted MachTask class for any
444061da546Spatrick	task related queries.
445061da546Spatrick	(MachException::PortInfo::Save): Cleaned up logging.
446061da546Spatrick	(MachException::PortInfo::Restore): Cleaned up logging and now return an
447061da546Spatrick	error instead of the number of restored port infos.
448061da546Spatrick	* MachProcess.cpp (class MachProcess): Abstracted out all of the task_t
449061da546Spatrick	related stuff (suspend, resume, exception ports, exception thread, and
450061da546Spatrick	more) into a new class MachTask.
451061da546Spatrick	(MachProcess::Task): Now returns a reference to a MachTask class.
452061da546Spatrick	(MachProcess::Clear): Uses new abstracted MachTask class.
453061da546Spatrick	(MachProcess::Detach): Ditto.
454061da546Spatrick	(MachProcess::PrivateResume): Ditto.
455061da546Spatrick	(MachProcess::DisableBreakpoint): Ditto.
456061da546Spatrick	(MachProcess::ExceptionMessageReceived): Ditto.
457061da546Spatrick	(MachProcess::ExceptionMessageBundleComplete): Ditto.
458061da546Spatrick	(MachProcess::AttachForDebug): Ditto.
459061da546Spatrick	(MachProcess::LaunchForDebug): Ditto.
460061da546Spatrick	(MachProcess::SBLaunchForDebug): Ditto.
461061da546Spatrick	(MachProcess::TaskIsValid): Removed (replaced by similar functionality
462061da546Spatrick	in the new MachTask class).
463061da546Spatrick	(MachProcess::ExceptionPort): Ditto.
464061da546Spatrick	(MachProcess::ExceptionPortIsValid): Ditto.
465061da546Spatrick	(MachProcess::StartExceptionThread): Ditto.
466061da546Spatrick	(MachProcess::Suspend): Ditto.
467061da546Spatrick	(MachProcess::TaskResume): Ditto.
468061da546Spatrick	(MachProcess::TaskBasicInfo): Ditto.
469061da546Spatrick	(MachProcess::TaskBasicInfo): Ditto.
470061da546Spatrick	(MachProcess::ReadMemory): Ditto.
471061da546Spatrick	(MachProcess::WriteMemory): Ditto.
472061da546Spatrick	(MachProcess::ThreadFunctionException): Ditto.
473061da546Spatrick
474061da546Spatrick2008-12-04  Greg Clayton  <gclayton@apple.com>
475061da546Spatrick
476061da546Spatrick	* DNB.h (DNBProcessSetEvents): New API function prototype.
477061da546Spatrick	* DNB.cpp (DNBProcessSetEvents): New API function.
478061da546Spatrick	(DNBProcessHalt): Send our process a SIGINT instead of suspending
479061da546Spatrick	the task.
480061da546Spatrick	* DNBDefs.h (NUB_STATE_IS_STOPPED): Removed up duplicate entry in macro.
481061da546Spatrick	(eEventPrcoessAsyncInterrupt): New prcoess event bit that allows async
482061da546Spatrick	interrupting of infinite DNBProcessWaitForEvent() function calls.
483061da546Spatrick	* MachException.cpp (MachException::Message::Receive): Improved logging.
484061da546Spatrick	(MachException::Message::Reply): Improved logging.
485061da546Spatrick	* MachProcess.h (MachProcess::TaskBasicInfo): New member and static
486061da546Spatrick	functions.
487061da546Spatrick	* MachProcess.cpp (MachProcess::TaskIsValid): Use new TaskBasicInfo()
488061da546Spatrick	member function.
489061da546Spatrick	(MachProcess::Resume): Removed the detach parameter from the PrivateResume()
490061da546Spatrick	function call.
491061da546Spatrick	(MachProcess::Kill): Added a absolute timeout pointer to allow callers to
492061da546Spatrick	wait for the signal to be received if the timeout is non-NULL.
493061da546Spatrick	(MachProcess::TaskBasicInfo): New member and static function.
494061da546Spatrick	(MachProcess::TaskResume): New function that resumes the task by making sure
495061da546Spatrick	the suspend count is correctly ref counted.
496061da546Spatrick	(MachProcess::Detach): When detaching from a process make sure it is
497061da546Spatrick	stopped (SIGSTOP) first, then we can successfully detach. The exception
498061da546Spatrick	thread now also properly exits.
499061da546Spatrick	(MachProcess::PrivateResume): Call new TaskResume function, and removed the
500061da546Spatrick	detach functionality.
501061da546Spatrick	(MachProcess::DisableBreakpoint): Only notify the thread list that a
502061da546Spatrick	breakpoint has changed if the breakpoint is going to be removed.
503061da546Spatrick	(MachProcess::ThreadFunctionException): Added a permanent 1 second timeout
504061da546Spatrick	for each call to mach_msg() so we can exit the thread in the event that
505061da546Spatrick	we detach from a process/task.
506061da546Spatrick	* test-debugnub (main): Modified to show an example of how to detach using
507061da546Spatrick	a signal_handler to asynchronously receive a SIGINT and properly interrupt
508061da546Spatrick	and detach from a running process.
509061da546Spatrick
510061da546Spatrick2008-11-26  Greg Clayton  <gclayton@apple.com>
511061da546Spatrick
512061da546Spatrick	* DNBDefs.h (LOG_STEP): New logging define.
513061da546Spatrick	* DNBError.cpp (DNBError::LogThreaded): If there is no error, then
514061da546Spatrick	log with "success: " as a prefix instead of "error: ".
515061da546Spatrick	* arm/DBNArchImpl.cpp (DNBArchMachARM::EnableHardwareSingleStep): Log using
516061da546Spatrick	new LOG_STEP instead of LOG_BREAKPOINTS.
517061da546Spatrick	(DNBArchMachARM::SetSingleStepSoftwareBreakpoints): Ditto.
518061da546Spatrick	* MachException.cpp (MachException::Message::Dump): Log exception header
519061da546Spatrick	and reply header on two separate lines.
520061da546Spatrick	* MachProcess.cpp (IsSBProcess): Check for NULL CFArrayRef returned from
521061da546Spatrick	SBSCopyApplicationDisplayIdentifiers for SkankPhone.
522061da546Spatrick	(MachProcess::Suspend): Check if process state is not running instead of
523061da546Spatrick	having to receive an event after a timeout if one is given.
524061da546Spatrick	(MachProcess::Detach): Deallocate the exception port when detaching and
525061da546Spatrick	restore the inferior task exception ports prior to clearing and detaching.
526061da546Spatrick	(MachProcess::PrivateResume): Grab the task's basic info and make sure we
527061da546Spatrick	get the resume the correct number of times.
528061da546Spatrick	(MachProcess::DisableBreakpoint): Removed unused variable opcode_restored
529061da546Spatrick	and make sure the breakpoint is enabled before we start warning that
530061da546Spatrick	our opcode wasn't there.
531061da546Spatrick	* ppc/DBNArchImpl.cpp (DNBArchMachPPC::EnableHardwareSingleStep): Log
532061da546Spatrick	using LOG_STEP instead of LOAD_BREAKPOINTS.
533061da546Spatrick	* RNBServices.cpp (IsSBProcess): Check for NULL CFArrayRef returned from
534061da546Spatrick	SBSCopyApplicationDisplayIdentifiers for SkankPhone.
535061da546Spatrick
536061da546Spatrick2008-11-26  Greg Clayton  <gclayton@apple.com>
537061da546Spatrick
538061da546Spatrick	* MachProcess.h (MachProcess::Suspend): Now takes an optional absolute
539061da546Spatrick	timeout that, if non-NULL, will case the function to return after the
540061da546Spatrick	process has been suspended and is in a stopped state. If the timeout is
541061da546Spatrick	NULL, then no waiting will occur.
542061da546Spatrick	* MachProcess.cpp (MachProcess::Suspend): Ditto.
543061da546Spatrick	(MachProcess::Detach): Now replies to all exceptions, un-suspends all
544061da546Spatrick	threads and resumes the task.
545061da546Spatrick	(MachProcess::ReplyToAllExceptions): New function.
546061da546Spatrick	(MachProcess::PrivateResume): Now takes an additional parameter named
547061da546Spatrick	detach that will do the right thing when detaching from a process.
548061da546Spatrick	* DNBArchImpl.h (DNBArchMachI386::ThreadWillResume): Returns void.
549061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachI386::ThreadWillResume): Returns void.
550061da546Spatrick	* RNBServices.cpp (ListApplications): #ifdef-ed for ARM only as it
551061da546Spatrick	currently uses SpringBoard.
552061da546Spatrick	(IsSBProcess): Ditto.
553061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): #ifdef-ed around
554061da546Spatrick	ARM parts so it compiles for i386.
555061da546Spatrick	(main): Ditto.
556061da546Spatrick
557061da546Spatrick2008-11-24  Greg Clayton  <gclayton@apple.com>
558061da546Spatrick
559061da546Spatrick	* DNBArchProtocol.h (DNBArchProtocol::ThreadWillResume): Now returns void.
560061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::ThreadWillResume): Returns void and
561061da546Spatrick	has hollowed out support for software single step.
562061da546Spatrick	(DNBArchMachARM::ThreadDidStop): Has a debug mode that uses hardware single
563061da546Spatrick	step to verify software single step that can be enabled by defining
564061da546Spatrick	DNB_ARCH_MACH_ARM_DEBUG_SW_STEP.
565061da546Spatrick	(DNBArchMachARM::SetSingleStepSoftwareBreakpoints): New function.
566061da546Spatrick	* DNBArchImpl.h (DNBArchMachARM::ThreadWillResume): Returns void.
567061da546Spatrick	(DNBArchMachARM::SetSingleStepSoftwareBreakpoints): New prototype.
568061da546Spatrick	(DNBArchMachARM::m_sw_single_step_next_pc): New member variable.
569061da546Spatrick	(DNBArchMachARM::m_sw_single_step_break_id): New member variable.
570061da546Spatrick	* MachThread.cpp (MachThread::ThreadWillResume): Now returns void.
571061da546Spatrick	* MachThread.h (MachThread::ThreadWillResume): Now returns void.
572061da546Spatrick
573061da546Spatrick2008-11-19  Greg Clayton  <gclayton@apple.com>
574061da546Spatrick
575061da546Spatrick	* DNBError.h (FlavorType): Added SpringBoard error type for arm builds.
576061da546Spatrick	* DNBError.cpp (DNBError::AsString): Now returns SpringBoard error strings
577061da546Spatrick	if the error type is SpringBoard.
578061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Set the error into
579061da546Spatrick	RNBContext as either a POSIX error or a SpringBoard error.
580061da546Spatrick	* RNBContext.h (m_launch_status): Changed this member to be a DNBError
581061da546Spatrick	instead of a uint32_t.
582061da546Spatrick	(RNBContext::LaunchStatus): Now returns a reference to the DNBError object
583061da546Spatrick	in m_launch_status.
584061da546Spatrick	* RNBContext.cpp (RNBContext::LaunchStatusAsString): Let DNBError handle
585061da546Spatrick	any error string descriptions, including SpringBoard errors.
586061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_q): Use new error class in
587061da546Spatrick	RNBContext.
588061da546Spatrick	(RNBRemote::HandlePacket_C): Return without an erroneous error when resuming
589061da546Spatrick	a process with a signal.
590061da546Spatrick	* DNBArch.h (DNBArchProtocol::StepNotComplete): New protocol function with
591061da546Spatrick	default return value.
592061da546Spatrick	* DNBArchImpl.cpp (DNBArchMachARM::StepNotComplete): New function.
593061da546Spatrick	(DNBArchMachARM::EnableHardwareSingleStep): Handle hardware single stepping
594061da546Spatrick	over 32 bit thumb instructions better so we always do a true instruction
595061da546Spatrick	level single step.
596061da546Spatrick	* MachProcess.cpp (MachProcess::ExceptionMessageBundleComplete): Now resumes
597061da546Spatrick	if single stepping wasn't able to complete in a single run.
598061da546Spatrick	* MachThread.cpp (MachThread::ShouldStop): Fills in new step_more parameter
599061da546Spatrick	if stepping is not complete.
600061da546Spatrick	* MachThreadList.cpp (MachThreadList::ShouldStop): Pass step_more parameter
601061da546Spatrick	to each MachThread::ShouldStop call.
602061da546Spatrick
603061da546Spatrick2008-11-13  Greg Clayton  <gclayton@apple.com>
604061da546Spatrick
605061da546Spatrick	* MachProcess.cpp (MachProcess::PosixSpawnChildForPTraceDebugging): Don't
606061da546Spatrick	call posix_spawnattr_setbinpref_np when launching with posix_spawn on ARM
607061da546Spatrick	targets as it currently selects the incorrect slice due to multiple slices
608061da546Spatrick	that contain the same cputype, yet they all have differing cpusubtypes.
609061da546Spatrick
610061da546Spatrick2008-11-04  Greg Clayton  <gclayton@apple.com>
611061da546Spatrick
612061da546Spatrick	* RNBRemote.h (GetContinueThread): Don't return the current thread when
613061da546Spatrick	the continue thread is zero or -1.
614061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_c): Resume the process if we
615061da546Spatrick	have no continue thread set.
616061da546Spatrick	(RNBRemote::HandlePacket_s): Ditto.
617061da546Spatrick	(RNBRemote::HandlePacket_C): Ditto unless a continue address is specified
618061da546Spatrick	in which case we will only succeed if we have one thread when the continue
619061da546Spatrick	with signal and address doesn't have a continue thread specified.
620061da546Spatrick	(RNBRemote::HandlePacket_S): Ditto.
621061da546Spatrick	* DNB.cpp (DNBProcessResumeWithSignal): New function.
622061da546Spatrick	(DNBProcessResume): Added better logging.
623061da546Spatrick	(DNBProcessHalt): Ditto.
624061da546Spatrick	(DNBThreadResume): Ditto.
625061da546Spatrick	(DNBThreadResumeWithSignal): Ditto.
626061da546Spatrick	* DNB.h (DNBProcessResumeWithSignal): New prototype.
627061da546Spatrick	* DNBError.cpp (DNBError::LogThreaded): New function.
628061da546Spatrick	* DNBError.h (DNBError::LogThreaded): New prototype.
629061da546Spatrick	* DNBLog.cpp (_DNBLogThreaded): Added sequence ID for threaded logs.
630061da546Spatrick	(_DNBLogThreadedIf): Ditto.
631061da546Spatrick	* MachException.cpp (MachException::Data::GetStopInfo): Use new SoftSignal()
632061da546Spatrick	accessor.
633061da546Spatrick	(MachException::Data::DumpStopReason): Ditto.
634061da546Spatrick	(MachException::Message::Reply): Added better logging and log using the
635061da546Spatrick	soft signal if our task matches that in the exception.
636061da546Spatrick	(MachException::Data::Dump): Added better logging.
637061da546Spatrick	* MachException.h (IsSoftSignal): Removed.
638061da546Spatrick	(SoftSignal): New function that returns the soft signal in the exception
639061da546Spatrick	data if there is one, or zero otherwise.
640061da546Spatrick	* MachProcess.cpp (MachProcess::Suspend): Improved logging.
641061da546Spatrick	(MachProcess::Resume): Ditto.
642061da546Spatrick	(MachProcess::PrivateResume): Handle the case where the process is told
643061da546Spatrick	to resume with a signal by matching the signal up to the thread that had
644061da546Spatrick	the soft signal if no thread id is specified.
645061da546Spatrick	* MachThread.cpp (MachThread::Suspend): Improved logging.
646061da546Spatrick	(MachThread::Resume): Improved logging.
647061da546Spatrick	(MachThread::RestoreSuspendCount): Improved logging.
648061da546Spatrick	(MachThread::Resume): Improved logging.
649061da546Spatrick	(MachThread::Dump): Improved logging.
650061da546Spatrick	* MachThreadList.cpp (MachThreadList::Dump): Improved logging.
651061da546Spatrick
652061da546Spatrick2008-10-22  Greg Clayton  <gclayton@apple.com>
653061da546Spatrick
654061da546Spatrick	* test-remotenub.cpp (RNBRunLoopMode): Added a new enum value
655061da546Spatrick	eRNBRunLoopModeInferiorAttaching.
656061da546Spatrick	(g_long_options): Added "--attach=PID" for attaching to existing processes
657061da546Spatrick	and "--launch=(auto|posix|fork|springboard)" options.
658061da546Spatrick	(RNBRunLoopLaunchInferior): Now launches process with new
659061da546Spatrick	nub_launch_flavor_t enum that can be overridden with the --launch option.
660061da546Spatrick	(RNBRunLoopLaunchAttaching): New function for attaching to existing
661061da546Spatrick	processes.
662061da546Spatrick	(main): Added command line option support for the "--attach" and "--launch"
663061da546Spatrick	options and added attach to pid support and better logging.
664061da546Spatrick	* DNB.cpp/h: (DNBProcessLaunch): Added nub_launch_flavor_t and error
665061da546Spatrick	parameter for more precise control when launching processes.
666061da546Spatrick	(DNBProcessSBLaunch): Removed function as launching with SpringBoard can
667061da546Spatrick	now be done using DNBProcessLaunch with launch_flavor being set to
668061da546Spatrick	eLaunchTypeSpringBoard (arm only).
669061da546Spatrick	(DNBProcessSBAttach): Removed function (SpringBoard processes are now auto
670061da546Spatrick	detected in the MachProcess::AttachForDebug function on ARM).
671061da546Spatrick	* DNBDefs.h (NUB_GENERIC_ERROR): New generic error definition.
672061da546Spatrick	(nub_launch_flavor_t): New enumeration used for control over process
673061da546Spatrick	launching.
674061da546Spatrick	* MachProcess.cpp (IsSBProcess): New function.
675061da546Spatrick	(MachProcess::AttachForDebug): Removed flags parameter that was being used
676061da546Spatrick	for SpringBoard flags and we now detect if a process belongs to SpringBoard
677061da546Spatrick	by calling IsSBProcess.
678061da546Spatrick	(MachProcess::LaunchForDebug): Now has launch parameter that tells it how
679061da546Spatrick	to launch the inferior process and there is also an error code that gets
680061da546Spatrick	returned. This function can now launch using fork + exec, posix_spawn,
681061da546Spatrick	or SpringBoard on ARM targets.
682061da546Spatrick	(MachProcess::SBLaunchForDebug): Now uses DNBError reference instead of
683061da546Spatrick	uint32_t pointer for the error code.
684061da546Spatrick	(MachProcess::SBForkChildForPTraceDebugging): Ditto.
685061da546Spatrick
686061da546Spatrick2008-10-22  Greg Clayton  <gclayton@apple.com>
687061da546Spatrick
688061da546Spatrick	* MacOSX/arm/DNBArchImpl.cpp (DNBArchMachARM::GetRegisterValue): Set
689061da546Spatrick	register value to a uint32 value instead of a float64 value for s0 -
690061da546Spatrick	s31.
691061da546Spatrick
692061da546Spatrick2008-10-17  Greg Clayton  <gclayton@apple.com>
693061da546Spatrick
694061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Don't listen for
695*dda28197Spatrick	the qLaunchSuccess if we aren't doing a lockdown connection.
696061da546Spatrick
697061da546Spatrick2008-10-13  Greg Clayton  <gclayton@apple.com>
698061da546Spatrick
699061da546Spatrick	* RNBRemote.h (class RNBRemote): Added m_watchpoints member.
700061da546Spatrick	* DNB.cpp (DNBBreakpointSet): Added boolean hardware parameter for
701061da546Spatrick	requesting that a hardware breakpoint be set.
702061da546Spatrick	(DNBWatchpointSet): New function.
703061da546Spatrick	(DNBWatchpointClear): New function.
704061da546Spatrick	(DNBWatchpointGetHitCount): New function.
705061da546Spatrick	(DNBWatchpointGetIgnoreCount): New function.
706061da546Spatrick	(DNBWatchpointSetIgnoreCount): New function.
707061da546Spatrick	(DNBWatchpointSetCallback): New function.
708061da546Spatrick	(DNBWatchpointPrint): New function.
709061da546Spatrick	* DNBRegisterInfo.cpp (DNBRegisterValueClass::Dump): Modified to emit
710061da546Spatrick	a single DNBLog() call so there aren't multiple newlines when logging
711061da546Spatrick	to ASL.
712061da546Spatrick	* RNBContext.cpp (RNBContext::ThreadFunctionProcessStatus): Use new
713061da546Spatrick	process state changed events.
714061da546Spatrick	* DNBBreakpoint.h (class DNBBreakpoint): Removed m_state member and
715061da546Spatrick	added m_tid, m_enabled, m_hw_preferred, m_is_watchpoint, m_watch_read,
716061da546Spatrick	m_watch_write, and m_hw_index.
717061da546Spatrick	(DNBBreakpoint::ThreadID()): New accessor.
718061da546Spatrick	(DNBBreakpoint::IsEnabled()): New accessor.
719061da546Spatrick	(DNBBreakpoint::SetEnabled()): New accessor.
720061da546Spatrick	(DNBBreakpoint::IsWatchpoint()): New accessor.
721061da546Spatrick	(DNBBreakpoint::IsBreakpoint()): New accessor.
722061da546Spatrick	(DNBBreakpoint::SetIsWatchpoint()): New accessor.
723061da546Spatrick	(DNBBreakpoint::WatchpointRead()): New accessor.
724061da546Spatrick	(DNBBreakpoint::WatchpointWrite()): New accessor.
725061da546Spatrick	(DNBBreakpoint::HardwarePreferred()): New accessor.
726061da546Spatrick	(DNBBreakpoint::IsHardware()): New accessor.
727061da546Spatrick	(DNBBreakpoint::GetHardwareIndex()): New accessor.
728061da546Spatrick	(DNBBreakpoint::SetHardwareIndex()): New accessor.
729061da546Spatrick	(DNBBreakpoint::ThreadID()): New accessor.
730061da546Spatrick	(DNBBreakpoint::GetState()): Removed accessor.
731061da546Spatrick	(DNBBreakpoint::SetState()): Removed accessor.
732061da546Spatrick	(DNBBreakpoint::AddBreakpoint()): Renamed to Add().
733061da546Spatrick	(DNBBreakpoint::RemoveBreakpoint()): Renamed to Remove().
734061da546Spatrick	(DNBBreakpoint::FindBreakIDForAddress()): Renamed to FindIDByAddress().
735061da546Spatrick	(DNBBreakpoint::ShouldStopAtBreakpoint()): Renamed to ShouldStop().
736061da546Spatrick	(DNBBreakpoint::SetBreakpointCallback()): Renamed to SetCallback().
737061da546Spatrick	(DNBBreakpoint::FindBreakpointWithAddress()): Renamed to
738061da546Spatrick	FindByAddress().
739061da546Spatrick	(DNBBreakpoint::FindBreakpointWithBreakID()): Renamed to FindByID().
740061da546Spatrick	(DNBBreakpoint::GetBreakpointAtIndex()): Renamed to GetByIndex().
741061da546Spatrick	* FunctionProfiler.h: New header for subclass of DNBRuntimeAction.
742061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_v): Use new process state
743061da546Spatrick	changed events.
744061da546Spatrick	(RNBRemote::HandlePacket_z): Implement the hardware breakpoint and
745061da546Spatrick	watchpoint commands z1, Z1, z2, Z2, z3 and Z3
746061da546Spatrick	* PThreadEvent.h (PThreadEvent::GetEventBits): Made member function
747061da546Spatrick	const.
748061da546Spatrick	(PThreadEvent::WaitForSetEvents): Ditto.
749061da546Spatrick	(PThreadEvent::WaitForEventsToReset): Ditto.
750061da546Spatrick	(PThreadEvent::WaitForResetAck): Ditto.
751061da546Spatrick	(PThreadEvent::m_mutex): Made class member mutable.
752061da546Spatrick	(PThreadEvent::m_set_condition): Made class member mutable.
753061da546Spatrick	(PThreadEvent::m_reset_condition): New mutable class member.
754061da546Spatrick	* ProfileObjectiveC.cpp
755061da546Spatrick	* DNBArch.h (DNBArch::NotifyException): Now has default implementation
756061da546Spatrick	that returns false.
757061da546Spatrick	(DNBArch::NumSupportedHardwareBreakpoints): New virtual member
758061da546Spatrick	function with a default implementation.
759061da546Spatrick	(DNBArch::NumSupportedHardwareWatchpoints): Ditto.
760061da546Spatrick	(DNBArch::EnableHardwareBreakpoint): Ditto.
761061da546Spatrick	(DNBArch::EnableHardwareWatchpoint): Ditto.
762061da546Spatrick	(DNBArch::DisableHardwareBreakpoint): Ditto.
763061da546Spatrick	(DNBArch::DisableHardwareWatchpoint): Ditto.
764061da546Spatrick	* DNB.h (DNBBreakpointSet): New take a HARDWARE parameter that allows
765061da546Spatrick	requests for setting hardware breakpoints.
766061da546Spatrick	(DNBWatchpointSet): New function prototype.
767061da546Spatrick	(DNBWatchpointClear): New function prototype.
768061da546Spatrick	(DNBWatchpointGetHitCount): New function prototype.
769061da546Spatrick	(DNBWatchpointGetIgnoreCount): New function prototype.
770061da546Spatrick	(DNBWatchpointSetIgnoreCount): New function prototype.
771061da546Spatrick	(DNBWatchpointSetCallback): New function prototype.
772061da546Spatrick	(DNBWatchpointPrint): New function prototype.
773061da546Spatrick	* MacOSX/arm/DNBArchImpl.cpp: Added hardware breakpoint and watchpoint
774061da546Spatrick	support for ARM.
775061da546Spatrick	(DNBArchMachARM::GetCPUType): New function.
776061da546Spatrick	(DNBArchMachARM::DumpDBGState): New function.
777061da546Spatrick	(DNBArchMachARM::GetDBGState): New function.
778061da546Spatrick	(DNBArchMachARM::SetDBGState): New function.
779061da546Spatrick	(DNBArchMachARM::EnableHardwareSingleStep): New function.
780061da546Spatrick	(DNBArchMachARM::EnableHardwareBreakpoint): New function.
781061da546Spatrick	(DNBArchMachARM::NotifyException): Removed.
782061da546Spatrick	(DNBArchMachARM::DisableHardwareBreakpoint): New function.
783061da546Spatrick	(DNBArchMachARM::EnableHardwareWatchpoint): New function.
784061da546Spatrick	(DNBArchMachARM::DisableHardwareWatchpoint): New function.
785061da546Spatrick	* MacOSX/MachThread.cpp (MachThread::Suspend): Added better logging.
786061da546Spatrick	(MachThread::Resume): Ditto.
787061da546Spatrick	(MachThread::RestoreSuspendCount): Ditto.
788061da546Spatrick	(MachThread::Dump): Ditto.
789061da546Spatrick	(MachThread::EnableHardwareBreakpoint): New function.
790061da546Spatrick	(MachThread::EnableHardwareWatchpoint): New function.
791061da546Spatrick	(MachThread::DisableHardwareBreakpoint): New function.
792061da546Spatrick	(MachThread::DisableHardwareWatchpoint): New function.
793061da546Spatrick	* MacOSX/MachThreadList.h (MachThreadList::GetLastError): Removed.
794061da546Spatrick	(MachThread::EnableHardwareBreakpoint): New prototype.
795061da546Spatrick	(MachThread::DisableHardwareBreakpoint): New prototype.
796061da546Spatrick	(MachThread::EnableHardwareWatchpoint): New prototype.
797061da546Spatrick	(MachThread::DisableHardwareWatchpoint): New prototype.
798061da546Spatrick	(class MachThread): Remove m_err member variable.
799061da546Spatrick	* MacOSX/ppc/DNBArchImpl.cpp (DNBArchMachPPC::GetCPUType) New
800061da546Spatrick	function.
801061da546Spatrick	(DNBArchMachPPC::NotifyException): Removed.
802061da546Spatrick	* MacOSX/ppc/DNBArchImpl.h (DNBArchMachPPC::NotifyException): Removed.
803061da546Spatrick	* MacOSX/MachThread.h (MachThread::EnableHardwareBreakpoint): New
804061da546Spatrick	prototype.
805061da546Spatrick	(MachThread::EnableHardwareWatchpoint): New prototype.
806061da546Spatrick	(MachThread::DisableHardwareBreakpoint): New prototype.
807061da546Spatrick	(MachThread::DisableHardwareWatchpoint): New prototype.
808061da546Spatrick	(class MachThread): Renambed class member m_exception to
809061da546Spatrick	m_stop_exception.
810061da546Spatrick	* MacOSX/MachProcess.cpp (MachProcess::SetState): Updated to use new
811061da546Spatrick	process event enumerations.
812061da546Spatrick	(MachProcess::PrivateResume): Added better logging.
813061da546Spatrick	(MachProcess::CreateBreakpoint): Added bool HARDWARE parameter for
814061da546Spatrick	requesting hardware breakpoints.
815061da546Spatrick	(MachProcess::CreateWatchpoint): New function.
816061da546Spatrick	(MachProcess::DisableAllWatchpoints): New function.
817061da546Spatrick	(MachProcess::DisableWatchpoint): New function.
818061da546Spatrick	(MachProcess::DumpWatchpoint): New function.
819061da546Spatrick	(MachProcess::EnableBreakpoint): Enabled breakpoints in hardware if
820061da546Spatrick	requested and supported.
821061da546Spatrick	(MachProcess::DisableBreakpoint): Disable hardware breakpoints if that
822061da546Spatrick	is how they were set.
823061da546Spatrick	(MachProcess::EnableWatchpoint): New function.
824061da546Spatrick	(MachProcess::ExceptionMessageBundleComplete): Wait for the
825061da546Spatrick	eEventProcessRunningStateChanged event to be reset before changing
826061da546Spatrick	state to stopped to avoid race condition with very fast start/stops.
827061da546Spatrick	(MachProcess::LaunchForDebug): Added posix_spawn support.
828061da546Spatrick	(MachProcess::PosixSpawnChildForPTraceDebugging): New function.
829061da546Spatrick	* MacOSX/i386/DNBArchImpl.cpp (DNBArchMachI386::GetCPUType): New
830061da546Spatrick	function.
831061da546Spatrick	* MacOSX/i386/DNBArchImpl.h (DNBArchMachI386::GetCPUType): New
832061da546Spatrick	prototype.
833061da546Spatrick	* MacOSX/MachProcess.h (PosixSpawnChildForPTraceDebugging): New
834061da546Spatrick	prototype.
835061da546Spatrick	* MacOSX/MachException.cpp (class MachException::ThreadMessage):
836061da546Spatrick	Renamed	class to MachException::Data.
837061da546Spatrick	* MacOSX/MachThreadList.cpp (class MachThreadList): Removed m_err
838061da546Spatrick	class member.
839061da546Spatrick	(MachThreadList::EnableHardwareBreakpoint): New function.
840061da546Spatrick	(MachThreadList::DisableHardwareBreakpoint): New function.
841061da546Spatrick	(MachThreadList::EnableHardwareWatchpoint): New function.
842061da546Spatrick	(MachThreadList::DisableHardwareWatchpoint): New function.
843061da546Spatrick	* MacOSX/MachException.h (class MachException::ThreadMessage):
844061da546Spatrick	Renamed	class to MachException::Data.
845061da546Spatrick	* DNBDefs.h (nub_watch_t): New typedef.
846061da546Spatrick	(INVALID_NUB_HW_INDEX): New macro definition.
847061da546Spatrick	(WATCH_TYPE_READ): New macro definition.
848061da546Spatrick	(WATCH_TYPE_WRITE): New macro definition.
849061da546Spatrick	(NUB_STATE_IS_RUNNING): New macro to see if state is a running state.
850061da546Spatrick	(NUB_STATE_IS_STOPPED): New macro to see if state is a stopped state.
851061da546Spatrick	(eEventProcessStateChanged): Deprecated.
852061da546Spatrick	(eEventProcessRunningStateChanged): New process event state.
853061da546Spatrick	(eEventProcessStoppedStateChanged): New process event state.
854061da546Spatrick	(LOG_WATCHPOINTS): New macro definition for logging watchpoints.
855061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Use new process
856061da546Spatrick	event states.
857061da546Spatrick	* FunctionProfiler.cpp: New class that allows single stepping through
858061da546Spatrick	an address range for tracing exact call graphs.
859061da546Spatrick
860061da546Spatrick2008-09-22  Greg Clayton  <gclayton@apple.com>
861061da546Spatrick
862061da546Spatrick        * RNBRemote.h (GetContinueThread): If the continue thread is zero or
863061da546Spatrick        -1 then return GetCurrentThread().
864061da546Spatrick        * RNBRemote.cpp (m_packets): Made the vCont functions call
865061da546Spatrick        RNBRemote::HandlePacket_v().
866061da546Spatrick        (RNBRemote::HandlePacket_H): Cleaned up whitespace.
867061da546Spatrick        (RNBRemote::HandlePacket_last_signal): Return actual signal values for
868061da546Spatrick        EXE_SOFTWARE/EXC_SOFT_SIGNAL mach exceptions.
869061da546Spatrick        (RNBRemote::HandlePacket_v): Implemented the 'vCont?' and 'vCont;'
870061da546Spatrick        packets.
871061da546Spatrick        (RNBRemote::HandlePacket_c): Handle the case where an address is
872061da546Spatrick        provided.
873061da546Spatrick        (RNBRemote::HandlePacket_C): Implemented the continue with signal
874061da546Spatrick        including when an address is provided.
875061da546Spatrick        (RNBRemote::HandlePacket_S): Implemented the step with signal
876061da546Spatrick        including when an address is provided.
877061da546Spatrick        * DNB.cpp (DNBProcessResume): Pass 0 as the signal when resuming
878061da546Spatrick        a process without specifying a thread.
879061da546Spatrick        (DNBThreadResume): Pass 0 as the signal when resuming a specific thread.
880061da546Spatrick        (DNBThreadResumeWithSignal): New function.
881061da546Spatrick        * DNB.h (DNBThreadResumeWithSignal): New prototype.
882061da546Spatrick        * MachException.h (MachException::Message::Reply): Added a signal
883061da546Spatrick        parameter.
884061da546Spatrick        * MachException.cpp (MachException::Message::Reply): Update the thread
885061da546Spatrick        with the new SIGNAL parameter instead of always zero so signals can be
886061da546Spatrick        passed on to programs.
887061da546Spatrick        * MachProcess.h (MachProcess::Resume): Added a signal parameter.
888061da546Spatrick        * MachProcess.h (MachProcess::PrivateResume): Added a signal parameter.
889061da546Spatrick        * MachProcess.cpp (MachProcess::Resume): Pass new SIGNAL parameter to
890061da546Spatrick        MachProcess::PrivateResume.
891061da546Spatrick        * MachProcess.cpp (MachProcess::PrivateResume): Pass new SIGNAL
892061da546Spatrick        parameter to the mach exception reply.
893061da546Spatrick
894061da546Spatrick2008-08-08  Greg Clayton  <gclayton@apple.com>
895061da546Spatrick
896061da546Spatrick        * DNB.cpp (gProcessMap): Removed static C++ global.
897061da546Spatrick        (GetProcessMap): New Function.
898061da546Spatrick        (AddProcessToMap): New function.
899061da546Spatrick        (RemoveProcessFromMap): New function.
900061da546Spatrick        (GetProcessSP): Use new GetProcessMap function to get process list.
901061da546Spatrick
902061da546Spatrick2008-07-30  Greg Clayton  <gclayton@apple.com>
903061da546Spatrick
904061da546Spatrick        * debugserver-entitlements.plist (get-task-allow): Removed.
905061da546Spatrick        (run-invalid-allow): Added boolean value set to TRUE.
906061da546Spatrick
907061da546Spatrick2008-04-18  Greg Clayton  <gclayton@apple.com>
908061da546Spatrick
909061da546Spatrick        * MachProcess.cpp (MachProcess::Task): Added getuid(), geteuid(),
910061da546Spatrick        getgid(), getegid() to the log message if task for pid fails.
911061da546Spatrick
912061da546Spatrick2008-04-07  Greg Clayton  <gclayton@apple.com>
913061da546Spatrick
914061da546Spatrick        * RNBContext.cpp (RNBContext::LaunchStatusAsString): Removed unused
915061da546Spatrick        tmp_str variable.
916061da546Spatrick
917061da546Spatrick2008-04-04  Greg Clayton  <gclayton@apple.com>
918061da546Spatrick
919061da546Spatrick        * CFString.cpp/h (UTF8): Made a static function that can convert
920061da546Spatrick        a CFStringRef to UTF8.
921061da546Spatrick
922061da546Spatrick2008-04-04  Greg Clayton  <gclayton@apple.com>
923061da546Spatrick
924061da546Spatrick        * test-remotenub.cpp (main): Make sure we exit after we send the
925061da546Spatrick        application list.
926061da546Spatrick
927061da546Spatrick2008-04-04  Greg Clayton  <gclayton@apple.com>
928061da546Spatrick
929061da546Spatrick        * RNBServices.h (IsSBProcess): New prototype;
930061da546Spatrick        * RNBServices.cpp (IsSBProcess): New function that returns true it
931061da546Spatrick        SpringBoard owns or knows about the process.
932061da546Spatrick        * RNBRemote.cpp (RNBRemote::HandlePacket_v): Made attach work correctly.
933061da546Spatrick        * DNB.cpp (DNBProcessSBAttach): New function for use when attaching to
934061da546Spatrick        a process owned by SpringBoard.
935061da546Spatrick        (DNBProcessAttach): Fixed an issue where a local was shadowing a
936061da546Spatrick        parameter.
937061da546Spatrick        * DNB.h (DNBProcessSBAttach): New prototype.
938061da546Spatrick        * MachProcess.cpp (MachProcess::AttachForDebug): AttachForDebug now
939061da546Spatrick        takes some flags so it knows to enable SpringBoard functionality.
940061da546Spatrick        * MachProcess.h (MachProcess::AttachForDebug): Added flags parameter
941061da546Spatrick        to prototype.
942061da546Spatrick
943061da546Spatrick2008-04-04  Greg Clayton  <gclayton@apple.com>
944061da546Spatrick
945061da546Spatrick        * test-remotenub.cpp (RNBRunLoopGetArgsFromRemote): Handle the new
946061da546Spatrick        attach packet and watch for connection being lost.
947061da546Spatrick        (main): handle the --applist option when there we aren't using lockdown
948061da546Spatrick        by printing the results to stdout and exiting with appropriate error code
949061da546Spatrick        if we failed. Also handle the new prototype for ListApplications.
950061da546Spatrick        * RNBServices.h (ListApplications): Change first parameter to be a std::string
951061da546Spatrick        that will get the contents of the plist so we can use this for more than
952061da546Spatrick        just lockdown.
953061da546Spatrick        * RNBServices.cpp (ListApplications): Change first parameter to be a std::string
954061da546Spatrick        that will get the contents of the plist so we can use this for more than
955061da546Spatrick        just lockdown and also fixed the logic so we actually create a full list of
956061da546Spatrick        applications instead of just overwriting the first entry.
957061da546Spatrick        * RNBRemote.h (PacketEnum): Added a new 'vattach' enum for the "vAttach;PID"
958061da546Spatrick        gdb remote command.
959061da546Spatrick        (RNBRemote::HandlePacket_v): New prototype;
960061da546Spatrick        * RNBRemote.cpp (RNBRemote::CreatePacketTable): add the vattach packet definition
961061da546Spatrick        to m_packets.
962061da546Spatrick        (RNBRemote::HandlePacket_v): New function that handles attach to a process.
963061da546Spatrick
964061da546Spatrick2008-04-03  Jim Ingham  <jingham@apple.com>
965061da546Spatrick
966061da546Spatrick	* RNBRemote.h: Add query_launch_success to packet enum.
967061da546Spatrick	* RNBRemote.cpp (RNBRemote::CreatePacketTable_): Add query_launch_success.
968061da546Spatrick	(HandlePacket_q): Handle query_launch_success.
969061da546Spatrick	* DNB.cpp (DNBProcessSBLaunch): Pass in launch_retval.
970061da546Spatrick	* DNB.h: Change prototype of DNBProcessSBLaunch to take launch_retval.
971061da546Spatrick	* RNBContext.cpp (RNBContext::LaunchStatusAsString): New function.
972061da546Spatrick	* RNBContext.h (RNBContext): Add m_launch_status & accessors.
973061da546Spatrick	* macosx/MachProcess.cpp (MachProcess::SBLaunchForDebug): Pass launch_retval.
974061da546Spatrick	(MachProcess::SBForkChildForPTraceDebugging): Accept & set launch_retval.
975061da546Spatrick	* Macosx/MachProcess.h: Change prototypes of SBLaunchForDebug &
976061da546Spatrick	ForkChildForPTraceDebugging to accept launch_retval.
977061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Get the launch status and
978061da546Spatrick	put it in the context, then wait for the qLaunchStatus packet.
979061da546Spatrick
980061da546Spatrick2008-04-03  Greg Clayton  <gclayton@apple.com>
981061da546Spatrick
982061da546Spatrick        * com.apple.debugserver.plist: Changed plist so debugserver
983061da546Spatrick        runs as mobile user.
984061da546Spatrick        * com.apple.debugserver.applist.plist: Ditto.
985061da546Spatrick
986061da546Spatrick2008-04-03  Greg Clayton  <gclayton@apple.com>
987061da546Spatrick
988061da546Spatrick        * MachProcess.cpp: (MachProcess::SBForkChildForPTraceDebugging):
989061da546Spatrick        Increased SBS application launch timeout to 30 seconds.
990061da546Spatrick
991061da546Spatrick2008-03-27 Christopher Friesen <friesen@apple.com>
992061da546Spatrick
993061da546Spatrick        * RNBServices.h: Pass tasks from SpringBoard as a plist
994061da546Spatrick        * RNBServices.cpp: Ditto.
995061da546Spatrick        * test-remotenub.cpp: added --applist flag
996061da546Spatrick        * com.apple.debugserver.applist.plist: Agent plist
997061da546Spatrick
998061da546Spatrick2008-03-17  Jim Ingham  <jingham@apple.com>
999061da546Spatrick
1000061da546Spatrick        * DNB.h: Pass envp to DNBProcessLaunch & DNBProcessSBLaunch.
1001061da546Spatrick        * DNB.cpp: Ditto.
1002061da546Spatrick        * MachProcess.h: Ditto for *LaunchForDebug and
1003061da546Spatrick        *ForkChildForPtraceDebugging.
1004061da546Spatrick        * MachProcess.cpp (MachProcess::LaunchForDebug): Pass on envp.
1005061da546Spatrick        (MachProcess::SBLaunchForDebug): Ditto.
1006061da546Spatrick        (MachProcess::ForkChildForPtraceDebugging): Accept envp, haven't actually
1007061da546Spatrick        implemented the passing yet.
1008061da546Spatrick        (MachProcess::SBForkChildForPtraceDebuggin): Accept envp, convert to
1009061da546Spatrick        CFDictionary and pass to SBSLaunchApplication.
1010061da546Spatrick        * RNBContext.h: Add environment to the context.
1011061da546Spatrick        * RBNContext.cpp (RNBContext::EnvironmentAtIndex): New function.
1012061da546Spatrick        * RNBRemote.h: Add set_environment_variable to the PacketEnum.
1013061da546Spatrick        * RNBRemote.cpp (RNBRemote::CreatePacketTable): Add QEnvironment:.
1014061da546Spatrick        * (RNBRemote::HandlePacket_Q): Ingest the environment variable.
1015061da546Spatrick        * test-remotenub.cpp (RNBRunLoppLaunchInferior): Convert the env
1016061da546Spatrick        array in the context into an array, and pass it to the DNBProcess*Launch
1017061da546Spatrick        methods.
1018061da546Spatrick
1019061da546Spatrick2008-03-17  Greg Clayton  <gclayton@apple.com>
1020061da546Spatrick
1021061da546Spatrick	* DNBBreakpoint.cpp (DNBBreakpointList::GetBreakpointAtIndex): New
1022061da546Spatrick	functions (const and non-const versions).
1023061da546Spatrick	* DNBBreakpoint.h (DNBBreakpointList::GetBreakpointAtIndex): New
1024061da546Spatrick	prototypes (const and non-const versions).
1025061da546Spatrick	* DNBError.h (DNBError::Success()): Don't use KERN_SUCCESS define.
1026061da546Spatrick	(DNBError::Fail()): Don't use KERN_SUCCESS define.
1027061da546Spatrick	* MachProcess.cpp (MachProcess::DisableAllBreakpoints): New function.
1028061da546Spatrick	(MachProcess::Detach): Added initial implementation that will halt
1029061da546Spatrick	the process, disable all breakpoints and call PT_DETACH.
1030061da546Spatrick	* MachProcess.h (MachProcess::DisableAllBreakpoints): New prototype.
1031061da546Spatrick
1032061da546Spatrick2008-03-04  Greg Clayton  <gclayton@apple.com>
1033061da546Spatrick
1034061da546Spatrick        * RNBRemote.h (RNBRemote::SendHexEncodedBytePacket): New prototype.
1035061da546Spatrick        * RNBRemote.cpp (RNBRemote::SendHexEncodedBytePacket): New function.
1036061da546Spatrick        (RNBRemote::SendSTDOUTPacket): Use SendHexEncodedBytePacket function
1037061da546Spatrick        to send bytes.
1038061da546Spatrick        (RNBRemote::SendSTDERRPacket): Ditto.
1039061da546Spatrick        (RNBRemote::HandlePacket_q): Return a valid thread info string for
1040061da546Spatrick        qThreadExtraInfo queries.
1041061da546Spatrick        * DNB.cpp (DNBThreadPrintStopReason): Commented out unused function.
1042061da546Spatrick        (DNBThreadGetInfo): New function.
1043061da546Spatrick        * DNB.h (DNBThreadPrintStopReason): Commented out prototype.
1044061da546Spatrick        (DNBThreadGetInfo): New prototype.
1045061da546Spatrick        * MachProcess.cpp (MachProcess::GetThreadInfo): New function.
1046061da546Spatrick        * MachProcess.h (MachProcess::GetThreadInfo): New prototype.
1047061da546Spatrick        * MachThreadList.cpp (MachThreadList::GetThreadInfo): New function.
1048061da546Spatrick        * MachThreadList.h (MachThreadList::GetThreadInfo): New prototype.
1049061da546Spatrick        * MachThread.cpp (MachThread::GetBasicInfoAsString): New function.
1050061da546Spatrick        (MachThread::InferiorThreadID): New function.
1051061da546Spatrick        * MachThread.cpp (MachThread::GetBasicInfoAsString): New prototype.
1052061da546Spatrick        (MachThread::InferiorThreadID): New prototype.
1053061da546Spatrick
1054061da546Spatrick2008-02-27  Greg Clayton  <gclayton@apple.com>
1055061da546Spatrick
1056061da546Spatrick        * RNBRemote.cpp (RNBRemote::HandlePacket_last_signal): Set the
1057061da546Spatrick        current thread when we notify a thread has stopped to subsequent
1058061da546Spatrick        g and p packets get the correct data.
1059061da546Spatrick
1060061da546Spatrick2008-02-26  Jason Molenda  (jmolenda@apple.com)
1061061da546Spatrick
1062061da546Spatrick	* RNBRemote.h: Add query_thread_extra_info enum.
1063061da546Spatrick	* RNBRemote.cpp: Add support for qThreadExtraInfo.
1064061da546Spatrick	Currently we return 'Ok' as the packet status for
1065061da546Spatrick        every thread.
1066061da546Spatrick
1067061da546Spatrick2008-02-26  Jason Molenda  (jmolenda@apple.com)
1068061da546Spatrick
1069061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_q): Correct handling
1070061da546Spatrick	of qfThreadInfo/qsThreadInfo.
1071061da546Spatrick
1072061da546Spatrick2008-02-20  Jason Molenda  (jmolenda@apple.com)
1073061da546Spatrick
1074061da546Spatrick	* RNBRemote.h: Change default for gdb's max incoming packet size to
1075061da546Spatrick	reflect the real default size.
1076061da546Spatrick	* RNBRemote.cpp (HandlePacket_Q): Correct the string comparisons for
1077061da546Spatrick	the QSetMaxPayloadSize and QSetMaxPacketSize packets.
1078061da546Spatrick
1079061da546Spatrick2008-02-19 Christopher Friesen <friesen@apple.com>
1080061da546Spatrick
1081061da546Spatrick        * CFDataFormatters.c: CoreFoundation data formatters added to project.
1082061da546Spatrick
1083061da546Spatrick2008-02-19  Jason Molenda  (jmolenda@apple.com)
1084061da546Spatrick
1085061da546Spatrick	* RNBRemote.h: Record the max payload size, not the max packet
1086061da546Spatrick        size for less ambiguous meaning.
1087061da546Spatrick	* RNBRemote.cpp: Add support for QSetMaxPayloadSize: packet which
1088061da546Spatrick	should have a clearer meaning than QSetMaxPacketSize.
1089061da546Spatrick	QSetMaxPacketSize will be removed once we get have a chance to get
1090061da546Spatrick	a new debugserver and gdb submitted.
1091061da546Spatrick
1092061da546Spatrick2008-02-18  Jason Molenda  (jmolenda@apple.com)
1093061da546Spatrick
1094061da546Spatrick	* RNBRemote.h: Make default size 1024.
1095061da546Spatrick	* RNBRemote.cpp: Questionmark packet should stay under
1096061da546Spatrick	max_packet_size - 5 to allow for start, end, checksum and nul
1097061da546Spatrick	char bytes.
1098061da546Spatrick
1099061da546Spatrick2008-02-18  Jason Molenda  (jmolenda@apple.com)
1100061da546Spatrick
1101061da546Spatrick	* RNBRemote.h: Add m_max_packet_size to class defn.
1102061da546Spatrick	* RNBRemote.cpp: Initialize it, use it.
1103061da546Spatrick
1104061da546Spatrick2008-02-18  Jason Molenda  (jmolenda@apple.com)
1105061da546Spatrick
1106061da546Spatrick	* RNBRemote.h: Add set_max_packet_size.
1107061da546Spatrick	* RNBRemote.cpp: Add QSetMaxPacketSize packet handling.
1108061da546Spatrick
1109061da546Spatrick2008-02-18  Greg Clayton <gclayton@apple.com>
1110061da546Spatrick
1111061da546Spatrick        * test-remotenub.cpp (HandleProcessStateChange): Call new
1112061da546Spatrick        RNBRemote::FlushSTDIO function.
1113061da546Spatrick        (RNBRunLoopInferiorExecuting): Ditto.
1114061da546Spatrick        * RNBRemote.h (RNBRemote::FlushSTDIO): New prototype.
1115061da546Spatrick        * RNBRemote.cpp (RNBRemote::FlushSTDIO): New function to
1116061da546Spatrick        centralize the stdio.
1117061da546Spatrick
1118061da546Spatrick2008-02-18  Greg Clayton <gclayton@apple.com>
1119061da546Spatrick
1120061da546Spatrick	* DNB.cpp (DNBProcessWaitForEvent): Added timeout pointer as
1121061da546Spatrick	parameter that can be NULL for infinite timeout to simplify
1122061da546Spatrick	the DNB interface.
1123061da546Spatrick	(DNBProcessTimedWaitForEvent): Removed function.
1124061da546Spatrick	* DNB.h (DNBProcessWaitForEvent): Added timeout argument.
1125061da546Spatrick	(DNBProcessTimedWaitForEvent): Removed prototype.
1126061da546Spatrick	* DNBTimer.h (DNBTimer::OffsetTimeOfDay): New function.
1127061da546Spatrick	* CFString.cpp (CFString::GetLength() const): New function.
1128061da546Spatrick	* CFString.h (CFString::GetLength() const): New prototype.
1129061da546Spatrick	* MachProcess.h (MachProcess class): Removed m_attached and
1130061da546Spatrick	added m_flags.
1131061da546Spatrick	* MachProcess.cpp (MachProcess::AttachForDebug): Set m_flags
1132061da546Spatrick	to indicate we attached.
1133061da546Spatrick	(MachProcess::SBLaunchForDebug): Set m_flags to indicate we
1134061da546Spatrick	attached using SpringBoard and that we attached.
1135061da546Spatrick	(MachProcess::SBForkChildForPTraceDebugging): Changed to new
1136061da546Spatrick	SpringBoardServices API.
1137061da546Spatrick	(MachProcess::ThreadFunctionException): Added code that will
1138061da546Spatrick	renew a watchdog assertion when we launch apps through
1139061da546Spatrick	SpringBoardServices.
1140061da546Spatrick	* PThreadEvent.cpp (PThreadEvent::WaitForSetEvents): Simplified
1141061da546Spatrick	PThreadEvent API to have only one version of WaitForSetEvents
1142061da546Spatrick	that has an optional timeout pointer argument.
1143061da546Spatrick	* RNBContext.cpp (RNBContext::StopProcessStatusThread): Adapt
1144061da546Spatrick	to new PThreadEvent API changes.
1145061da546Spatrick	(RNBContext::ThreadFunctionProcessStatus): Adapt to new
1146061da546Spatrick	DNBProcessWaitForEvent API changes.
1147061da546Spatrick	* RNBRemote.cpp (RNBRemote::StopReadRemoteDataThread): Adapt
1148061da546Spatrick	to new PThreadEvent API changes.
1149061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Adapt to new
1150061da546Spatrick	DNBProcessWaitForEvent API changes.
1151061da546Spatrick	(RNBRunLoopInferiorExecuting): Process STDIO first, then
1152061da546Spatrick	incoming packets.
1153061da546Spatrick
1154061da546Spatrick2008-02-14  Jason Molenda  (jmolenda@apple.com)
1155061da546Spatrick
1156061da546Spatrick	* MachProcess.cpp: (MachProcess::SBForkChildForPTraceDebugging):
1157*dda28197Spatrick	Set mode bits on secondary side of pty.
1158061da546Spatrick
1159061da546Spatrick2008-02-12  Greg Clayton  <gclayton@apple.com>
1160061da546Spatrick
1161061da546Spatrick        * DNB.cpp (DNBEnableLogging): Removed function.
1162061da546Spatrick        (DNBThreadPrintStopReason): Removed the file handle from this
1163061da546Spatrick        function and use DNBLog calls.
1164061da546Spatrick        * DNB.h (DNBEnableLogging): Removed function prototype.
1165061da546Spatrick        (DNBThreadPrintStopReason): Removed the file handle
1166061da546Spatrick        from the function prototype in favor of using DNBLog calls.
1167061da546Spatrick        * DNBDataRef.cpp (DNBDataRef::Dump): Removed file handle to use
1168061da546Spatrick        DNBLog for the logging and print a log line each time a full line
1169061da546Spatrick        is ready for output after caching it in a local buffer.
1170061da546Spatrick        * DNBDataRef.cpp (DNBDataRef::Dump): Removed file handle from
1171061da546Spatrick        prototype.
1172061da546Spatrick        * DNBDefs.h (DNBCallbackLog): New callback prototype for all
1173061da546Spatrick        logging.
1174061da546Spatrick        DNBLog.cpp(g_debug_opt): Renamed to d_debug and made it a file
1175061da546Spatrick        static.
1176061da546Spatrick        (DNBLogGetDebug): New accessor function for g_debug.
1177061da546Spatrick        (DNBLogSetDebug): New accessor function for g_debug.
1178061da546Spatrick        (g_verbose): Made into a file static and added accessors.
1179061da546Spatrick        (DNBLogGetVerbose): New accessor function for g_verbose.
1180061da546Spatrick        (DNBLogSetVerbose): New accessor function for g_verbose.
1181061da546Spatrick        (DNBLogSetLogCallback): New function call that registers a logging
1182061da546Spatrick        callback for all logging in libdebugnub.dylib and any code that
1183061da546Spatrick        loads it.
1184061da546Spatrick        (DNBLogToASL): Removed function as it is deprecated in favor of
1185061da546Spatrick        using DNBLogSetLogCallback to register a callback function that
1186061da546Spatrick        implements the logging.
1187061da546Spatrick        (DNBLogToFile): Ditto.
1188061da546Spatrick        (DNBLogCloseLogFile): Ditto.
1189061da546Spatrick        (DNBLogToFile): Ditto.
1190061da546Spatrick        (DNBLogToFile): Ditto.
1191061da546Spatrick        (_DNBLogPuts): Removed unused function.
1192061da546Spatrick        (_DNBLogVAPrintf): Calls the callback function to do the logging
1193061da546Spatrick        if one has been registered.
1194061da546Spatrick        * DNBLog.h (DNBLOG_FLAG_FATAL): New defines that get passed to
1195061da546Spatrick        any registered logging callback functions.
1196061da546Spatrick        (DNBLOG_FLAG_FATAL): Ditto.
1197061da546Spatrick        (DNBLOG_FLAG_ERROR): Ditto.
1198061da546Spatrick        (DNBLOG_FLAG_WARNING): Ditto.
1199061da546Spatrick        (DNBLOG_FLAG_DEBUG): Ditto.
1200061da546Spatrick        (DNBLOG_FLAG_VERBOSE): Ditto.
1201061da546Spatrick        (DNBLOG_FLAG_THREADED): Ditto.
1202061da546Spatrick        (DNBLog*): All logging calls are now exported from libdebugnub.dylib
1203061da546Spatrick        so there aren't two copies (one in debugserver and one in debugnub).
1204061da546Spatrick        C99 vararg Macros wrap all logging calls so no var arg processing
1205061da546Spatrick        occurs when logging is disabled.
1206061da546Spatrick        * DNBRegisterInfo.cpp (DNBRegisterValueClass::Dump): Removed file
1207061da546Spatrick        handle and now use DNBLog calls.
1208061da546Spatrick        * DNBRegisterInfo.h (DNBRegisterValueClass::Dump): Removed file
1209061da546Spatrick        handle from prototype.
1210061da546Spatrick        * MachException.cpp (catch_mach_exception_raise_state_identity):
1211061da546Spatrick        Removed newlines from logging call.
1212061da546Spatrick        (catch_mach_exception_raise): Ditto.
1213061da546Spatrick        (MachException::Message::Dump): Removed file handle from params
1214061da546Spatrick        and removed newlines from logging call.
1215061da546Spatrick        (MachException::ThreadMessage::DumpStopReason): Removed file handle
1216061da546Spatrick        from params and use DNBLog for logging output.
1217061da546Spatrick        (MachException::ThreadMessage::Dump): Log using DNBLog instead of
1218061da546Spatrick        file handle.
1219061da546Spatrick        * MachProcess.cpp (MachProcess::DumpThreadStoppedReason): Ditto.
1220061da546Spatrick        (MachProcess::ReadMemory): Ditto.
1221061da546Spatrick        (MachProcess::WriteMemory): Ditto.
1222061da546Spatrick        (ExceptionMessageBundleComplete): Ditto.
1223061da546Spatrick        * MachThread.cpp (MachThread::Dump): Ditto.
1224061da546Spatrick        (MachThread::DumpRegisterState): Ditto.
1225061da546Spatrick        * MachThreadList.cpp (MachThreadList::DumpThreadStoppedReason): Ditto.
1226061da546Spatrick        (MachThreadList::Dump): Ditto.
1227061da546Spatrick        * RNBRemote.cpp (set_logging): Use new function callback registration
1228061da546Spatrick        calls when enabling ASL logging.
1229061da546Spatrick        test-remotenub.cpp (ASLLogCallback): New function to handle all ASL
1230061da546Spatrick        logging. This function gets registered with libdebugnub.dylib when we
1231061da546Spatrick        want to log using ASL.
1232061da546Spatrick        (FileLogCallback): New function to handle all file logging. This
1233061da546Spatrick        function gets registered with libdebugnub.dylib when we want to log
1234061da546Spatrick        to a 'FILE *'.
1235061da546Spatrick        (main): Register the logging callback functions when we want to log
1236061da546Spatrick        to file or using ASL.
1237061da546Spatrick
1238061da546Spatrick2008-02-12  Greg Clayton  <gclayton@apple.com>
1239061da546Spatrick
1240061da546Spatrick        * test-remotenub.cpp (main): Default to ASL logging with no log
1241061da546Spatrick        bits set to allow for warning and error logging.
1242061da546Spatrick        * RNBRemote.h (struct Breakpoint): New structure for ref counting
1243061da546Spatrick        breakpoints in Z and z packets.
1244061da546Spatrick        * RNBRemote.cpp (RNBRemote::SendPacket): Use new LOG_RNB_PACKETS
1245061da546Spatrick        defined when logging actual packet content.
1246061da546Spatrick        (RNBRemote::HandleAsyncPacket): Ditto.
1247061da546Spatrick        (RNBRemote::HandleReceivedPacket): Ditto.
1248061da546Spatrick        (RNBRemote::HandlePacket_z): Ref count the setting and removing
1249061da546Spatrick        of breakpoints with the Z and z packets using new struct
1250061da546Spatrick        RNBRemote::Breakpoint.
1251061da546Spatrick        * RNBDefs.h (LOG_RNB_PACKETS): New define for logging the sending
1252061da546Spatrick        and receiving of packets data.
1253061da546Spatrick        * DNB.cpp (DNBPrintf): Check for NULL file handle.
1254061da546Spatrick        * DNBBreakpoint.cpp (DNBBreakpoint::Dump): Ditto.
1255061da546Spatrick        (DNBBreakpointList::Dump): Ditto.
1256061da546Spatrick        * DNBDefs.h (LOG_EVENTS): New define for logging PThreadEvent.
1257061da546Spatrick        * DNBLog.cpp (g_debug_opt): Relocated outside of #if that turns off
1258061da546Spatrick        logging completely to allow option parsing code that uses it to
1259061da546Spatrick        still compile.
1260061da546Spatrick        (g_verbose): Ditto.
1261061da546Spatrick        * DNBLog.h (DNBLogToASL): Added prototype for when logging is
1262061da546Spatrick        disabled via preprocessor macro.
1263061da546Spatrick        (DNBLogToFile): Ditto.
1264061da546Spatrick        * DNBRegisterInfo.cpp (DNBRegisterValueClass::Dump): Check for NULL
1265061da546Spatrick        file handle.
1266061da546Spatrick        * MachException.cpp (MachException::ThreadMessage::DumpStopReason): Ditto.
1267061da546Spatrick        (MachException::ThreadMessage::Dump): Ditto.
1268061da546Spatrick        * MachProcess.cpp (MachProcess::CreateBreakpoint): Improved logging.
1269061da546Spatrick        (MachProcess::DisableBreakpoint): Verify the original opcode gets
1270061da546Spatrick        restored, improved logging and added unconditional logging for when
1271061da546Spatrick        things go wrong.
1272061da546Spatrick        (MachProcess::EnableBreakpoint): Verify the breakpoint opcode gets
1273061da546Spatrick        written, improved logging and added unconditional logging for when
1274061da546Spatrick        things go wrong.
1275061da546Spatrick        * MachThread.cpp (MachThread::Dump): Check for NULL file handle.
1276061da546Spatrick        * MachVMMemory.cpp (MachVMMemory::WriteRegion): Flush caches in inferior
1277061da546Spatrick        after writing to inferior memory.
1278061da546Spatrick        * PThreadEvent.cpp: Changed all logging calls to key off of LOG_EVENTS
1279061da546Spatrick        instead of LOG_VERBOSE.
1280061da546Spatrick        MachDYLD.cpp (MachDYLD::Dump): Check for NULL file handle.
1281061da546Spatrick        (MachDYLD::DYLIBInfo::Dump): Ditto.
1282061da546Spatrick        ProfileObjectiveC.cpp (ProfileObjectiveC::DumpStats): Ditto.
1283061da546Spatrick
1284061da546Spatrick2008-02-09  Jason Molenda  (jmolenda@apple.com)
1285061da546Spatrick
1286061da546Spatrick	* RNBRemote.cpp (set_logging): Log to ASL unconditionally when
1287061da546Spatrick	processing a QSetLogging packet.
1288061da546Spatrick
1289061da546Spatrick2008-02-06  Greg Clayton  <gclayton@apple.com>
1290061da546Spatrick
1291061da546Spatrick        * test-remotenub.cpp (main): Dup stdout and stderr to /dev/NULL
1292061da546Spatrick        when we use lockdown.
1293061da546Spatrick
1294061da546Spatrick2008-02-06  Greg Clayton  <gclayton@apple.com>
1295061da546Spatrick
1296061da546Spatrick	* RNBSocket.cpp (RNBSocket::Disconnect): Removed unused var ERR.
1297061da546Spatrick	* RNBRemote.cpp(RNBRemote::HandlePacket_Q): Removed unused var PID.
1298061da546Spatrick	* DNBError.cpp (DNBError::LogThreadedIfError): Removed unused var
1299061da546Spatrick	ERR_MSG.
1300061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Removed unused
1301061da546Spatrick	variable EXECUTABLE_LENGTH.
1302061da546Spatrick	(main): Removed unused variable ARG_IDX.
1303061da546Spatrick
1304061da546Spatrick2008-02-06  Chris Marcellino (cmarcellino@apple.com) and Myke Olson (molson@apple.com)
1305061da546Spatrick
1306061da546Spatrick	* MachProcess.cpp (SBForkChildForPTraceDebugging): Bring up to date with
1307061da546Spatrick	current SpringBoardServices.framework types and imports.
1308061da546Spatrick
1309061da546Spatrick2008-02-05  Jason Molenda  (jmolenda@apple.com)
1310061da546Spatrick
1311061da546Spatrick	* RNBRemote.cpp (set_logging): Remove the mode=file and filename=
1312061da546Spatrick	options to the QSetLogging packet.  We're only going to support logging
1313061da546Spatrick	to ASL for now.  Logging to a file can still be accomplished by the
1314061da546Spatrick	-l command line argument.
1315061da546Spatrick
1316061da546Spatrick2008-02-02  Christopher Friesen  (cfriesen@apple.com)
1317061da546Spatrick
1318061da546Spatrick        * Added libXcodeDebugerSupport.dylib target
1319061da546Spatrick        * XCDebuggerIntrospection.[hc]: Support for Xcode's debugger introspection.
1320061da546Spatrick
1321061da546Spatrick2008-02-01  Jason Molenda  (jmolenda@apple.com)
1322061da546Spatrick
1323061da546Spatrick	* DNBLog.cpp (DNBLogCloseLogFile): New function to close a logfile
1324061da546Spatrick	at exit.
1325061da546Spatrick	* DNBLog.h: Prototype.
1326061da546Spatrick	* test-remotenub.cpp (main): Close the log file before exiting.
1327061da546Spatrick
1328061da546Spatrick2008-02-01  Jason Molenda  (jmolenda@apple.com)
1329061da546Spatrick
1330061da546Spatrick	* RNBRemote.cpp (set_logging): Recognize the "filename=" argument
1331061da546Spatrick	to the QSetLogging directive.
1332061da546Spatrick	* DNBLog.cpp (DNBLogGetLogMask): New fun.c
1333061da546Spatrick	* DNBLog.h: Prototype.
1334061da546Spatrick
1335061da546Spatrick2008-01-31  Jason Molenda  (jmolenda@apple.com)
1336061da546Spatrick
1337061da546Spatrick	* DNBLog.cpp: Add ASL logging as a run-time selectable option.
1338061da546Spatrick	(DNBLogToASL, DNBLogToFile): Functions to switch between logging to
1339061da546Spatrick	a file and logging via ASL.
1340061da546Spatrick	* DNBLog.h: Prototypes.
1341061da546Spatrick	* RNBRemote.cpp (set_logging): Recognize the "mode=" field to enable
1342061da546Spatrick	asl logging.  Skip unrecognized keys.
1343061da546Spatrick
1344061da546Spatrick2008-01-31  Greg Clayton  (gclayton@apple.com)
1345061da546Spatrick
1346061da546Spatrick	* DNB.cpp (sigchld_handler): Better logging when we get a
1347061da546Spatrick	SIGCHILD and we are watching for process related logging events.
1348061da546Spatrick	* test-remotenub.cpp (RNBRunLoopInferiorExecuting): Only reset
1349061da546Spatrick	events when we still have event bits set.
1350061da546Spatrick
1351061da546Spatrick2008-01-29  Jason Molenda  (jmolenda@apple.com)
1352061da546Spatrick
1353061da546Spatrick	* RNBRemote.h: Add set_logging_mode.
1354061da546Spatrick	* RNBRemote.cpp (RNBRemote::CreatePacketTable): Recognize
1355061da546Spatrick	QSetLogging.
1356061da546Spatrick
1357061da546Spatrick2008-01-29  Jason Molenda  (jmolenda@apple.com)
1358061da546Spatrick
1359061da546Spatrick	* RNBRemote.cpp (set_logging): New function to parse the QSetLogging
1360061da546Spatrick	packet.
1361061da546Spatrick	(RNBRemote::HandlePacket_Q): Call it.
1362061da546Spatrick
1363061da546Spatrick2008-01-28  Jason Molenda  (jmolenda@apple.com)
1364061da546Spatrick
1365061da546Spatrick	* RNBRemote.h: Minimal packet size is 1024 in our gdb now.
1366061da546Spatrick	* RNBRemote.cpp: Add the stop_pc value in big-endian order to the
1367061da546Spatrick	T response packet to make it a little easier to follow where gdb
1368061da546Spatrick	is stepping.
1369061da546Spatrick
1370061da546Spatrick2008-01-28  Greg Clayton  <gclayton@apple.com>
1371061da546Spatrick
1372061da546Spatrick	* RNBContext.h: Removed m_pid_state from RNBContext class so that
1373061da546Spatrick	it couldn't get out of sync with the actual process and its accessors
1374061da546Spatrick	SetProcessState() and GetProcessState().
1375061da546Spatrick	* RNBContext.cpp (RNBContext::ProcessStateRunning): Always return the
1376061da546Spatrick	current state of the process instead of a cached value.
1377061da546Spatrick	* test-remotenub.cpp (RNBRunLoopLaunchInferior): Remove call to
1378061da546Spatrick        deprecated RNBContext::SetProcessState().
1379061da546Spatrick	(HandleProcessStateChange): Ditto.
1380061da546Spatrick
1381061da546Spatrick2008-01-24  Greg Clayton  (gclayton@apple.com)
1382061da546Spatrick
1383061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_q): See if command starts with
1384061da546Spatrick	"qSymbol" (no trailing "s") and return the empty string.
1385061da546Spatrick
1386061da546Spatrick2008-01-24  Greg Clayton  (gclayton@apple.com)
1387061da546Spatrick
1388061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_q): See if command starts with
1389061da546Spatrick	"qSymbols" and return the empty string.
1390061da546Spatrick
1391061da546Spatrick2008-01-24  Greg Clayton  (gclayton@apple.com)
1392061da546Spatrick
1393061da546Spatrick	* DNBError.h (DNBError::DumpIfError): Removed prototype.
1394061da546Spatrick	* DNBError.cpp (DNBError::DumpIfError): Removed function.
1395061da546Spatrick	(DNBError::LogThreadedIfError): Output error as hex.
1396061da546Spatrick	* MachException.cpp (MachException::Message::Receive): Don't use
1397061da546Spatrick	DNBError::DumpIfError, now use DNBError::LogThreadedIfError.
1398061da546Spatrick	* MachProcess.cpp (MachProcess::StartExceptionThread): Ditto.
1399061da546Spatrick 	(MachProcess::Suspend): Ditto.
1400061da546Spatrick	(MachProcess::SBForkChildForPTraceDebugging): Ditto.
1401061da546Spatrick	* MachVMMemory.cpp (MachVMMemory::Read): Cleaned up logging
1402061da546Spatrick	calls.
1403061da546Spatrick	(MachVMMemory::Write): Ditto.
1404061da546Spatrick	(MachVMMemory::WriteRegion): Added logging.
1405061da546Spatrick	* RNBContenxt.cpp (display_thread_info): Removed function.
1406061da546Spatrick	* RNBRemote.cpp (RNBRemote::GetPacket): Commented out stderr
1407061da546Spatrick	messages to avoid SpringBoard from killing us.
1408061da546Spatrick	(RNBRemote::HandlePacket_p): Ditto.
1409061da546Spatrick	(RNBRemote::HandlePacket_P): Ditto.
1410061da546Spatrick	(RNBRemote::HandlePacket_c): Ditto.
1411061da546Spatrick	(RNBRemote::HandlePacket_A): Removed code that was already
1412061da546Spatrick	* RNBSocket.cpp (RNBSocket::Listen): Commented out stdout
1413061da546Spatrick	messages to avoid SpringBoard from killing us.
1414061da546Spatrick	(RNBSocket::ConnectToService): Ditto.
1415061da546Spatrick
1416061da546Spatrick2008-01-24  Jim Ingham  <jingham@apple.com>
1417061da546Spatrick
1418061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_q): Reply "" to qSymbols
1419061da546Spatrick	and qOffsets.
1420061da546Spatrick
1421061da546Spatrick2008-01-23  Jason Molenda  (jmolenda@apple.com)
1422061da546Spatrick
1423061da546Spatrick	* RNBRemote.h: m_noack_mode to RNBRemote class.
1424061da546Spatrick	* RNBRemote.cpp: Change #ifdef NO_ACKS code blocks
1425061da546Spatrick	to use m_noack_mode instance variable.
1426061da546Spatrick	(RNBRemote::HandlePacket_Q): New function to handle
1427061da546Spatrick	QStartNoAckMode packet and set m_noack_mode appropriately.
1428061da546Spatrick	* test-remotenub.cpp: Remove NO_ACKS ifdefs.
1429061da546Spatrick
1430061da546Spatrick2008-01-22  Jason Molenda  (jmolenda@apple.com)
1431061da546Spatrick
1432061da546Spatrick	* RNBRemote.cpp (RNBRemote::CreatePacketTable): Recognize
1433061da546Spatrick	QStartNoAckMode as an unsupported remote protocol request.
1434061da546Spatrick	* RNBRemote.h: Add start_noack_mode enum entry.
1435061da546Spatrick
1436061da546Spatrick2008-01-22  Greg Clayton  (gclayton@apple.com)
1437061da546Spatrick
1438061da546Spatrick	* DNBLog.h: Removed C++ namespace for DNBLog (changed all DNBLog::
1439061da546Spatrick	to DNBLog) so C99 var arg macros can be used to completely disable
1440061da546Spatrick	all logging and any functions that may be called when making the
1441061da546Spatrick	variable arguments.
1442061da546Spatrick	* DNBLog.cpp: Ditto.
1443061da546Spatrick	* DNB.cpp: Ditto.
1444061da546Spatrick	* DNBBreakpoint.cpp: Ditto.
1445061da546Spatrick	* DNBError.cpp: Ditto.
1446061da546Spatrick	* MacOSX/MachDYLD.cpp: Ditto.
1447061da546Spatrick	* MacOSX/MachException.cpp: Ditto.
1448061da546Spatrick	* MacOSX/MachProcess.cpp: Ditto.
1449061da546Spatrick	* MacOSX/MachThread.cpp: Ditto.
1450061da546Spatrick	* MacOSX/MachThreadList.cpp: Ditto.
1451061da546Spatrick	* MacOSX/MachVMMemory.cpp: Ditto.
1452061da546Spatrick	* MacOSX/MachVMRegion.cpp: Ditto.
1453061da546Spatrick	* MacOSX/arm/DNBArchImpl.cpp: Ditto.
1454061da546Spatrick	* MacOSX/ppc/DNBArchImpl.cpp: Ditto.
1455061da546Spatrick	* PThreadEvent.cpp: Ditto.
1456061da546Spatrick	* RNBContext.cpp: Ditto.
1457061da546Spatrick	* RNBRemote.cpp: Ditto.
1458061da546Spatrick	* RNBSocket.cpp: Ditto.
1459061da546Spatrick	* test-remotenub.cpp: Ditto.
1460061da546Spatrick
1461061da546Spatrick2008-01-21  Jason Molenda  (jmolenda@apple.com)
1462061da546Spatrick
1463061da546Spatrick	* test-remotenub.cpp: Add NO_SPRINGBOARD for turning off SpringBoard
1464061da546Spatrick	dependency ala NO_ACKS.
1465061da546Spatrick
1466061da546Spatrick2008-01-18  Jason Molenda  (jmolenda@apple.com)
1467061da546Spatrick
1468061da546Spatrick	* RNBSocket.h (RNBSocket::RNBSocket): Take either a port # or
1469061da546Spatrick	an already-opened socket, with a boolean to indicate which it is.
1470061da546Spatrick	* RNBRemote.cpp (RNBRemote::RNBRemote): Ditto.
1471061da546Spatrick	* RNBRemote.h: Prototype update.
1472061da546Spatrick	* test-remotenub.cpp: Include lockdown.h.  Take --lockdown command
1473061da546Spatrick	line arg, get the socket from liblockdown.dylib instead of opening
1474061da546Spatrick	our own socket if it is specified.  --lockdown indicates that
1475061da546Spatrick	the program name/args will be provided via remote protocol instead
1476061da546Spatrick	of on the command line.
1477061da546Spatrick
1478061da546Spatrick2008-01-17  Jason Molenda  (jmolenda@apple.com)
1479061da546Spatrick
1480061da546Spatrick	* RNBRemote.cpp: Add NO_ACKS #ifdefs around code that computes
1481061da546Spatrick	the checksums and sends/expects the gdb remote protocol ACK packets.
1482061da546Spatrick	If NO_ACKS is defined, debugserver will not send or expect acks.
1483061da546Spatrick	* test-remotenub.cpp (main): Print a different version string
1484061da546Spatrick	if NO_ACKS is defined.
1485061da546Spatrick
1486061da546Spatrick2008-01-16  Greg Clayton  (gclayton@apple.com)
1487061da546Spatrick
1488061da546Spatrick	* PThreadEvent.cpp: Added this pointer to all logging calls.
1489061da546Spatrick
1490061da546Spatrick2008-01-16  Greg Clayton  (gclayton@apple.com)
1491061da546Spatrick
1492061da546Spatrick	* RNBSocket.cpp (RNBSocket::Connect()): Use TCP so we can try the
1493061da546Spatrick	TCP_NODELAY socket option.
1494061da546Spatrick	(RNBSocket::SetSocketOption()): New function.
1495061da546Spatrick	* RNBSocket.h (RNBSocket::SetSocketOption()): New class function.
1496061da546Spatrick
1497061da546Spatrick2008-01-14  Jason Molenda  (jmolenda@apple.com)
1498061da546Spatrick
1499061da546Spatrick	* RNBRemote.cpp (RNBRemote::HandlePacket_last_signal): When printing
1500061da546Spatrick	registers, skip over gdb regs which don't map to DNB regs.
1501061da546Spatrick
1502061da546Spatrick2008-01-14  Jim Ingham  <jingham@apple.com>
1503061da546Spatrick
1504061da546Spatrick    * ChangeLog - created.
1505061da546Spatrick    * RBNContext.h: Added m_arg_vec and accessors.
1506061da546Spatrick    * RNBContext.cpp (SetProcessID): New function.
1507061da546Spatrick    * RBNRemote.h: Added packet type to HandlePacket & HandleAsyncPacket
1508061da546Spatrick    * RNBRemote.cpp (HandlePacket, HandleAsyncPacket): Return type.
1509061da546Spatrick    (HandlePacket_A): Fix a few bugs.
1510061da546Spatrick    (HandlePacket_H): Return OK if target is not yet running.
1511061da546Spatrick    (HandlePacket_q): Return PID of 0 if target is not yet running.
1512061da546Spatrick    * testremotenub.cpp (RNBRunLoopGetArgsFromRemote): Implement.
1513061da546Spatrick    (RNBRunLoopLaunchInferior): Fetch arguments from context.
1514061da546Spatrick    (main) Store arguments in context, call RNBRunLoopGetArgsFromRemote
1515061da546Spatrick    if appropriate.
1516