summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dwflpp.cxx8
-rw-r--r--dwflpp.h1
-rw-r--r--tapsets.cxx4
-rw-r--r--testsuite/systemtap.base/bz10294.c21
-rw-r--r--testsuite/systemtap.base/bz10294.stp4
-rw-r--r--testsuite/systemtap.base/bz6905.exp24
-rw-r--r--testsuite/systemtap.base/statement.exp38
7 files changed, 72 insertions, 28 deletions
diff --git a/dwflpp.cxx b/dwflpp.cxx
index 6ede1d68..ff62265f 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -784,6 +784,7 @@ dwflpp::iterate_over_srcfile_lines (char const * srcfile,
enum line_t line_type,
void (* callback) (const dwarf_line_t& line,
void * arg),
+ const std::string& func_pattern,
void *data)
{
Dwarf_Line **srcsp = NULL;
@@ -811,7 +812,10 @@ dwflpp::iterate_over_srcfile_lines (char const * srcfile,
else if (line_type == RANGE) { /* correct lineno */
int start_lineno;
- function_line (&start_lineno);
+ if (name_has_wildcard(func_pattern)) /* PR10294: wider range like statement("*@foo.c") */
+ start_lineno = lineno;
+ else
+ function_line (&start_lineno);
lineno = lineno < start_lineno ? start_lineno : lineno;
if (lineno > lines[1]) { /* invalid line range */
stringstream advice;
@@ -849,7 +853,7 @@ dwflpp::iterate_over_srcfile_lines (char const * srcfile,
if (lineno != l || line_probed.second == false || nsrcs > 1)
continue;
dwarf_lineaddr (srcsp [0], &line_addr);
- if (dwarf_haspc (function, line_addr) != 1)
+ if (!function_name_matches(func_pattern) && dwarf_haspc (function, line_addr) != 1)
break;
}
diff --git a/dwflpp.h b/dwflpp.h
index 3cada4f8..f6305bcf 100644
--- a/dwflpp.h
+++ b/dwflpp.h
@@ -213,6 +213,7 @@ struct dwflpp
enum line_t line_type,
void (* callback) (const dwarf_line_t& line,
void * arg),
+ const std::string& func_pattern,
void *data);
void iterate_over_labels (Dwarf_Die *begin_die,
diff --git a/tapsets.cxx b/tapsets.cxx
index 66cb2383..c953dd78 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1452,7 +1452,7 @@ query_cu (Dwarf_Die * cudie, void * arg)
for (set<char const *>::const_iterator i = q->filtered_srcfiles.begin();
i != q->filtered_srcfiles.end(); ++i)
q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str,
- q->line_type, query_srcfile_label, q);
+ q->line_type, query_srcfile_label, q->function, q);
}
else if ((q->has_statement_str || q->has_function_str)
&& (q->spec_type == function_file_and_line))
@@ -1462,7 +1462,7 @@ query_cu (Dwarf_Die * cudie, void * arg)
for (set<char const *>::const_iterator i = q->filtered_srcfiles.begin();
i != q->filtered_srcfiles.end(); ++i)
q->dw.iterate_over_srcfile_lines (*i, q->line, q->has_statement_str,
- q->line_type, query_srcfile_line, q);
+ q->line_type, query_srcfile_line, q->function, q);
}
else
{
diff --git a/testsuite/systemtap.base/bz10294.c b/testsuite/systemtap.base/bz10294.c
new file mode 100644
index 00000000..1ea9a0d9
--- /dev/null
+++ b/testsuite/systemtap.base/bz10294.c
@@ -0,0 +1,21 @@
+int func_a(int a)
+{
+ a = a + 1;
+ return a;
+}
+
+
+int func_b(int b)
+{
+ b = b + 2;
+ return b;
+}
+
+int main()
+{
+ int a;
+
+ a = func_a(1);
+ a = a + func_b(a);
+ return 0;
+}
diff --git a/testsuite/systemtap.base/bz10294.stp b/testsuite/systemtap.base/bz10294.stp
new file mode 100644
index 00000000..0a18c45f
--- /dev/null
+++ b/testsuite/systemtap.base/bz10294.stp
@@ -0,0 +1,4 @@
+#! stap -p2
+probe process("./bz10294").statement("*@bz10294.c:10-10") {
+ printf("ok")
+}
diff --git a/testsuite/systemtap.base/bz6905.exp b/testsuite/systemtap.base/bz6905.exp
deleted file mode 100644
index 20a846cc..00000000
--- a/testsuite/systemtap.base/bz6905.exp
+++ /dev/null
@@ -1,24 +0,0 @@
-set test bz6905
-
-catch {exec gcc -g -o $test $srcdir/$subdir/$test.c} err
-if {$err == "" && [file exists $test]} then { pass "$test compile" } else { fail "$test compile" }
-
-if {![utrace_p]} {
- catch {exec rm -f $test}
- untested "$test -p2"
- return
-}
-
-spawn stap -p2 $srcdir/$subdir/$test.stp
-set hint 0
-set probes 0
-expect {
- -timeout 60
- -re "# probes" { incr hint; exp_continue }
- -re {process.*statement.*} { incr probes; exp_continue }
- timeout { fail "$test (timeout)" }
- eof { }
-}
-wait
-if { $hint == 1 && $probes > 0 } then { pass "$test -p2" } else { fail "$test -p2 ($probes)" }
-exec rm -f $test
diff --git a/testsuite/systemtap.base/statement.exp b/testsuite/systemtap.base/statement.exp
new file mode 100644
index 00000000..d8fce8d8
--- /dev/null
+++ b/testsuite/systemtap.base/statement.exp
@@ -0,0 +1,38 @@
+set test bz6905
+
+catch {exec gcc -g -o $test $srcdir/$subdir/$test.c} err
+if {$err == "" && [file exists $test]} then { pass "$test compile" } else { fail "$test compile" }
+
+spawn stap -p2 $srcdir/$subdir/$test.stp
+set hint 0
+set probes 0
+expect {
+ -timeout 60
+ -re "# probes" { incr hint; exp_continue }
+ -re {process.*statement.*} { incr probes; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+wait
+if { $hint == 1 && $probes > 0 } then { pass "$test -p2" } else { fail "$test -p2 ($probes)" }
+exec rm -f $test
+
+set test bz10294
+
+catch {exec gcc -g -o $test $srcdir/$subdir/$test.c} err
+if {$err == "" && [file exists $test]} then { pass "$test compile" } else { fail "$test compile" }
+
+spawn stap -p2 $srcdir/$subdir/$test.stp
+set hint 0
+set probes 0
+expect {
+ -timeout 60
+ -re "# probes" { incr hint; exp_continue }
+ -re {process.*statement.*} { incr probes; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+wait
+if { $hint == 1 && $probes == 1 } then { pass "$test -p2" } else { fail "$test -p2 ($probes)" }
+exec rm -f $test
+