Project

General

Profile

« Previous | Next » 

Revision 14727

fix: lib/sh/util.sh: skip_stack_frames(): for new skip_stack_frames rather than get_stack_frame behavior, stack frames must be skipped in the caller to preserve the stack frame pointer

View differences:

trunk/lib/sh/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: exclude=_* skip_stack_frames
309
skip_stack_frames() # usage: init_i; exclude=_* skip_stack_frames
310 310
{
311
	: "${exclude:?}"; skip_stack_frame; init_i
311
	: "${exclude:?}"
312
	skip_stack_frame_in_caller # current function's frame
313
	
312 314
	while get_stack_frame && matches "$exclude" "$func"; do # matching frame
313 315
		next_stack_frame # skip matching frame
314 316
	done
317
	
318
	unskip_stack_frame_in_caller
315 319
}
316 320

  
317 321
format_stack_frame() #usage: "$(func=_ file=_ line=_ format_stack_frame [args])"

Also available in: Unified diff