PR#5643: issues with .cfi and .loc directives generated by ocamlopt -g

(Picking commit 12610 from version/4.00)


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12611 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 2012-06-17 08:17:43 +00:00
parent 08f29984ea
commit 28c206ad37
7 changed files with 23 additions and 7 deletions

View File

@ -154,6 +154,7 @@ Bug Fixes:
- PR#5603: wrong .file debug info generated by ocamlopt -g
- PR#5610: new unmarshaler (from PR#5318) fails to freshen object identifiers
- PR#5620: invalid printing of type manifest (camlp4 revised syntax)
- PR#5643: issues with .cfi and .loc directives generated by ocamlopt -g
- problem with printing of string literals in camlp4 (reported on caml-list)
- emacs mode: colorization of comments and strings now works correctly

View File

@ -31,11 +31,12 @@ let none = {
dinfo_char_end = 0
}
(* PR#5643: cannot use (==) because Debuginfo values are marshalled *)
let is_none t =
t == none
t = none
let to_string d =
if d == none
if d = none
then ""
else Printf.sprintf "{%s:%d,%d-%d}"
d.dinfo_file d.dinfo_line d.dinfo_char_start d.dinfo_char_end

View File

@ -12,7 +12,7 @@
type kind = Dinfo_call | Dinfo_raise
type t = {
type t = private {
dinfo_kind: kind;
dinfo_file: string;
dinfo_line: int;

View File

@ -130,6 +130,7 @@ let reset_debug_info () =
let emit_debug_info dbg =
if !Clflags.debug && not (Debuginfo.is_none dbg) then (
let line = dbg.Debuginfo.dinfo_line in
assert (line <> 0); (* clang errors out on zero line numbers *)
let file_name = dbg.Debuginfo.dinfo_file in
let file_num =
try List.assoc file_name !file_pos_nums
@ -179,13 +180,13 @@ let emit_frames a =
lbl in
let emit_frame fd =
a.efa_label fd.fd_lbl;
a.efa_16 (if fd.fd_debuginfo == Debuginfo.none
a.efa_16 (if Debuginfo.is_none fd.fd_debuginfo
then fd.fd_frame_size
else fd.fd_frame_size + 1);
a.efa_16 (List.length fd.fd_live_offset);
List.iter a.efa_16 fd.fd_live_offset;
a.efa_align Arch.size_addr;
if fd.fd_debuginfo != Debuginfo.none then begin
if not (Debuginfo.is_none fd.fd_debuginfo) then begin
let d = fd.fd_debuginfo in
let line = min 0xFFFFF d.dinfo_line
and char_start = min 0xFF d.dinfo_char_start

View File

@ -65,7 +65,7 @@ let instr ppf i =
| Lraise ->
fprintf ppf "raise %a" reg i.arg.(0)
end;
if i.dbg != Debuginfo.none then
if not (Debuginfo.is_none i.dbg) then
fprintf ppf " %s" (Debuginfo.to_string i.dbg)
let rec all_instr ppf i =

View File

@ -5,3 +5,13 @@ $aspp -o tst $* || exit 100
else
$aspp -o tst $* 2> /dev/null || exit 100
fi
# test as also (if differs)
if test "$aspp" != "$as"; then
if test "$verbose" = yes; then
echo "tryassemble: $as -o tst $*" >&2
$as -o tst $* || exit 100
else
$as -o tst $* 2> /dev/null || exit 100
fi
fi

5
configure vendored
View File

@ -1554,11 +1554,14 @@ fi
asm_cfi_supported=false
export aspp
export as aspp
if sh ./tryassemble cfi.S; then
echo "#define ASM_CFI_SUPPORTED" >> m.h
asm_cfi_supported=true
echo "Assembler supports CFI"
else
echo "Assembler does not support CFI"
fi
# Final twiddling of compiler options to work around known bugs