public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: tromey@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer-tromey-python: gdb
Date: Mon, 01 Dec 2008 19:10:00 -0000	[thread overview]
Message-ID: <20081201191050.16622.qmail@sourceware.org> (raw)

The branch, archer-tromey-python has been updated
       via  a3c509dff50be9deb8f84f30123cd0458120874a (commit)
      from  57ef2e848acae84dcb8497a7a126210bc4de74ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a3c509dff50be9deb8f84f30123cd0458120874a
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Dec 1 12:09:55 2008 -0700

    gdb
    	* python/python.c (GdbMethods) <parse_and_eval>: New.
    	(gdbpy_parse_and_eval): New function.
    gdb/doc
    	* gdb.texinfo (Basic Python): Document parse_and_eval.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog       |    5 +++++
 gdb/doc/ChangeLog   |    4 ++++
 gdb/doc/gdb.texinfo |    7 +++++++
 gdb/python/python.c |   23 +++++++++++++++++++++++
 4 files changed, 39 insertions(+), 0 deletions(-)

First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 97a4223..9d51f22 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2008-12-01  Tom Tromey  <tromey@redhat.com>
 
+	* python/python.c (GdbMethods) <parse_and_eval>: New.
+	(gdbpy_parse_and_eval): New function.
+
+2008-12-01  Tom Tromey  <tromey@redhat.com>
+
 	* python/python-value.c (is_intlike): New function.
 	(valpy_int): Use it.
 	(valpy_long): Likewise.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 90a769b..703543b 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,9 @@
 2008-12-01  Tom Tromey  <tromey@redhat.com>
 
+	* gdb.texinfo (Basic Python): Document parse_and_eval.
+
+2008-12-01  Tom Tromey  <tromey@redhat.com>
+
 	* gdb.texinfo (Convenience Vars): Document convenience functions.
 	(Functions In Python): New node.
 	(Python API): Update.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 38d3f1e..dfc19aa 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18099,6 +18099,13 @@ If the named parameter does not exist, this function throws a
 a Python value of the appropriate type, and returned.
 @end defun
 
+@findex gdb.parse_and_eval
+@defun parse_and_eval expression
+Parse @var{expression} as an expression in the current language,
+evaluate it, and return the result as a @code{gdb.Value}.
+@var{expression} must be a string.
+@end defun
+
 @findex gdb.write
 @defun write string
 Print a string to @value{GDBN}'s paginated standard output stream.
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 7b46f0d..bb0b428 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -394,6 +394,26 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+/* Parse a string and evaluate it as an expression.  */
+static PyObject *
+gdbpy_parse_and_eval (PyObject *self, PyObject *args)
+{
+  char *expr_str;
+  struct value *result = NULL;
+  volatile struct gdb_exception except;
+
+  if (!PyArg_ParseTuple (args, "s", &expr_str))
+    return NULL;
+
+  TRY_CATCH (except, RETURN_MASK_ALL)
+    {
+      result = parse_and_eval (expr_str);
+    }
+  GDB_PY_HANDLE_EXCEPTION (except);
+
+  return value_to_value_object (result);
+}
+
 \f
 
 /* Threads.  */
@@ -1374,6 +1394,9 @@ Note: may later change to return an object." },
   { "switch_to_thread", gdbpy_switch_to_thread, METH_VARARGS,
     "Switch to a thread, given the thread ID." },
 
+  { "parse_and_eval", gdbpy_parse_and_eval, METH_VARARGS,
+    "Parse a string as an expression, evaluate it, and return the result." },
+
   { "write", gdbpy_write, METH_VARARGS,
     "Write a string using gdb's filtered stream." },
   { "flush", gdbpy_flush, METH_NOARGS,


hooks/post-receive
--
Repository for Project Archer.


             reply	other threads:[~2008-12-01 19:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 19:10 tromey [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-04-07 20:28 tromey
2009-03-24 17:27 tromey
2009-02-05 19:56 tromey
2008-12-17 23:10 tromey
2008-12-15 22:38 tromey
2008-12-13  0:37 tromey
2008-12-12 23:54 tromey
2008-12-10 15:28 tromey
2008-12-09  0:33 tromey
2008-12-02 21:29 tromey
2008-11-25 21:17 tromey
2008-11-21 18:25 tromey
2008-11-18 18:52 tromey
2008-11-18 15:54 tromey
2008-11-17 15:45 tromey
2008-11-16 22:18 tromey
2008-11-16 16:56 tromey
2008-11-12  1:54 tromey
2008-11-10 14:15 tromey
2008-11-06 21:11 tromey
2008-11-06 19:58 tromey
2008-10-23 22:27 tromey
2008-10-23 21:28 tromey
2008-10-22 18:18 tromey
2008-10-21 18:32 tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081201191050.16622.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).