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]

patch 2/2 - Add support for probing DW_AT_ranges defined inline instances


  Author: Sébastien Dugué <sebastien.dugue@bull.net>

  Allow systemtap to locate inline instances of functions defined by
a DW_AT_ranges attribute.

  The assumption made here is that the entry point to the inlined instance
is the lowest address defined by the DW_AT_ranges attribute.


---
 ChangeLog   |    6 ++++++
 tapsets.cxx |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

Index: src/tapsets.cxx
===================================================================
--- src.orig/tapsets.cxx	2007-04-04 11:36:22.000000000 +0200
+++ src/tapsets.cxx	2007-04-04 11:38:00.000000000 +0200
@@ -2595,6 +2595,39 @@ query_dwarf_inline_instance (Dwarf_Die *
 	      q->dw.function_line (&inl.decl_line);
 	      q->filtered_inlines[entrypc] = inl;
 	    }
+	  else
+	    {
+	      // Try to find the inline instance entry point using the DW_AT_ranges
+	      // attribute.
+	      // The heuristic here is that we assume that the lowest range
+	      // is the entry point to the inline instance.
+	      Dwarf_Addr entrypc = (Dwarf_Addr) -1l;
+	      Dwarf_Addr base;
+	      Dwarf_Addr begin;
+	      Dwarf_Addr end;
+	      ptrdiff_t p = 0;
+
+	      p = dwarf_ranges(die, p, &base, &begin, &end);
+
+	      while (p>0)
+		{
+		  if (begin<entrypc)
+		    entrypc = begin;
+
+		  p = dwarf_ranges(die, p, &base, &begin, &end);
+		}
+
+	      if (entrypc != (Dwarf_Addr) -1l)
+		{
+		  inline_instance_info inl;
+		  inl.die = *die;
+		  inl.name = q->dw.function_name;
+		  q->dw.function_file (&inl.decl_file);
+		  q->dw.function_line (&inl.decl_line);
+		  q->filtered_inlines[entrypc] = inl;
+		}
+	    }
+
 	}
       return DWARF_CB_OK;
     }
Index: src/ChangeLog
===================================================================
--- src.orig/ChangeLog	2007-04-04 11:36:54.000000000 +0200
+++ src/ChangeLog	2007-04-04 11:41:11.000000000 +0200
@@ -1,3 +1,9 @@
+2007-04-04  Sébastien Dugué  <sebastien.dugue@bull.net>
+
+	* tapsets.cxx (query_dwarf_inline_instance): Allow SystemTap to
+	locate inline instances of functions defined by a DW_AT_ranges
+	DWARF attribute.
+
 2007-04-03  Frank Ch. Eigler  <fche@elastic.org>
 
 	Improve error messages for underprivileged scripts.


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