This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR3498: more efficient dwfl searching


Hi -

On Thu, Jul 16, 2009 at 03:18:14PM +0800, Wenji Huang wrote:
> [...]
> Did deep investigation, Seems the culprit is the segment in 
> dwflpp::setup_kernel. [...]
> For example, "no module" doesn't exit, there will be error thrown and
> dwflpp::dwflpp{setup_kernel} constructor procedure can't be completely 
> finished. But stap will tolerate such kind of error for optional probe 
> and regard the structure is well formatted. So the searched dw from 
> get_kern_dw isn't in good shape.

I can't seem to reproduce this problem at all on my machine, but maybe
this patch would work too.  The gist is to treat kern_dw[module]==0 as
if kern_dw.find(module)==kern_dw.end().  IOW, if an erlier dwflpp()
construction attempt failed via an exception, but the stl
kern_dw[module] initialization already took place, then the resulting
null pointer will be disregarded later.  Then a new attempt to run the
dwflpp() ctor will be made (which may itself throw).

But this should preclude get_kern_dw() or get_user_dw() from returning
a 0.

- FChE


diff --git a/tapsets.cxx b/tapsets.cxx
index f629d08..4ef5ade 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -594,15 +594,15 @@ struct dwarf_builder: public derived_probe_builder
 
   dwflpp *get_kern_dw(systemtap_session& sess, const string& module)
   {
-    if (kern_dw.find(module) == kern_dw.end())
-      kern_dw[module] = new dwflpp(sess, module, true);
+    if (kern_dw[module] == 0)
+      kern_dw[module] = new dwflpp(sess, module, true); // might throw
     return kern_dw[module];
   }
 
   dwflpp *get_user_dw(systemtap_session& sess, const string& module)
   {
-    if (user_dw.find(module) == user_dw.end())
-      user_dw[module] = new dwflpp(sess, module, false);
+    if (user_dw[module] == 0)
+      user_dw[module] = new dwflpp(sess, module, false); // might throw
     return user_dw[module];
   }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]