public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* feature idea: upto
@ 2009-07-02 22:34 Roland McGrath
  2009-07-07 16:18 ` [python] implement "upto" (Was: feature idea: upto) Tom Tromey
  2009-07-23  7:00 ` feature idea: upto Jim Blandy
  0 siblings, 2 replies; 9+ messages in thread
From: Roland McGrath @ 2009-07-02 22:34 UTC (permalink / raw)
  To: Project Archer

A common pattern for me is to hit a breakpoint or signal/crash,
and then "up" and hit return until I'm where I want to be.
When it's many frames I do "bt" and then "f N" after eyeballing
the particular frame.  

With today's programs, the "bt" output can have really long lines (e.g. 
huge C++ names, calls with many/long-valued arguments) so the quick
eyeball scan is not so quick any more.

Some common eyeball-based algorithms seem automatable:

upto "a frame with source"
upto source foobar.c
upto source */myapp/*
upto shlib foo.so*
upto exec			# not shlib
upto func
upto funcpfx_*
upto cl::func(over,load)
upto cl::			# any method/func with this ns/class prefix
upto foo.c:27 where arg==17	# skip frames where !expr
upto where arg==23		# also skip frames where expr not resolvable
upto where $r13 == 27		# cond can apply to any context

Perhaps some other dwimmy options too, like "upto mine" which is sort of
"upto source skipping /usr/include/* /usr/src/debug/*" or some stranger
heuristic.  (Maybe something like upto a frame whose source line's file
name shares a longish prefix with the executable, or with cwd, or something.)


Thanks,
Roland

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [python] implement "upto" (Was: feature idea: upto)
  2009-07-02 22:34 feature idea: upto Roland McGrath
@ 2009-07-07 16:18 ` Tom Tromey
  2009-07-09  4:25   ` Roland McGrath
  2009-07-23  7:00 ` feature idea: upto Jim Blandy
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2009-07-07 16:18 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Project Archer

Roland> upto "a frame with source"
Roland> upto source foobar.c
Roland> upto source */myapp/*
Roland> upto shlib foo.so*
Roland> upto exec			# not shlib
Roland> upto func
Roland> upto funcpfx_*
Roland> upto cl::func(over,load)
Roland> upto cl::			# any method/func with this ns/class prefix
Roland> upto foo.c:27 where arg==17	# skip frames where !expr
Roland> upto where arg==23		# also skip frames where expr not resolvable
Roland> upto where $r13 == 27		# cond can apply to any context

For fun I wrote a simple implementation of this.
It isn't perfect, and doesn't do quite everything above, but it does a
lot of it.

I think this exposes some oddities in the gdb.Frame API.  We don't
have a nice way to print a frame in a gdb-like way.  And, all the
FrameWrapper code seems like something that should just go away.

Arguably the base command here should just be named "up".

Patch appended.  I'll commit shortly.

Tom

gdb
	* python/python-symtab.c (stpy_get_objfile): New function.
	(symtab_object_getset): Add "objfile".
	* python/python-frame.c (frapy_select): New function.
	(frame_object_methods): Add "select".
	* python/lib/gdb/command/upto.py: New file.
	* python/lib/gdb/command/backtrace.py: Move code to
	FrameWrapper.py.
	* python/lib/gdb/FrameWrapper.py: New file.
	* Makefile.in (PY_FILES): Add new files.
gdb/doc
	* gdb.texinfo (Frames In Python): Document Frame.select.

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 0d8c3ed..947bcd5 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1957,9 +1957,9 @@ python-value.o: $(srcdir)/python/python-value.c
 
 # All python library files, with the "python/lib" stripped off.
 # Note that we should only install files in the "gdb" module.
-PY_FILES = gdb/FrameIterator.py gdb/command/alias.py \
+PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \
     gdb/command/backtrace.py gdb/command/require.py \
-    gdb/command/pahole.py gdb/command/__init__.py \
+    gdb/command/pahole.py gdb/command/upto.py gdb/command/__init__.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/function/caller_is.py gdb/function/in_scope.py \
     gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 234397e..7ac503f 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -20262,6 +20262,10 @@ Return the frame's symtab and line object. @c (@pxref{Symtab_and_line,, Symtab a
 Return the value of the given variable in this frame.  @var{variable} must
 be a string.
 @end defmethod
+
+@defmethod Frame select
+Set this frame to be the user's selected frame.
+@end defmethod
 @end table
 
 @node Interpreters
diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py
new file mode 100644
index 0000000..39f8246
--- /dev/null
+++ b/gdb/python/lib/gdb/FrameWrapper.py
@@ -0,0 +1,112 @@
+# Wrapper API for frames.
+
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+
+# FIXME: arguably all this should be on Frame somehow.
+class FrameWrapper:
+    def __init__ (self, frame):
+        self.frame = frame;
+
+    def write_symbol (self, stream, sym, block):
+        if len (sym.linkage_name):
+            nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
+            if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
+                sym = nsym
+
+        stream.write (sym.print_name + "=")
+        try:
+            val = self.frame.read_var (sym)
+            if val != None:
+                val = str (val)
+        # FIXME: would be nice to have a more precise exception here.
+        except RuntimeError, text:
+            val = text
+        if val == None:
+            stream.write ("???")
+        else:
+            stream.write (str (val))
+
+    def print_frame_locals (self, stream, func):
+        if not func:
+            return
+
+        first = True
+        block = func.value
+
+        for sym in block:
+            if sym.is_argument:
+                continue;
+
+            self.write_symbol (stream, sym, block)
+            stream.write ('\n')
+
+    def print_frame_args (self, stream, func):
+        if not func:
+            return
+
+        first = True
+        block = func.value
+
+        for sym in block:
+            if not sym.is_argument:
+                continue;
+
+            if not first:
+                stream.write (", ")
+
+            self.write_symbol (stream, sym, block)
+            first = False
+
+    # FIXME: this should probably just be a method on gdb.Frame.
+    # But then we need stream wrappers.
+    def describe (self, stream, full):
+        if self.frame.type () == gdb.DUMMY_FRAME:
+            stream.write (" <function called from gdb>\n")
+        elif self.frame.type () == gdb.SIGTRAMP_FRAME:
+            stream.write (" <signal handler called>\n")
+        else:
+            sal = self.frame.find_sal ()
+            pc = self.frame.pc ()
+            name = self.frame.name ()
+            if not name:
+                name = "??"
+            if pc != sal.pc or not sal.symtab:
+                stream.write (" 0x%08x in" % pc)
+            stream.write (" " + name + " (")
+
+            func = self.frame.function ()
+            self.print_frame_args (stream, func)
+
+            stream.write (")")
+
+            if sal.symtab and sal.symtab.filename:
+                stream.write (" at " + sal.symtab.filename)
+                stream.write (":" + str (sal.line))
+
+            if not self.frame.name () or (not sal.symtab or not sal.symtab.filename):
+                lib = gdb.solib_address (pc)
+                if lib:
+                    stream.write (" from " + lib)
+
+            stream.write ("\n")
+
+            if full:
+                self.print_frame_locals (stream, func)
+
+    def __getattr__ (self, name):
+        return getattr (self.frame, name)
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index c49fd55..ec9a527 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -19,101 +19,9 @@ import gdb
 import gdb.backtrace
 import itertools
 from gdb.FrameIterator import FrameIterator
+from gdb.FrameWrapper import FrameWrapper
 import sys
 
-class FrameWrapper:
-    def __init__ (self, frame):
-        self.frame = frame;
-
-    def write_symbol (self, stream, sym, block):
-        if len (sym.linkage_name):
-            nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block)
-            if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER:
-                sym = nsym
-
-        stream.write (sym.print_name + "=")
-        try:
-            val = self.frame.read_var (sym)
-            if val != None:
-                val = str (val)
-        # FIXME: would be nice to have a more precise exception here.
-        except RuntimeError, text:
-            val = text
-        if val == None:
-            stream.write ("???")
-        else:
-            stream.write (str (val))
-
-    def print_frame_locals (self, stream, func):
-        if not func:
-            return
-
-        first = True
-        block = func.value
-
-        for sym in block:
-            if sym.is_argument:
-                continue;
-
-            self.write_symbol (stream, sym, block)
-            stream.write ('\n')
-
-    def print_frame_args (self, stream, func):
-        if not func:
-            return
-
-        first = True
-        block = func.value
-
-        for sym in block:
-            if not sym.is_argument:
-                continue;
-
-            if not first:
-                stream.write (", ")
-
-            self.write_symbol (stream, sym, block)
-            first = False
-
-    # FIXME: this should probably just be a method on gdb.Frame.
-    # But then we need stream wrappers.
-    def describe (self, stream, full):
-        if self.frame.type () == gdb.DUMMY_FRAME:
-            stream.write (" <function called from gdb>\n")
-        elif self.frame.type () == gdb.SIGTRAMP_FRAME:
-            stream.write (" <signal handler called>\n")
-        else:
-            sal = self.frame.find_sal ()
-            pc = self.frame.pc ()
-            name = self.frame.name ()
-            if not name:
-                name = "??"
-            if pc != sal.pc or not sal.symtab:
-                stream.write (" 0x%08x in" % pc)
-            stream.write (" " + name + " (")
-
-            func = self.frame.function ()
-            self.print_frame_args (stream, func)
-
-            stream.write (")")
-
-            if sal.symtab and sal.symtab.filename:
-                stream.write (" at " + sal.symtab.filename)
-                stream.write (":" + str (sal.line))
-
-            if not self.frame.name () or (not sal.symtab or not sal.symtab.filename):
-                lib = gdb.solib_address (pc)
-                if lib:
-                    stream.write (" from " + lib)
-
-            stream.write ("\n")
-
-            if full:
-                self.print_frame_locals (stream, func)
-
-    def __getattr__ (self, name):
-        return getattr (self.frame, name)
-
 class ReverseBacktraceParameter (gdb.Parameter):
     """The new-backtrace command can show backtraces in 'reverse' order.
 This means that the innermost frame will be printed last.
diff --git a/gdb/python/lib/gdb/command/upto.py b/gdb/python/lib/gdb/command/upto.py
new file mode 100644
index 0000000..faf54ed
--- /dev/null
+++ b/gdb/python/lib/gdb/command/upto.py
@@ -0,0 +1,129 @@
+# upto command.
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import gdb
+import re
+from gdb.FrameIterator import FrameIterator
+from gdb.FrameWrapper import FrameWrapper
+
+class UptoPrefix (gdb.Command):
+    def __init__ (self):
+        super (UptoPrefix, self).__init__ ("upto", gdb.COMMAND_STACK,
+                                           prefix = True)
+
+class UptoImplementation (gdb.Command):
+    def __init__ (self, subcommand):
+        super (UptoImplementation, self).__init__ ("upto " + subcommand,
+                                                   gdb.COMMAND_STACK)
+
+    def search (self):
+        saved = gdb.selected_frame ()
+        iter = FrameIterator (saved)
+        found = False
+        try:
+            for frame in iter:
+                frame.select ()
+                try:
+                    if self.filter (frame):
+                        wrapper = FrameWrapper (frame)
+                        wrapper.describe (sys.stdout, False)
+                        return
+                except:
+                    pass
+        except:
+            pass
+        saved.select ()
+        raise RuntimeError, 'Could not find a matching frame'
+
+    def invoke (self, arg, from_tty):
+        self.rx = re.compile (arg)
+        self.search ()
+
+class UptoSymbolCommand (UptoImplementation):
+    """Select and print some calling stack frame, based on symbol.
+The argument is a regular expression.  This command moves up the
+stack, stopping at the first frame whose symbol matches the regular
+expression."""
+
+    def __init__ (self):
+        super (UptoSymbolCommand, self).__init__ ("symbol")
+
+    def filter (self, frame):
+        name = frame.name ()
+        if name is not None:
+            if self.rx.search (name) is not None:
+                return True
+        return False
+
+class UptoSourceCommand (UptoImplementation):
+    """Select and print some calling stack frame, based on source file.
+The argument is a regular expression.  This command moves up the
+stack, stopping at the first frame whose source file name matches the
+regular expression."""
+
+    def __init__ (self):
+        super (UptoSourceCommand, self).__init__ ("source")
+
+    def filter (self, frame):
+        name = frame.find_sal ().symtab.filename
+        if name is not None:
+            if self.rx.search (name) is not None:
+                return True
+        return False
+
+class UptoObjectCommand (UptoImplementation):
+    """Select and print some calling stack frame, based on object file.
+The argument is a regular expression.  This command moves up the
+stack, stopping at the first frame whose object file name matches the
+regular expression."""
+
+    def __init__ (self):
+        super (UptoObjectCommand, self).__init__ ("object")
+
+    def filter (self, frame):
+        name = frame.find_sal ().symtab.objfile.filename
+        if name is not None:
+            if self.rx.search (name) is not None:
+                return True
+        return False
+
+class UptoWhereCommand (UptoImplementation):
+    """Select and print some calling stack frame, based on expression.
+The argument is an expression.  This command moves up the stack,
+parsing and evaluating the expression in each frame.  This stops when
+the expression evaluates to a non-zero (true) value."""
+
+    def __init__ (self):
+        super (UptoWhereCommand, self).__init__ ("where")
+
+    def filter (self, frame):
+        try:
+            if gdb.parse_and_eval (self.expression):
+                return True
+        except:
+            pass
+        return False
+
+    def invoke (self, arg, from_tty):
+        self.expression = arg
+        self.search ()
+
+UptoPrefix ()
+UptoSymbolCommand ()
+UptoSourceCommand ()
+UptoObjectCommand ()
+UptoWhereCommand ()
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 229ba30..3d2f61f 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -440,6 +440,25 @@ frapy_read_var (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+/* Select this frame.  */
+
+static PyObject *
+frapy_select (PyObject *self, PyObject *args)
+{
+  struct frame_info *fi;
+  frame_object *frame = (frame_object *) self;
+  volatile struct gdb_exception except;
+
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    {
+      FRAPY_REQUIRE_VALID (frame, fi);
+      select_frame (fi);
+    }
+  GDB_PY_HANDLE_EXCEPTION (except);
+
+  Py_RETURN_NONE;
+}
+
 /* Implementation of gdb.selected_frame () -> gdb.Frame.
    Returns the selected frame object.  */
 
@@ -577,6 +596,8 @@ Return the frame's symtab and line." },
   { "read_var", frapy_read_var, METH_VARARGS,
     "read_var (variable) -> gdb.Value.\n\
 Return the value of the variable in this frame." },
+  { "select", frapy_select, METH_NOARGS,
+    "Select this frame as the user's current frame." },
   {NULL}  /* Sentinel */
 };
 
diff --git a/gdb/python/python-symtab.c b/gdb/python/python-symtab.c
index a48c38c..830e586 100644
--- a/gdb/python/python-symtab.c
+++ b/gdb/python/python-symtab.c
@@ -1,6 +1,6 @@
 /* Python interface to symbol tables.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -78,6 +78,15 @@ stpy_get_filename (PyObject *self, void *closure)
 }
 
 static PyObject *
+stpy_get_objfile (PyObject *self, void *closure)
+{
+  symtab_object *self_symtab = (symtab_object *) self;
+  PyObject *result = objfile_to_objfile_object (self_symtab->symtab->objfile);
+  Py_INCREF (result);
+  return result;
+}
+
+static PyObject *
 stpy_fullname (PyObject *self, PyObject *args)
 {
   char *fullname;
@@ -225,6 +234,8 @@ gdbpy_initialize_symtabs (void)
 static PyGetSetDef symtab_object_getset[] = {
   { "filename", stpy_get_filename, NULL,
     "The symbol table's source filename.", NULL },
+  { "objfile", stpy_get_objfile, NULL, "The symtab's objfile.",
+    NULL },
   {NULL}  /* Sentinel */
 };
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [python] implement "upto" (Was: feature idea: upto)
  2009-07-07 16:18 ` [python] implement "upto" (Was: feature idea: upto) Tom Tromey
@ 2009-07-09  4:25   ` Roland McGrath
  2009-07-17 22:06     ` [python] implement "upto" Tom Tromey
  0 siblings, 1 reply; 9+ messages in thread
From: Roland McGrath @ 2009-07-09  4:25 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Project Archer

> For fun I wrote a simple implementation of this.
> It isn't perfect, and doesn't do quite everything above, but it does a
> lot of it.

Neat!  I'm glad it was in the same ballpark of easyish I imagined it might be.

> Roland> upto "a frame with source"

It looks to me like "upto source .*" would do this.
Maybe make that default for "upto source" with no further argument?

> Roland> upto foo.c:27 where arg==17	# skip frames where !expr

For real sex appeal, I think being able to combine conditions with other
selectors is key.

> Arguably the base command here should just be named "up".

Hmm.

(gdb) up 2 from func
(gdb) up 3 from where arg==87

So the "upto" case is just shorthand for "up 0 from ...".

Also, I presume there is nothing nontrivial about parallels for "down".
(A generalized "parse command fragment to frame filter" for the guts is
probably desireable to be able to use in other python-implemented commands.)


Thanks,
Roland

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [python] implement "upto"
  2009-07-09  4:25   ` Roland McGrath
@ 2009-07-17 22:06     ` Tom Tromey
  2009-07-20  6:17       ` Roland McGrath
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2009-07-17 22:06 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Project Archer

>>>>> "Roland" == Roland McGrath <roland@redhat.com> writes:

Roland> It looks to me like "upto source .*" would do this.
Roland> Maybe make that default for "upto source" with no further argument?

Yeah, good idea.

Roland> For real sex appeal, I think being able to combine conditions with other
Roland> selectors is key.

Yeah.

Roland> (gdb) up 2 from func
Roland> (gdb) up 3 from where arg==87

Roland> So the "upto" case is just shorthand for "up 0 from ...".

Or just "up from"

Roland> Also, I presume there is nothing nontrivial about parallels for
Roland> "down".  (A generalized "parse command fragment to frame filter"
Roland> for the guts is probably desireable to be able to use in other
Roland> python-implemented commands.)

Yeah to both.  As to when I can get to any of it, who knows :(

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [python] implement "upto"
  2009-07-17 22:06     ` [python] implement "upto" Tom Tromey
@ 2009-07-20  6:17       ` Roland McGrath
  0 siblings, 0 replies; 9+ messages in thread
From: Roland McGrath @ 2009-07-20  6:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Project Archer

> Roland> So the "upto" case is just shorthand for "up 0 from ...".
> 
> Or just "up from"

Right, I just meant to indicate the general case.

> Roland> Also, I presume there is nothing nontrivial about parallels for
> Roland> "down".  (A generalized "parse command fragment to frame filter"
> Roland> for the guts is probably desireable to be able to use in other
> Roland> python-implemented commands.)
> 
> Yeah to both.  As to when I can get to any of it, who knows :(

Don't worry about that.  These are just random feature ideas and any bits
of progress toward them is gratifying to see.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: feature idea: upto
  2009-07-02 22:34 feature idea: upto Roland McGrath
  2009-07-07 16:18 ` [python] implement "upto" (Was: feature idea: upto) Tom Tromey
@ 2009-07-23  7:00 ` Jim Blandy
  2009-07-23 18:15   ` Roland McGrath
  1 sibling, 1 reply; 9+ messages in thread
From: Jim Blandy @ 2009-07-23  7:00 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Project Archer

For aborts and asserts, I don't think anyone would mind a
default-to-on feature that simply *always* selects the stack frame of
the function containing the abort or assert.  And even before a pony,
I'd like to be able to add my own list of
error-printing-functions-that-squawk-and-call-abort that should be
unwound from.  .gdbinit already lists some of these.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: feature idea: upto
  2009-07-23  7:00 ` feature idea: upto Jim Blandy
@ 2009-07-23 18:15   ` Roland McGrath
  2009-07-23 18:52     ` Tom Tromey
  0 siblings, 1 reply; 9+ messages in thread
From: Roland McGrath @ 2009-07-23 18:15 UTC (permalink / raw)
  To: Jim Blandy; +Cc: Project Archer

> For aborts and asserts, I don't think anyone would mind a
> default-to-on feature that simply *always* selects the stack frame of
> the function containing the abort or assert.  And even before a pony,
> I'd like to be able to add my own list of
> error-printing-functions-that-squawk-and-call-abort that should be
> unwound from.  .gdbinit already lists some of these.

Indeed, my ~/.gdbinit has:

	define catch crash
	catch throw
	b abort
	b __assert_fail
	b __assert_perror_fail
	end

But non-nesting "end" parsing means I can't write:

	define catch crash
	catch throw
	  comm
	  up
	  end
	b abort
	  comm
	  up
	  end
	b __assert_fail
	  comm
	  up
	  end
	b __assert_perror_fail
	  comm
	  up
	  end
	end

as I would like to.

In particular "catch throw" is comically no more useful than "b __cxa_throw"
and it would seem most natural for it to do something like the "up"
automagically.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: feature idea: upto
  2009-07-23 18:15   ` Roland McGrath
@ 2009-07-23 18:52     ` Tom Tromey
  2009-07-23 19:08       ` Roland McGrath
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2009-07-23 18:52 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Jim Blandy, Project Archer

>>>>> "Roland" == Roland McGrath <roland@redhat.com> writes:

Roland> But non-nesting "end" parsing means I can't write:
[...]

This should work.  It is a bug that it doesn't.

Roland> In particular "catch throw" is comically no more useful than "b
Roland> __cxa_throw" and it would seem most natural for it to do
Roland> something like the "up" automagically.

We discussed this a little.  My recollection is that Daniel tried this
but concluded that MI clients get confused when gdb stops and the
selected frame is not the newest frame.  So, some kind of MI extension
or change is needed.

I don't think we pursued it past that, though it is still nominally on
our to-do list.  Also it is:
http://sourceware.org/bugzilla/show_bug.cgi?id=9599

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: feature idea: upto
  2009-07-23 18:52     ` Tom Tromey
@ 2009-07-23 19:08       ` Roland McGrath
  0 siblings, 0 replies; 9+ messages in thread
From: Roland McGrath @ 2009-07-23 19:08 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Jim Blandy, Project Archer

> We discussed this a little.  My recollection is that Daniel tried this
> but concluded that MI clients get confused when gdb stops and the
> selected frame is not the newest frame.  So, some kind of MI extension
> or change is needed.

For "catch throw" I can sort of see the point of the "inner" frame.  But
perhaps it can be presented better.  That is, it really is the frame where
the exception exists and you can find the exception object via ABI rules.
In the calling frame, it's really just some caller that constructed an
object and is passing it down.  This has already happened, so the work of
that "throw" statement (i.e. the object construction) is indeed not where
you stopped.  I think of it as a bit like a signal frame.  It is really
there and distinct, but the next one out is the interesting one to think
about.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-07-23 19:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-02 22:34 feature idea: upto Roland McGrath
2009-07-07 16:18 ` [python] implement "upto" (Was: feature idea: upto) Tom Tromey
2009-07-09  4:25   ` Roland McGrath
2009-07-17 22:06     ` [python] implement "upto" Tom Tromey
2009-07-20  6:17       ` Roland McGrath
2009-07-23  7:00 ` feature idea: upto Jim Blandy
2009-07-23 18:15   ` Roland McGrath
2009-07-23 18:52     ` Tom Tromey
2009-07-23 19:08       ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).