# HG changeset patch # User Lachlan Andrew # Date 1455274701 -39600 # Node ID b248c28d9a7bcd68fee1e57f9ae227344e178271 # Parent af8118df8292158073998ab2d532049c1c4d42e7 Make dbstatus return correct filename and function name (bug #41540). * debug.cc (Fdebugstatus): call octave_canonicalize_file_name. * debug.cc (get_breakpoint_list): Use bp_set instead of f->name() to get class names. Use Vfilemarker only if breakpoint not in main cmds * debug.cc (do_add_breakpoint_1): Replace '>' by Vfilemarker. diff -r af8118df8292 -r b248c28d9a7b libinterp/corefcn/debug.cc --- a/libinterp/corefcn/debug.cc Sun Feb 14 09:22:13 2016 -0800 +++ b/libinterp/corefcn/debug.cc Fri Feb 12 21:58:21 2016 +1100 @@ -36,6 +36,7 @@ #include "defun.h" #include "error.h" +#include "file-ops.h" #include "help.h" #include "input.h" #include "pager.h" @@ -580,7 +581,7 @@ // normalise to store only the file name. // otherwise, there can be an entry for both file>subfunction and // file, which causes a crash on dbclear all - const char *s = strchr (fname.c_str (), '>'); + const char *s = strchr (fname.c_str (), Vfilemarker); if (s) bp_set.insert (fname.substr (0, s - fname.c_str ())); else @@ -874,12 +875,7 @@ std::list bkpts = cmds->breakpoints_and_conds (); if (!bkpts.empty ()) - { - if (f->name () == *it) - retval[f->name ()] = bkpts; - else - retval[*it + ">" + f->name ()] = bkpts; - } + retval[*it] = bkpts; } // look for breakpoints in subfunctions @@ -904,10 +900,7 @@ = cmds->breakpoints_and_conds (); if (!bkpts.empty ()) - { - std::string name = f->name () + ">" + ff->name (); - retval[name] = bkpts; - } + retval[*it + Vfilemarker + ff->name ()] = bkpts; } } } @@ -1429,10 +1422,11 @@ it != bp_list.end (); it++) { std::string filename = it->first; - const char *sub_fun = strchr (filename.c_str (), '>'); + const char *sub_fun = strchr (filename.c_str (), Vfilemarker); if (sub_fun) filename = filename.substr(0, sub_fun - filename.c_str ()); - octave_value path_name = do_which (filename); + octave_value path_name = octave_canonicalize_file_name + (do_which (filename)); for (std::list::const_iterator j = it->second.begin (); j != it->second.end (); j++) @@ -1470,6 +1464,22 @@ } } +/* +%!test +%! dbstop @ftp/dir; +%! dbstop @audioplayer/set 70; +%! dbstop quantile>__quantile__; +%! dbstop ls; +%! a = dbstatus; +%! assert (a(1).name, "@audioplayer/set>setproperty") +%! assert (a(2).name, "@ftp/dir") +%! assert (a(3).name, "ls") +%! assert (a(4).name, "quantile>__quantile__") +%! assert (a(2).file(end-10:end), "/@ftp/dir.m"); +%!test +%! dbclear all % ensure no bp left for future tests, even if the above fails +*/ + DEFUN (dbwhere, , , "-*- texinfo -*-\n\ @deftypefn {} {} dbwhere\n\