Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong unmarshaling of function pointers in debugger mode #10709

Merged
merged 4 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ Working version

### Bug fixes:

- #9214, #10709: Wrong unmarshaling of function pointers in debugger mode.
This was causing ocamldebug to crash when running some user-defined printers.
(Xavier Leroy, report by Rehan Malak, review by Gabriel Scherer and
Vincent Laviron)

- #10473: Add CFI directives to RISC-V runtime and asmcomp.
This allows stacktraces to work in gdb through C and OCaml calls.
(Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy)
Expand Down Expand Up @@ -298,6 +303,8 @@ Working version
implementation of stat
(Antonin Décimo, review by David Allsopp)



OCaml 4.13 maintenance branch
-----------------------------

Expand Down
2 changes: 1 addition & 1 deletion debugger/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ let speclist = [
]

let function_placeholder () =
raise Not_found
failwith "custom printer tried to invoke a function from the debuggee"

let report report_error error =
eprintf "Debugger [version %s] environment error:@ @[@;%a@]@.;"
Expand Down
3 changes: 2 additions & 1 deletion runtime/intern.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ static void intern_rec(value *dest)
const value * function_placeholder =
caml_named_value ("Debugger.function_placeholder");
if (function_placeholder != NULL) {
v = *function_placeholder;
/* Use the code pointer from the "placeholder" function */
v = (value) Code_val(*function_placeholder);
} else {
intern_cleanup();
intern_bad_code_pointer(digest);
Expand Down