Comment #6 on issue 2628 by [email protected]: cctest/test-cpu-profiler/CollectCpuProfile is flaky on Windows
http://code.google.com/p/v8/issues/detail?id=2628

My first hypothesis is:

Imagine the chain of calls A -> B -> C. If we get a sample right at the start of the code object C when instruction pointer is already pointing to the callee (C) but frame pointer is still set up for the caller (B) then stack iterator will think that C's caller is actually A because it'll take return address based on the frame pointer.

The hypothesis seems to be confirmed. I added the following debug print (note: for some reason we record code->address() with CodeCreateEvents, not code->instruction_start() hence the addition of Code::kHeaderSize):

diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index e4c750c..12cec1c 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -535,8 +535,17 @@ CodeEntry* CodeMap::FindEntry(Address addr) {
   if (tree_.FindGreatestLessThan(addr, &locator)) {
     // locator.key() <= addr. Need to check that addr is within entry.
     const CodeEntryInfo& entry = locator.value();
-    if (addr < (locator.key() + entry.size))
+    if (addr < (locator.key() + entry.size)) {
+      if (addr < locator.key() + Code::kHeaderSize + 4) {
+        PrintF("%s [%p - %p - %p] ~ %p\n",
+               entry.entry->name(),
+               (void*) locator.key(),
+               (void*) (locator.key() + Code::kHeaderSize),
+               (void*) (locator.key() + entry.size),
+               (void*) addr);
+      }
       return entry.entry;
+    }
   }
   return NULL;
 }

and got the following with the failure:

loop [0xbeb7c22ce80 - 0xbeb7c22cee0 - 0xbeb7c22d1e4] ~ 0xbeb7c22cee0
[Top down]:
  108     0   (root) [-1]
  106     0    start [-1]
    1     1      loop [-1]
  105     6      delay [-1]
   99    99        loop [-1]
    2     2    (program) [-1]


#
# Fatal error in ../test/cctest/test-cpu-profiler.cc, line 618
# CHECK_EQ(1, startNode->GetChildrenCount()) failed
#   Expected: 1
#   Found: 2
#

as you can see there was a sample that falls exactly at the code entry (0xbeb7c22cee0) before the frame pointer (RBP) was updated.



--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to