1. HongboZhang
  2. ocaml


xleroy  committed bf81e15

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@12611f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

  • Participants
  • Parent commits 03a2bde
  • Branches master

Comments (0)

Files changed (7)

File Changes

View file
 - 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

File asmcomp/debuginfo.ml

View file
   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

File asmcomp/debuginfo.mli

View file
 type kind = Dinfo_call | Dinfo_raise
-type t = {
+type t = private {
   dinfo_kind: kind;
   dinfo_file: string;
   dinfo_line: int;

File asmcomp/emitaux.ml

View file
 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
       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

File asmcomp/printlinear.ml

View file
   | Lraise ->
       fprintf ppf "raise %a" reg i.arg.(0)
-  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 =

File config/auto-aux/tryassemble

View file
 $aspp -o tst $* 2> /dev/null || exit 100
+# 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
+$as -o tst $* 2> /dev/null || exit 100

File configure

View file
-export aspp
+export as aspp
 if sh ./tryassemble cfi.S; then
   echo "#define ASM_CFI_SUPPORTED" >> m.h
+  echo "Assembler supports CFI"
+  echo "Assembler does not support CFI"
 # Final twiddling of compiler options to work around known bugs