comparison libinterp/corefcn/toplev.cc @ 18440:96a495813047

Don't put parent function in subfunction stack structure name (bug #41506). * debug.cc (do_dbstack): When returning a structure, call octave_call_stack::backtrace with print_subfn set to false. * toplev.h (octave_call_stack::backtrace): Create new 2 argument function signature which calls do_backtrace with print_subfn set to true. Create new 3 argument function signature which passes print_subfn argument through to do_backtrace. * toplev.cc (octave_call_stack::do_backtrace): Change function to accept 3rd argument, print_subfn, which decides whether the parent function should be printed in the name field of the backtrace.
author Rik <rik@octave.org>
date Sat, 08 Feb 2014 14:44:21 -0800
parents 75d7cde2dda4
children bc31d9359cf9
comparison
equal deleted inserted replaced
18439:d5aa615dcf4c 18440:96a495813047
299 return octave_map (dim_vector (0, 1), bt_fields); 299 return octave_map (dim_vector (0, 1), bt_fields);
300 } 300 }
301 301
302 octave_map 302 octave_map
303 octave_call_stack::do_backtrace (size_t nskip, 303 octave_call_stack::do_backtrace (size_t nskip,
304 octave_idx_type& curr_user_frame) const 304 octave_idx_type& curr_user_frame,
305 bool print_subfn) const
305 { 306 {
306 size_t user_code_frames = do_num_user_code_frames (curr_user_frame); 307 size_t user_code_frames = do_num_user_code_frames (curr_user_frame);
307 308
308 size_t nframes = nskip <= user_code_frames ? user_code_frames - nskip : 0; 309 size_t nframes = nskip <= user_code_frames ? user_code_frames - nskip : 0;
309 310
338 scope(k) = elt.scope; 339 scope(k) = elt.scope;
339 context(k) = elt.context; 340 context(k) = elt.context;
340 341
341 file(k) = f->fcn_file_name (); 342 file(k) = f->fcn_file_name ();
342 std::string parent_fcn_name = f->parent_fcn_name (); 343 std::string parent_fcn_name = f->parent_fcn_name ();
343 if (parent_fcn_name == std::string ()) 344 if (! print_subfn || parent_fcn_name == std::string ())
344 name(k) = f->name (); 345 name(k) = f->name ();
345 else 346 else
346 name(k) = f->parent_fcn_name () + Vfilemarker + f->name (); 347 name(k) = f->parent_fcn_name () + Vfilemarker + f->name ();
347 348
348 line(k) = elt.line; 349 line(k) = elt.line;