From patchwork Thu Mar 5 14:59:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Wingo X-Patchwork-Id: 5476 Received: (qmail 45050 invoked by alias); 5 Mar 2015 14:59:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 44960 invoked by uid 89); 5 Mar 2015 14:59:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_NEUTRAL autolearn=ham version=3.3.2 X-HELO: sasl.smtp.pobox.com Received: from pb-sasl1.int.icgroup.com (HELO sasl.smtp.pobox.com) (208.72.237.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Mar 2015 14:59:54 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id E9A923A731 for ; Thu, 5 Mar 2015 09:59:51 -0500 (EST) Received: from pb-sasl1.int.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id E279F3A72F for ; Thu, 5 Mar 2015 09:59:51 -0500 (EST) Received: from rusty (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id CEB0B3A72E for ; Thu, 5 Mar 2015 09:59:50 -0500 (EST) From: Andy Wingo To: gdb-patches@sourceware.org Subject: [PATCH] Add objfile-progspace to Guile interface Date: Thu, 05 Mar 2015 15:59:47 +0100 Message-ID: <87wq2vwkv0.fsf@igalia.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Disposition: inline; filename=0001-Add-objfile-progspace-to-Guile-interface.patch X-Pobox-Relay-ID: 4623AF5E-C348-11E4-93B6-B058D0B8C469-02397024!pb-sasl1.pobox.com X-IsSubscribed: yes From c77495c00086239a0f03ffb653183ae41d81ac57 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 5 Mar 2015 15:56:31 +0100 Subject: [PATCH] Add objfile-progspace to Guile interface This commit adds an objfile-progspace accessor to the (gdb) Guile module. gdb/testsuite/ChangeLog: * gdb.guile/scm-objfile.exp: Add objfile-progspace test. gdb/doc/ChangeLog: * guile.texi (Objfiles In Guile): Document objfile-progspace. gdb/ChangeLog: * guile/scm-objfile.c (gdbscm_objfile_progspace): New function. (objfile_functions): Bind gdbscm_objfile_progspace to objfile-progspace. * guile/lib/gdb.scm: Add objfile-progspace to exports. --- gdb/ChangeLog | 7 +++++++ gdb/doc/ChangeLog | 4 ++++ gdb/doc/guile.texi | 5 +++++ gdb/guile/lib/gdb.scm | 1 + gdb/guile/scm-objfile.c | 17 +++++++++++++++++ gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.guile/scm-objfile.exp | 3 +++ 7 files changed, 41 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b1c8a29..a5e98ed 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2015-03-05 Andy Wingo + + * guile/scm-objfile.c (gdbscm_objfile_progspace): New function. + (objfile_functions): Bind gdbscm_objfile_progspace to + objfile-progspace. + * guile/lib/gdb.scm: Add objfile-progspace to exports. + 2015-02-10 Andy Wingo * guile/guile.c (_initialize_guile): Disable automatic diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2b2ad5a..c7afd0f 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-03-05 Andy Wingo + + * guile.texi (Objfiles In Guile): Document objfile-progspace. + 2015-03-03 Philippe Proulx eeppeliteloop@gmail.com * gdb.texinfo (gdb/mi Async Records): Fix duplicate syscall-entry diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi index 53e69f2..4a4365c 100644 --- a/gdb/doc/guile.texi +++ b/gdb/doc/guile.texi @@ -2250,6 +2250,11 @@ Return the file name of @var{objfile} as a string, with symbolic links resolved. @end deffn +@deffn {Scheme Procedure} objfile-progspace objfile +Return the @code{} that this object file lives in. +@xref{Progspaces In Guile}, for more on progspaces. +@end deffn + @deffn {Scheme Procedure} objfile-pretty-printers objfile Return the list of registered @code{} objects for @var{objfile}. @xref{Guile Pretty Printing API}, for more information. diff --git a/gdb/guile/lib/gdb.scm b/gdb/guile/lib/gdb.scm index cc35bc1..385085a 100644 --- a/gdb/guile/lib/gdb.scm +++ b/gdb/guile/lib/gdb.scm @@ -281,6 +281,7 @@ objfile? objfile-valid? objfile-filename + objfile-progspace objfile-pretty-printers set-objfile-pretty-printers! current-objfile diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c index 8e94b96..080b905 100644 --- a/gdb/guile/scm-objfile.c +++ b/gdb/guile/scm-objfile.c @@ -252,6 +252,19 @@ gdbscm_objfile_filename (SCM self) return gdbscm_scm_from_c_string (objfile_name (o_smob->objfile)); } +/* (objfile-progspace ) -> + Returns the objfile's progspace. + Throw's an exception if the underlying objfile is invalid. */ + +static SCM +gdbscm_objfile_progspace (SCM self) +{ + objfile_smob *o_smob + = ofscm_get_valid_objfile_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); + + return psscm_scm_from_pspace (o_smob->objfile->pspace); +} + /* (objfile-pretty-printers ) -> list Returns the list of pretty-printers for this objfile. */ @@ -388,6 +401,10 @@ Return #t if the objfile is valid (hasn't been deleted from gdb)." }, "\ Return the file name of the objfile." }, + { "objfile-progspace", 1, 0, 0, gdbscm_objfile_progspace, + "\ +Return the progspace that the objfile lives in." }, + { "objfile-pretty-printers", 1, 0, 0, gdbscm_objfile_pretty_printers, "\ Return a list of pretty-printers of the objfile." }, diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3b7bf7d..8f79e21 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-05 Andy Wingo + + * gdb.guile/scm-objfile.exp: Add objfile-progspace test. + 2015-03-02 Pedro Alves * gdb.threads/thread-execl.exp (do_test): Handle non-stop. diff --git a/gdb/testsuite/gdb.guile/scm-objfile.exp b/gdb/testsuite/gdb.guile/scm-objfile.exp index c58f4c4..8edda94 100644 --- a/gdb/testsuite/gdb.guile/scm-objfile.exp +++ b/gdb/testsuite/gdb.guile/scm-objfile.exp @@ -48,6 +48,9 @@ gdb_test "gu (print (->bool (or-map (lambda (o) (string-contains (objfile-filena gdb_test "gu (print (objfile-pretty-printers objfile))" \ "= \\(\\)" +gdb_test "gu (print (eq? (current-progspace) (objfile-progspace objfile)))" \ + "= #t" + gdb_test "guile (set-objfile-pretty-printers! objfile 0)" \ "ERROR: .*: Wrong type argument in position 2 \\(expecting list\\): 0.*"