Raymond Toy pushed to branch issue-97-define-ud2-inst at cmucl / cmucl
Commits:
-
16043a5b
by Raymond Toy at 2021-03-21T14:58:19-07:00
-
7a5a1513
by Raymond Toy at 2021-03-21T15:02:05-07:00
3 changed files:
Changes:
... | ... | @@ -4477,6 +4477,9 @@ The result is a symbol or nil if the routine cannot be found." |
4477 | 4477 |
;;;
|
4478 | 4478 |
(defun handle-breakpoint (offset component signal-context)
|
4479 | 4479 |
(let ((data (breakpoint-data component offset nil)))
|
4480 |
+ (format t "(handle-breakpoint ~A ~A ~A)~%"
|
|
4481 |
+ offset component signal-context)
|
|
4482 |
+ (format t " data = ~A~%" data)
|
|
4480 | 4483 |
(unless data
|
4481 | 4484 |
(error (intl:gettext "Unknown breakpoint in ~S at offset ~S.")
|
4482 | 4485 |
(debug-function-name (debug-function-from-pc component offset))
|
... | ... | @@ -192,6 +192,8 @@ compute_offset(os_context_t * scp, lispobj code, boolean function_end) |
192 | 192 |
static int
|
193 | 193 |
compute_offset(os_context_t * scp, lispobj code, boolean function_end)
|
194 | 194 |
{
|
195 |
+ fprintf(stderr, "compute_offset: code = 0x%lx\n", code);
|
|
196 |
+
|
|
195 | 197 |
if (code == NIL)
|
196 | 198 |
return 0;
|
197 | 199 |
else {
|
... | ... | @@ -206,11 +208,18 @@ compute_offset(os_context_t * scp, lispobj code, boolean function_end) |
206 | 208 |
|
207 | 209 |
code_start = (unsigned long) codeptr
|
208 | 210 |
+ HeaderValue(codeptr->header) * sizeof(lispobj);
|
211 |
+ |
|
212 |
+ fprintf(stderr, "compute_offset: pc = 0x%lx, code_start = 0x%lx\n",
|
|
213 |
+ pc, code_start);
|
|
214 |
+
|
|
209 | 215 |
if (pc < code_start)
|
210 | 216 |
return 0;
|
211 | 217 |
else {
|
212 | 218 |
int offset = pc - code_start;
|
213 | 219 |
|
220 |
+ fprintf(stderr, "compute_offset: offset %d, size = %ld\n",
|
|
221 |
+ offset, codeptr->code_size);
|
|
222 |
+
|
|
214 | 223 |
if (offset >= codeptr->code_size) {
|
215 | 224 |
return 0;
|
216 | 225 |
} else {
|
... | ... | @@ -250,6 +259,11 @@ handle_breakpoint(int signal, int subcode, os_context_t * scp) |
250 | 259 |
|
251 | 260 |
code = find_code(scp);
|
252 | 261 |
|
262 |
+#if 1
|
|
263 |
+ fprintf(stderr, "handle_breakpoint\n");
|
|
264 |
+ fprintf(stderr, " offset = %d\n", compute_offset(scp, code, 0));
|
|
265 |
+#endif
|
|
266 |
+ |
|
253 | 267 |
/*
|
254 | 268 |
* Don't disallow recursive breakpoint traps. Otherwise, we can't
|
255 | 269 |
* use debugger breakpoints anywhere in here.
|
... | ... | @@ -209,6 +209,9 @@ arch_install_breakpoint(void *pc) |
209 | 209 |
char* ptr = (char *) pc;
|
210 | 210 |
unsigned long result = *(unsigned long *) pc;
|
211 | 211 |
|
212 |
+ fprintf(stderr, "arch_install_breakpoint at %p, old code = 0x%lx\n",
|
|
213 |
+ pc, result);
|
|
214 |
+
|
|
212 | 215 |
#if 0
|
213 | 216 |
*(char *) pc = BREAKPOINT_INST; /* x86 INT3 */
|
214 | 217 |
*((char *) pc + 1) = trap_Breakpoint; /* Lisp trap code */
|
... | ... | @@ -216,8 +219,6 @@ arch_install_breakpoint(void *pc) |
216 | 219 |
*ptr++ = 0x0f; /* UD2 */
|
217 | 220 |
*ptr++ = 0x0b;
|
218 | 221 |
*ptr++ = trap_Breakpoint; /* Lisp trap code */
|
219 |
- *ptr++ = 1; /* Vector length */
|
|
220 |
- *ptr++ = 0; /* Junk data */
|
|
221 | 222 |
#endif
|
222 | 223 |
|
223 | 224 |
return result;
|
... | ... | @@ -300,7 +301,7 @@ sigill_handler(HANDLER_ARGS) |
300 | 301 |
{
|
301 | 302 |
unsigned int trap;
|
302 | 303 |
os_context_t* os_context = (os_context_t *) context;
|
303 |
-#if 0
|
|
304 |
+#if 1
|
|
304 | 305 |
#if 0
|
305 | 306 |
fprintf(stderr, "x86sigtrap: %8x %x\n",
|
306 | 307 |
SC_PC(os_os_context), *(unsigned char *) (SC_PC(os_context) - 1));
|
... | ... | @@ -374,7 +375,7 @@ sigill_handler(HANDLER_ARGS) |
374 | 375 |
* arguments to follow.
|
375 | 376 |
*/
|
376 | 377 |
|
377 |
-#if 0
|
|
378 |
+#if 1
|
|
378 | 379 |
fprintf(stderr, "pc %x\n", *(unsigned short *)SC_PC(context));
|
379 | 380 |
#endif
|
380 | 381 |
if (*(unsigned short *) SC_PC(context) == 0x0b0f) {
|
... | ... | @@ -383,7 +384,7 @@ sigill_handler(HANDLER_ARGS) |
383 | 384 |
abort();
|
384 | 385 |
}
|
385 | 386 |
|
386 |
-#if 0
|
|
387 |
+#if 1
|
|
387 | 388 |
fprintf(stderr, "code = %x\n", trap);
|
388 | 389 |
#endif
|
389 | 390 |
|
... | ... | @@ -415,19 +416,23 @@ sigill_handler(HANDLER_ARGS) |
415 | 416 |
break;
|
416 | 417 |
|
417 | 418 |
case trap_Breakpoint:
|
418 |
-#if 0
|
|
419 |
+#if 1
|
|
419 | 420 |
fprintf(stderr, "*C break\n");
|
420 | 421 |
#endif
|
422 |
+#if 0
|
|
421 | 423 |
SC_PC(os_context) -= 1;
|
424 |
+#endif
|
|
422 | 425 |
|
423 | 426 |
handle_breakpoint(signal, CODE(code), os_context);
|
424 |
-#if 0
|
|
427 |
+#if 1
|
|
425 | 428 |
fprintf(stderr, "*C break return\n");
|
426 | 429 |
#endif
|
427 | 430 |
break;
|
428 | 431 |
|
429 | 432 |
case trap_FunctionEndBreakpoint:
|
433 |
+#if 0
|
|
430 | 434 |
SC_PC(os_context) -= 1;
|
435 |
+#endif
|
|
431 | 436 |
SC_PC(os_context) =
|
432 | 437 |
(int) handle_function_end_breakpoint(signal, CODE(code), os_context);
|
433 | 438 |
break;
|