Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005597OCamlOCaml runtime systempublic2012-04-20 11:452012-09-02 04:38
Reporteravsm 
Assigned Tomeyer 
PrioritylowSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.12.1 
Target Version4.00.1+devFixed in Version4.00.0+dev 
Summary0005597: register names for instrtrace primitives when using embedded bytecode library
DescriptionWhen using caml_trace_flag=1 with an embedded bytecode application (linked with ocamlc -output-obj -o x.c), the names of primitives are not registered in caml_startup_code. Thus the instrtrace looks like:

  4801 PUSHACC1
  4802 C_CALL1 unknown primitive 204
  4804 SUBINT
  4805 PUSHACC2
  4806 GTINT
  4807 BRANCHIFNOT 8
  4816 ACC2
  4817 C_CALL1 unknown primitive 205
  4819 PUSHACC3
  4820 PUSHCONST0
  4821 PUSHACC2
  4822 PUSHACC5
  4823 PUSHACC5
  4824 C_CALL5 unknown primitive 215

and after registering them, looks like:

  4801 PUSHACC1
  4802 C_CALL1 caml_ml_string_length
  4804 SUBINT
  4805 PUSHACC2
  4806 GTINT
  4807 BRANCHIFNOT 8
  4816 ACC2
  4817 C_CALL1 caml_create_string
  4819 PUSHACC3
  4820 PUSHCONST0
  4821 PUSHACC2
  4822 PUSHACC5
  4823 PUSHACC5
  4824 C_CALL5 caml_blit_string
Steps To Reproduce./run.sh in the attached tar ball will show the before after.

The only way to activate caml_trace_flag is via manually compiling the debug libasmrun.d and setting the flag, as parsing command line parameters is not done by caml_startup_code. Would a patch to add "t" to OCAMLRUNPARAM for debug bytecode builds be ok?
Additional Informationdiff --git a/byterun/dynlink.c b/byterun/dynlink.c
index 7df594d..729abe3 100644
--- a/byterun/dynlink.c
+++ b/byterun/dynlink.c
@@ -184,8 +184,15 @@ void caml_build_primitive_table_builtin(void)
 {
   int i;
   caml_ext_table_init(&caml_prim_table, 0x180);
- for (i = 0; caml_builtin_cprim[i] != 0; i++)
+#ifdef DEBUG
+ caml_ext_table_init(&caml_prim_name_table, 0x180);
+#endif
+ for (i = 0; caml_builtin_cprim[i] != 0; i++) {
     caml_ext_table_add(&caml_prim_table, (void *) caml_builtin_cprim[i]);
+#ifdef DEBUG
+ caml_ext_table_add(&caml_prim_name_table, strdup(caml_names_of_builtin_cprim[i]));
+#endif
+}
 }
 
 #endif /* NATIVE_CODE */
TagsNo tags attached.
Attached Filestgz file icon test-instrtrace.tgz [^] (554 bytes) 2012-04-20 11:45

- Relationships

-  Notes
(0007672)
doligez (administrator)
2012-07-09 17:38

I've applied the patch to 4.00 (commit 12677) and trunk (commit 12679).

> Would a patch to add "t" to OCAMLRUNPARAM for debug bytecode builds be ok?

Yes. If you provide such a patch, we'll most probably apply it.
(0008000)
meyer (developer)
2012-09-02 04:38

I've added "t" to OCAMLRUNPARAM with r12904.

- Issue History
Date Modified Username Field Change
2012-04-20 11:45 avsm New Issue
2012-04-20 11:45 avsm File Added: test-instrtrace.tgz
2012-05-04 03:09 meyer Assigned To => meyer
2012-05-04 03:09 meyer Status new => assigned
2012-07-09 17:38 doligez Note Added: 0007672
2012-07-09 17:38 doligez Severity minor => feature
2012-07-09 17:38 doligez Status assigned => feedback
2012-07-09 17:38 doligez Resolution open => fixed
2012-07-09 17:38 doligez Fixed in Version => 4.00.0+dev
2012-07-09 17:38 doligez Target Version => 4.00.0+dev
2012-07-09 17:39 doligez Target Version 4.00.0+dev => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-02 04:38 meyer Note Added: 0008000
2012-09-02 04:38 meyer Status feedback => resolved


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker