Last Comment Bug 900524 - Interleaving of pseudostack frames and native stack frames does not work on XP
: Interleaving of pseudostack frames and native stack frames does not work on XP
Status: NEW
:
Product: Core
Classification: Components
Component: Gecko Profiler (show other bugs)
: Trunk
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-01 08:10 PDT by Markus Stange [:mstange]
Modified: 2014-12-10 13:34 PST (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Markus Stange [:mstange] 2013-08-01 08:10:22 PDT
On Windows XP, pseudo stack frames and native stack frames aren't interleaved. Instead, the pseudo stack frames are all dumped at the root of the stack, and then the native stack frames are on top of that.
This makes cleopatra's tree view somewhat useless for Windows XP profiles.
Here's an example profile: http://tests.themasta.com/cleopatra/?report=52274e64e269acab8d54ed9d816348d7ecd678b9
Comment 1 Benoit Girard (:BenWa) 2013-09-05 11:32:29 PDT
I don't have an XP environment and I don't think this bug is worth setting one up. I can provide a way to filter the pseudostack in cleopatra which will throw away the pseudo frames when viewing a profile. This will solve this use case. Since we would only filter the frames we will still retain the pseudoframes so if it carries important information it can still be looked up.

My guess is XP doesn't return the correct SPs when unwinding causing the merging to fail.
Comment 2 :Gijs Kruitbosch 2013-09-05 12:06:21 PDT
(In reply to Benoit Girard (:BenWa) from comment #1)
> I don't have an XP environment and I don't think this bug is worth setting
> one up. I can provide a way to filter the pseudostack in cleopatra which
> will throw away the pseudo frames when viewing a profile. This will solve
> this use case. Since we would only filter the frames we will still retain
> the pseudoframes so if it carries important information it can still be
> looked up.
> 
> My guess is XP doesn't return the correct SPs when unwinding causing the
> merging to fail.

I'm confused. The BaseProcessStart bits (native, IIUC?) aren't particularly negligible in terms of total profile time, but not the majority (AFAICT). By extension, I guess this means the pseudostacks are the majority, which means we'll lose a lot of data this way, won't we?

I'm also confused why this bug doesn't seem worth setting up an env. Is it unlikely that the bug can be fixed if your guess proves right, or is it just that XP doesn't seem like a platform worth investing time into, or...?
Comment 3 Benoit Girard (:BenWa) 2013-09-05 12:18:11 PDT
The profiler collects a Pseudostack and a native stack (where possible). The problem is we incorrectly merge them but the information collected is accurate. The pseudostacks aren't the majority, they just replicate (and sometimes extends) the information collected by the native stack.
Comment 4 Vladan Djeric (:vladan) 2013-09-10 12:03:41 PDT
For future reference: 

The Gecko Profiler didn't display pseudo-stacks properly on Windows XP because StackWalk64 wasn't unwinding the SP stack past the first frame on XP. Installing a newer version of dbghelp.dll fixed the issue. 

The XP SP3 version of dbghelp.dll (v5.1.2600.5512) isn't recent enough. You can get a more recent version from the Visual Studio install directories, e.g. dbghelp version 6.12.2.633 which comes with Visual Studio 2010. Copy it over to System32 or next to firefox.exe
Comment 5 Aaron Klotz [:aklotz] 2013-09-10 12:51:40 PDT
The latest release of dbghelp.dll always ships with Debugging Tools for Windows.
Comment 6 Aaron Klotz [:aklotz] 2013-09-10 12:55:10 PDT
I should also point out that the versions of dbghelp.dll, symsrv.dll, and srcsrv.dll that are included with Debugging Tools for Windows are redistributable. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms679294%28v=vs.85%29.aspx for more information.
Comment 7 Mike Conley (:mconley) - (Needinfo me!) 2013-12-13 19:14:47 PST
Placing a newer version of dbghelp.dll into the running Firefox directory fixed this issue for me.

I *believe* the copy of dbghelp.dll I have is redistributable, since it's not the copy that shipped with my copy of Windows.

Because of this, I've posted this file here in case more people run into this problem: http://people.mozilla.com/~mconley2/sps/dbghelp.dll

Again, just place that into the directory that Firefox is running out of, and your native / pseudostacks should interleave properly.
Comment 8 Mike Conley (:mconley) - (Needinfo me!) 2013-12-16 12:28:33 PST
It's been brought to my attention that placing dbghelp.dll on Mozilla's servers there is probably a Bad Idea for a number of reasons, so I've taken it down.

The files you need are better found at the link that aklotz provided: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679294%28v=vs.85%29.aspx
Comment 9 Mike Conley (:mconley) - (Needinfo me!) 2013-12-16 12:31:39 PST
So, just to sum up the best course of action to work around this bug:

1) Go here: http://go.microsoft.com/fwlink/p/?linkid=84137
2) Download the latest copy of Debugging Tools for Windows supported by your system

That *should* do it. If for some reason it doesn't, find the dbghelp.dll file that the above installation pulled into your system, and drop it into your Firefox directory.
Comment 10 :Ehsan Akhgari 2013-12-16 15:33:42 PST
Can we redistribute this DLL through the Gecko Profiler add-on?
Comment 11 Mike Conley (:mconley) - (Needinfo me!) 2013-12-17 09:12:28 PST
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #10)
> Can we redistribute this DLL through the Gecko Profiler add-on?

That'd probably be ideal, but I'm no lawyer, and I really have no idea what the rules are here.

Gavin - you mentioned to me via e-mail that it's probably OK to redistribute the DLL if it's part of a software package. The Profiler Add-on probably counts, doesn't it?
Comment 12 :Gavin Sharp [email: gavin@gavinsharp.com] 2013-12-17 14:39:47 PST
I have no idea - if you feel the need to ask you should ask a lawyer :)

Note You need to log in before you can comment on or make changes to this bug.