From 70c579379283da66f97906a0d62c8a5fc34e4dab Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Sat, 9 Apr 2005 21:28:39 +0000 Subject: [PATCH] 0.8.21.29: TRACE :ENCAPSULATE NIL was broken by a recent function signature change in the debugger internals. Fix this, and add support for :ENCAPSULATE NIL on x86-64. * Pass stream to PRINT-FRAME-CALL from ntrace.lisp. * Port over some of Daniel Barlow's fixes to x86-64-assem.S from amd64-pthreads-branch, fix fun_end_breakpoint_guts. * Fixed some magic constants in the x86-64 runtime * Various 64-bit cleanups, #ifdef cleanups in the runtime --- NEWS | 2 ++ src/code/debug-int.lisp | 2 +- src/code/ntrace.lisp | 2 +- src/runtime/breakpoint.c | 16 +++++++--------- src/runtime/x86-64-arch.c | 4 ++-- src/runtime/x86-64-assem.S | 25 ++++++++++++++----------- version.lisp-expr | 2 +- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index 78021aa..a11e227 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,8 @@ changes in sbcl-0.8.22 relative to sbcl-0.8.21: entry per call to EVAL. (reported by Kevin Reid) * improvements to the x86-64 disassembler. (thanks to Lutz Euler) * optimization: type testing for non-vector arrays should be faster. + * fixed TRACE :ENCAPSULATE NIL, added support for :ENCAPSULATE NIL + on x86-64 * fixed some bugs related to Unicode integration: ** the restarts for recovering from input and output encoding errors only appear when there is in fact such an error to diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp index f3062a0..2d960c7 100644 --- a/src/code/debug-int.lisp +++ b/src/code/debug-int.lisp @@ -371,7 +371,7 @@ ;; This is the byte offset into the component. (offset nil :type index) ;; The original instruction replaced by the breakpoint. - (instruction nil :type (or null (unsigned-byte 32))) + (instruction nil :type (or null sb!vm::word)) ;; A list of user breakpoints at this location. (breakpoints nil :type list)) (def!method print-object ((obj breakpoint-data) str) diff --git a/src/code/ntrace.lisp b/src/code/ntrace.lisp index 623be7b..7f14f40 100644 --- a/src/code/ntrace.lisp +++ b/src/code/ntrace.lisp @@ -266,7 +266,7 @@ (locally (declare (special basic-definition arg-list)) (prin1 `(,(trace-info-what info) ,@arg-list))) - (print-frame-call frame)) + (print-frame-call frame *standard-output*)) (terpri) (trace-print frame (trace-info-print info)) (write-sequence (get-output-stream-string *standard-output*) diff --git a/src/runtime/breakpoint.c b/src/runtime/breakpoint.c index 439354d..70e5117 100644 --- a/src/runtime/breakpoint.c +++ b/src/runtime/breakpoint.c @@ -26,7 +26,7 @@ #include "genesis/fdefn.h" #define REAL_LRA_SLOT 0 -#ifndef LISP_FEATURE_X86 +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) #define KNOWN_RETURN_P_SLOT 1 #define BOGUS_LRA_CONSTANTS 2 #else @@ -71,7 +71,7 @@ void breakpoint_do_displaced_inst(os_context_t* context, arch_do_displaced_inst(context, orig_inst); } -#ifndef LISP_FEATURE_X86 +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) static lispobj find_code(os_context_t *context) { #ifdef reg_CODE @@ -91,9 +91,7 @@ static lispobj find_code(os_context_t *context) return NIL; #endif } -#endif - -#ifdef LISP_FEATURE_X86 +#else static lispobj find_code(os_context_t *context) { lispobj codeptr = @@ -107,7 +105,7 @@ static lispobj find_code(os_context_t *context) } #endif -static int compute_offset(os_context_t *context, lispobj code) +static long compute_offset(os_context_t *context, lispobj code) { if (code == NIL) return 0; @@ -125,7 +123,7 @@ static int compute_offset(os_context_t *context, lispobj code) if (pc < code_start) return 0; else { - int offset = pc - code_start; + long offset = pc - code_start; if (offset >= codeptr->code_size) return 0; else @@ -137,7 +135,7 @@ static int compute_offset(os_context_t *context, lispobj code) * tried. The sigprocmask() call would work just as well on alpha as it * presumably does on x86 -dan 2001.08.10 */ -#ifndef LISP_FEATURE_X86 +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) void handle_breakpoint(int signal, siginfo_t *info, os_context_t *context) { lispobj code; @@ -176,7 +174,7 @@ void handle_breakpoint(int signal, siginfo_t* info, os_context_t *context) } #endif -#ifndef LISP_FEATURE_X86 +#if !(defined(LISP_FEATURE_X86) || defined(LISP_FEATURE_X86_64)) void *handle_fun_end_breakpoint(int signal, siginfo_t *info, os_context_t *context) { diff --git a/src/runtime/x86-64-arch.c b/src/runtime/x86-64-arch.c index 5b4f674..64eeb06 100644 --- a/src/runtime/x86-64-arch.c +++ b/src/runtime/x86-64-arch.c @@ -53,7 +53,7 @@ context_eflags_addr(os_context_t *context) * gregs[], but it's conditional on __USE_GNU and not defined, so * we need to do this nasty absolute index magic number thing * instead. */ - return &context->uc_mcontext.gregs[16]; + return &context->uc_mcontext.gregs[17]; #elif defined __FreeBSD__ return &context->uc_mcontext.mc_eflags; #elif defined __OpenBSD__ @@ -271,7 +271,7 @@ sigtrap_handler(int signal, siginfo_t *info, void *void_context) case trap_FunEndBreakpoint: (char*)(*os_context_pc_addr(context)) -= 1; *os_context_pc_addr(context) = - (int)handle_fun_end_breakpoint(signal, info, context); + (unsigned long)handle_fun_end_breakpoint(signal, info, context); break; default: diff --git a/src/runtime/x86-64-assem.S b/src/runtime/x86-64-assem.S index 4f69372..cf5b970 100644 --- a/src/runtime/x86-64-assem.S +++ b/src/runtime/x86-64-assem.S @@ -203,7 +203,7 @@ GNAME(fpu_restore): * the undefined-function trampoline */ .text - .align align_4byte,0x90 + .align align_8byte,0x90 .global GNAME(undefined_tramp) .type GNAME(undefined_tramp),@function GNAME(undefined_tramp): @@ -217,9 +217,9 @@ GNAME(undefined_tramp): .text - .align align_4byte,0x90 + .align align_8byte,0x90 .global GNAME(alloc_tramp) - .type GNAME(alooc_tramp),@function + .type GNAME(alloc_tramp),@function GNAME(alloc_tramp): push %rbp # Save old frame pointer. mov %rsp,%rbp # Establish new frame. @@ -253,7 +253,7 @@ GNAME(alloc_tramp): * the closure trampoline */ .text - .align align_4byte,0x90 + .align align_8byte,0x90 .global GNAME(closure_tramp) .type GNAME(closure_tramp),@function GNAME(closure_tramp): @@ -272,16 +272,20 @@ GNAME(closure_tramp): */ .text .global GNAME(fun_end_breakpoint_guts) - .align align_4byte + .align align_8byte GNAME(fun_end_breakpoint_guts): /* Multiple Value return */ jmp multiple_value_return + /* the above jmp is only 2 bytes long, we need to add a nop for + * padding since the single value return convention jumps to original + * return address + 3 bytes */ + nop /* Single value return: The eventual return will now use the multiple values return convention but with a return values count of one. */ mov %rsp,%rbx # Setup ebx - the ofp. - sub $4,%rsp # Allocate one stack slot for the return value - mov $4,%rcx # Setup ecx for one return value. + sub $8,%rsp # Allocate one stack slot for the return value + mov $8,%rcx # Setup ecx for one return value. mov $NIL,%rdi # default second value mov $NIL,%rsi # default third value @@ -299,7 +303,7 @@ GNAME(fun_end_breakpoint_end): .global GNAME(do_pending_interrupt) .type GNAME(do_pending_interrupt),@function - .align align_4byte,0x90 + .align align_8byte,0x90 GNAME(do_pending_interrupt): int3 .byte trap_PendingInterrupt @@ -308,12 +312,11 @@ GNAME(do_pending_interrupt): .globl GNAME(post_signal_tramp) .type GNAME(post_signal_tramp),@function - .align align_4byte,0x90 + .align align_8byte,0x90 GNAME(post_signal_tramp): /* this is notionally the second half of a function whose first half * doesn't exist. This is where call_into_lisp returns when called * using return_to_lisp_function */ - addq $24,%rsp /* clear call_into_lisp args from stack */ popq %r15 popq %r14 popq %r13 @@ -324,7 +327,7 @@ GNAME(post_signal_tramp): popq %r8 popq %rdi popq %rsi - popq %rbp + addq $8, %rsp popq %rsp popq %rdx popq %rbx diff --git a/version.lisp-expr b/version.lisp-expr index 5eecfb7..e1dbf71 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.21.28" +"0.8.21.29" -- 1.7.10.4