[vmkit-commits] [vmkit] r104489 - /vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Mon May 24 05:31:15 PDT 2010


Author: geoffray
Date: Mon May 24 07:31:14 2010
New Revision: 104489

URL: http://llvm.org/viewvc/llvm-project?rev=104489&view=rev
Log:
Parse the ocaml frametable like it is supposed to be.


Modified:
    vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp

Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=104489&r1=104488&r2=104489&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Mon May 24 07:31:14 2010
@@ -105,22 +105,25 @@
   return MI;
 }
 
+struct CamlFrames {
+  uint16_t NumDescriptors;
+  CamlFrame frames[1];
+};
 
 void SharedStartFunctionMap::initialize() {
-  CamlFrame* currentFrame =
-    (CamlFrame*)dlsym(SELF_HANDLE, "camlVmkitoptimized__frametable");
-
+  CamlFrames* frames =
+    (CamlFrames*)dlsym(SELF_HANDLE, "camlVmkitoptimized__frametable");
   Dl_info info;
   void* previousPtr = 0;
   const char* previousName = 0;
-  CamlFrame* previousFrame = currentFrame;
   StaticAllocator = new BumpPtrAllocator();
 
-  if (currentFrame) {
-    while (true) {
-      if (!currentFrame->ReturnAddress) break;
+  if (frames != NULL) {
+    CamlFrame* currentFrame = &(frames->frames[0]);
+    CamlFrame* previousFrame = currentFrame;
+    for (uint16_t i = 0; i < frames->NumDescriptors; i++) {
       int res = dladdr(currentFrame->ReturnAddress, &info);
-      if (res) {
+      if (res != 0) {
         if (previousPtr && info.dli_saddr != previousPtr) {
           StaticCamlMethodInfo* MI =
             new(*StaticAllocator, "StaticCamlMethodInfo")
@@ -136,7 +139,7 @@
         (currentFrame->NumLiveOffsets % 2) * sizeof(uint16_t) +
         currentFrame->NumLiveOffsets * sizeof(uint16_t) +
         sizeof(void*) + sizeof(uint16_t) + sizeof(uint16_t));
-    }   
+    }
   }
 }
 





More information about the vmkit-commits mailing list