Re: [DynInst_API:] Crash trying to use StackwalkerAPI


Date: Mon, 30 May 2016 22:14:25 +0000
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Crash trying to use StackwalkerAPI

Bryan--


Good to hear from former developers. Apparently there's a run on Windows stack walking questions this week...


The short answer is that the initialization in Dyninst's use of Stackwalker (dyninstapi/src/dynProcess.C should have the relevant code IIRC) should be more than sufficient to set up a working Walker on both Linux and Windows. Windows will need to walk frame-by-frame for the moment; ASLR broke our bottom-detection code and we haven't yet fixed that up. But I know that as of ~2 weeks ago that code was in active use on Windows.


It is virtually certain that anything non-Dyninst-specific, but platform-specific, that's occurring in Dyninst's Walker setup should properly be happening in generic Stackwalker initialization. I can take a look tomorrow when I'm officially in the office and see what I can shake out.


--bw


From: Dyninst-api <dyninst-api-bounces@xxxxxxxxxxx> on behalf of Bryan Buck <brbuck2503di@xxxxxxxxxx>
Sent: Monday, May 30, 2016 1:55:10 PM
To: dyninst-api@xxxxxxxxxxx
Subject: [DynInst_API:] Crash trying to use StackwalkerAPI
 
I'm trying to use the StackwalkerAPI in Dyninst 9.1.0, but I'm having some trouble getting started. I'm trying the example code from the manual, but it crashes when I call walkStack() on my Walker object. Does anyone know, is there some initialization I need to perform before using the example code from the manual? Specifically, I'm on Windows x86, using this example code to (try to) walk its own process' stack:
 
  std::vector<Frame> stackwalk;
  string s;
 
  Walker *walker=Walker::newWalker();
  walker->walkStack(stackwalk);
 
  for (unsigned i = 0; i < stackwalk.size (); i++) {
      stackwalk[i].getName(s);
      cout << "Found function" << s << endl;
  }
 
As I mentioned, it crashes in the walkStack(). For anyone familiar with the internals of Dyninst, I ask if I need to do some initialization because the crash is in x86-swk.C, in LookupFuncStart::allocatesFrame(), at the line:
 
  result = proc->getLibraryTracker()->getLibraryAtAddr(addr, lib);
 
It crashes because the result of proc->getLibraryTracker() is NULL. (Which means proc->library_tracker is NULL.) Am I not doing something that is supposed to fill this in?
 
I actually used to be a developer on Dyninst and knew these kinds of things, but I see it's changed a lot since I last worked on it! Thanks for any information anyone can give me.
 
- Bryan Buck
 
[← Prev in Thread] Current Thread [Next in Thread→]