<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Teach 'br set' a new option: stop if the stack matches a given stack-pattern"
href="http://llvm.org/bugs/show_bug.cgi?id=20108">20108</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Teach 'br set' a new option: stop if the stack matches a given stack-pattern
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Reporter</th>
<td>james.widman@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Suppose a future lldb provides a built-in command, 'stackpat', which takes a
name argument that can later be used to refer to a pattern---given as a
multi-line sequence when the command is entered---that matches zero or more
stacks.
As a convenience, stackpat would also take an option, -b, that causes the
topmost frame of the pattern to be implicitly passed either to 'br set' or to
_regexp-break.
Example session:
% cat -n foo.c
1 void h() {}
2 void g() { h(); }
3 void f() { h(); g(); }
4 int main(int argc, char *argv[])
5 {
6 h();
7 g();
8 f();
9 return 0;
10 }
% cc -g foo.c -o a.out
% lldb -x ./a.out
Current executable set to './a.out' (x86_64).
(lldb) stackpat x -b
Enter frame patterns (just like args to 'breakpoint set' or 'b'). Type DONE to
end.
<span class="quote">> h
> g
> f
> DONE</span >
Breakpoint 1: where = a.out`h + 4 at foo.c:1, address = 0x0000000100000f44,
stackpat=x
(lldb) process launch
Process 55500 launched: './a.out' (x86_64)
Process 55500 stopped
* thread #1: tid = 0x1c8077, 0x0000000100000f44 a.out`h + 4 at foo.c:1, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000f44 a.out`h + 4 at foo.c:1
-> 1 void h() {}
2 void g() { h(); }
3 void f() { h(); g(); }
4 int main(int argc, char *argv[])
5 {
6 h();
7 g();
(lldb) bt
* thread #1: tid = 0x1c8077, 0x0000000100000f44 a.out`h + 4 at foo.c:1, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x0000000100000f44 a.out`h + 4 at foo.c:1
frame #1: 0x0000000100000f59 a.out`g + 9 at foo.c:2
frame #2: 0x0000000100000f6e a.out`f + 14 at foo.c:3
frame #3: 0x0000000100000f95 a.out`main(argc=1, argv=0x00007fff5fbfebc0) +
37 at foo.c:8
(lldb)
---
Here's an example with C++, where it isn't always clear which template
arguments you want to use in the function name regex. Example:
% cat -n foo.cpp
1
2 namespace __Some_lib_impl
3 {
4 struct apparently_unrelated_class {};
5 }
6
7 namespace N
8 {
9 template<class T>
10 struct stuff { typedef
__Some_lib_impl::apparently_unrelated_class U; };
11 } /* N */
12
13
14 template<class T> void tn() {}
15 template<class T> void t2() { tn< typename N::stuff<T>::U >(); }
16 template<class T> void t1() { t2<T>(); }
17 template<class T> void t0() { t1<T>(); }
18 int main(int argc, char *argv[])
19 {
20 tn<int>();
21 t0<double>();
22 return 0;
23 }
% cc -g foo.cpp
% lldb -x ./a.out
Current executable set to './a.out' (x86_64).
(lldb) stackpat y -b
Enter frame patterns (just like args to 'breakpoint set' or 'b'). Type DONE to
end.
<span class="quote">> tn
> ...
> t0
> main
> DONE</span >
Breakpoint 1: 1 location, stackpat = y
(lldb) r
Process 55605 launched: './a.out' (x86_64)
Process 55605 stopped
* thread #1: tid = 0x1ca1b3, 0x0000000100000f64 a.out`void
tn<__Some_lib_impl::apparently_unrelated_class>() + 4 at foo.cpp:14, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000f64 a.out`void
tn<__Some_lib_impl::apparently_unrelated_class>() + 4 at foo.cpp:14
11 } /* N */
12
13
-> 14 template<class T> void tn() {}
15 template<class T> void t2() { tn< typename N::stuff<T>::U >(); }
16 template<class T> void t1() { t2<T>(); }
17 template<class T> void t0() { t1<T>(); }
(lldb) bt
* thread #1: tid = 0x1ca1b3, 0x0000000100000f64 a.out`void
tn<__Some_lib_impl::apparently_unrelated_class>() + 4 at foo.cpp:14, queue =
'com.apple.main-thread', stop reason = breakpoint 2.1
* frame #0: 0x0000000100000f64 a.out`void
tn<__Some_lib_impl::apparently_unrelated_class>() + 4 at foo.cpp:14
frame #1: 0x0000000100000f59 a.out`void t2<double>() + 9 at foo.cpp:15
frame #2: 0x0000000100000f49 a.out`void t1<double>() + 9 at foo.cpp:16
frame #3: 0x0000000100000f39 a.out`void t0<double>() + 9 at foo.cpp:17
frame #4: 0x0000000100000f10 a.out`main(argc=1, argv=0x00007fff5fbfebd0) +
32 at foo.cpp:21
(lldb)
The stackpat name ("x", "y" above) could then be re-used in other 'br set'
commands or in other stackpat commands.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>