Revision 14728
Added by Aaron Marcuse-Kubitza about 10 years ago
util.sh | ||
---|---|---|
306 | 306 |
alias get_stack_frame='declare func file line && "get_stack_frame"' |
307 | 307 |
# && instead of ; so it can be used as a while cond |
308 | 308 |
|
309 |
skip_stack_frames() # usage: init_i; exclude=_* skip_stack_frames |
|
309 |
skip_stack_frames() # usage: init_i; exclude=_* [lookahead=1] skip_stack_frames |
|
310 |
# lookahead: look at entry *after* current to deterine whether to skip current. |
|
311 |
# useful for skipping wrappers, by looking at the *calling* function's name. |
|
310 | 312 |
{ |
311 | 313 |
: "${exclude:?}" |
312 | 314 |
skip_stack_frame_in_caller # current function's frame |
315 |
if test "$lookahead"; then skip_stack_frame_in_caller; fi |
|
313 | 316 |
|
314 | 317 |
while get_stack_frame && matches "$exclude" "$func"; do # matching frame |
315 | 318 |
next_stack_frame # skip matching frame |
316 | 319 |
done |
317 | 320 |
|
321 |
if test "$lookahead"; then unskip_stack_frame_in_caller; fi |
|
318 | 322 |
unskip_stack_frame_in_caller |
319 | 323 |
} |
320 | 324 |
|
Also available in: Unified diff
lib/sh/util.sh: skip_stack_frames(): added lookahead support, which looks at entry after current to deterine whether to skip current. this is useful for skipping wrappers, by looking at the calling function's name.