File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed
testsuite/tests/runtime-errors Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -545,6 +545,23 @@ LBL(caml_call_gc):
545
545
CFI_ENDPROC
546
546
ENDFUNCTION(G(caml_call_gc))
547
547
548
+ FUNCTION(G(caml_raise_stack_overflow_XXX))
549
+ CFI_STARTPROC
550
+ CFI_SIGNAL_FRAME
551
+ ENTER_FUNCTION
552
+ LBL(caml_raise_stack_overflow_XXX):
553
+ SAVE_ALL_REGS
554
+ movq %r15 , Caml_state(gc_regs)
555
+ SWITCH_OCAML_TO_C
556
+ C_call (GCALL(caml_raise_stack_overflow))
557
+ SWITCH_C_TO_OCAML
558
+ movq Caml_state(gc_regs), %r15
559
+ RESTORE_ALL_REGS
560
+ LEAVE_FUNCTION
561
+ ret
562
+ CFI_ENDPROC
563
+ ENDFUNCTION(G(caml_raise_stack_overflow_XXX))
564
+
548
565
FUNCTION(G(caml_alloc1))
549
566
CFI_STARTPROC
550
567
ENTER_FUNCTION
Original file line number Diff line number Diff line change 15
15
16
16
#define CAML_INTERNALS
17
17
18
+ #include <unistd.h>
19
+ #define __USE_GNU
20
+ #include <sys/ucontext.h>
21
+
18
22
/* Signal handling, code specific to the native-code compiler */
19
23
20
24
#include <signal.h>
@@ -93,7 +97,8 @@ void caml_garbage_collection(void)
93
97
sigact.sa_sigaction = (void (*)(int,siginfo_t *,void *)) (name); \
94
98
sigact.sa_flags = SA_SIGINFO
95
99
96
- #include <unistd.h>
100
+
101
+ CAMLextern void caml_raise_stack_overflow_XXX (void );
97
102
98
103
DECLARE_SIGNAL_HANDLER (segv_handler )
99
104
{
@@ -104,7 +109,7 @@ DECLARE_SIGNAL_HANDLER(segv_handler)
104
109
char * protected_low = (char * ) block + page_size ;
105
110
char * protected_high = protected_low + page_size ;
106
111
if ((fault_addr >= protected_low ) && (fault_addr < protected_high )) {
107
- caml_raise_stack_overflow () ;
112
+ context -> uc_mcontext . gregs [ REG_RIP ] = ( greg_t ) & caml_raise_stack_overflow_XXX ;
108
113
} else {
109
114
act .sa_handler = SIG_DFL ;
110
115
act .sa_flags = 0 ;
Original file line number Diff line number Diff line change 6
6
7
7
8
8
9
- *)
10
9
11
10
let rec f x =
12
11
if not (x = 0 || x = 10000 || x = 20000)
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ x = 20000
6
6
x = 10000
7
7
x = 0
8
8
second Stack overflow caught
9
- Called from Stackoverflow in file "stackoverflow.ml", line 35 , characters 4-47
9
+ Called from Stackoverflow in file "stackoverflow.ml", line 34 , characters 4-47
10
10
!p = 42
You can’t perform that action at this time.
0 commit comments