MCPcopy Create free account
hub / github.com/WheretIB/nullc / PipeDebugBreak

Function PipeDebugBreak

NULLC/nullc_remote.h:301–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299#endif
300
301unsigned int PipeDebugBreak(unsigned int instruction)
302{
303 if(!breakInitialized)
304 {
305 breakInitialized = 1;
306 // Register for event
307#if defined(_WIN32) || defined(_WIN64)
308 breakProcessed = Dispatcher::DispatchRegister(DEBUG_BREAK_CONTINUE, &breakContinue);
309#else
310 breakProcessed = Dispatcher::DispatchRegister(DEBUG_BREAK_CONTINUE, &breakContinue_m, &breakContinue_c);
311#endif
312 }
313#if defined(_WIN32) || defined(_WIN64)
314 // Reset event
315 breakContinue = 0;
316#endif
317 PipeData data;
318 data.cmd = DEBUG_BREAK_HIT;
319 data.question = false;
320 data.debug.breakInst = instruction;
321
322 SocketSend(client, (char*)&data, sizeof(data));
323
324 unsigned int stackSize = 0;
325 char *stackData = (char*)nullcGetVariableData(&stackSize);
326 data.cmd = DEBUG_BREAK_STACK;
327 data.question = false;
328 PipeSendData(client, data, stackData, stackSize, stackSize);
329 printf("DEBUG_BREAK_STACK %p (%d) %p\n", stackData, stackSize, stackData + stackSize);
330
331 if(!stackFrames)
332 stackFrames = new unsigned int[csCount];
333 unsigned int count = 0;
334 nullcDebugBeginCallStack();
335 while(int address = nullcDebugGetStackFrame())
336 {
337 stackFrames[count++] = address;
338 if(count == csCount)
339 {
340 csCount *= 2;
341 unsigned int *newCS = new unsigned int[csCount];
342 memcpy(newCS, stackFrames, count * sizeof(unsigned int));
343 delete[] stackFrames;
344 stackFrames = newCS;
345 }
346 }
347 stackFrames[count++] = 0;
348
349 data.cmd = DEBUG_BREAK_CALLSTACK;
350 data.question = false;
351 PipeSendData(client, data, (char*)stackFrames, count, count * sizeof(unsigned int));
352
353#if defined(_WIN32) || defined(_WIN64)
354 while(!breakContinue)
355 nullcSleep();
356 breakContinue = 0;
357 if(breakProcessed)
358 *breakProcessed = 1;

Callers

nothing calls this directly

Calls 8

DispatchRegisterFunction · 0.85
nullcGetVariableDataFunction · 0.85
PipeSendDataFunction · 0.85
nullcDebugBeginCallStackFunction · 0.85
nullcDebugGetStackFrameFunction · 0.85
nullcSleepFunction · 0.85
SocketSendFunction · 0.70
GetDataFunction · 0.70

Tested by

no test coverage detected