public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-27  0:35 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-27  0:35 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  b4cea04f7087964540e9d0db6e9657a15e440b98 (commit)
       via  ae28faf8149f10bc50cb934cd43322d7a087b288 (commit)
       via  68ac9fbeb0ff5bc68f44bfd25445a2243ef3dc79 (commit)
       via  33b84b7e2f03c65b80ccaf9fbb23b74ea1daa15e (commit)
       via  3ebbd04cee427232781580ec88e5d1ea854d1012 (commit)
       via  19fc9ea51670fe922d23666bf266d9989dfaf406 (commit)
       via  f61b37d302f01d90aacd950bc07a28dfc7c65843 (commit)
       via  4ee4444d270da286405a6866ef9f5327a4134ccf (commit)
       via  2452a5310e0cc74d821e9dd38fe732fd20b49bdd (commit)
       via  b743cd1c3f2b189a94a131da8398f8cfd018b790 (commit)
       via  149d3d63479f8e023eefeb4216708d13e48e5d6e (commit)
       via  2cfda40f4e2ff20e1c33aec7346a696007112c50 (commit)
       via  677f32e1535ac08ee097d4658fc6d5eef6934db2 (commit)
       via  179567294703e9643a0aebb0896a1c7df9ba79d1 (commit)
       via  95b4138baf512e661d95b09c38bdd95c05234a1e (commit)
       via  2425a4d7939bae66a15832bd8a325be4aa26e4bf (commit)
       via  f6cb81d808067e2a1c443038130a558360afe58f (commit)
       via  b5b3803e51adcd6d72e2cb884318cea9aa42ba7d (commit)
       via  ff27faab30e391dad4a61952bd9f1587ff99d0a5 (commit)
       via  d1cfa18fb5ba2ce7803f31e58c5f509519eb6f10 (commit)
       via  5111bbd29c48b9004b35e2514752cf4a941b61c6 (commit)
       via  2df9de1ad9d3da7dcc80ef49ebd45e001269bc73 (commit)
       via  091af1a56e30d47a8d828afc931167f8142507b2 (commit)
       via  e354c4e1dc0b4ce964e9717e9f494a06518ae21f (commit)
       via  ae61ba3985913274b7e3711f7c1da4d023d9ded9 (commit)
       via  c7deb4d727569b24ed60450f0d8498a53255423e (commit)
       via  1a9bd38bcd06c2bcc0fea51b36ded2507ba73b3c (commit)
       via  f037d6004a582839ce69eafe3071bc29b0fb6fcd (commit)
       via  3157aba1ab73fb5b5cd0e2dbb5c031a1336a93db (commit)
       via  64c287329177f68d0da2ce81207f5f3f105dabfe (commit)
       via  cbd12f3666346846dd18e762f7881f4a0b1767ee (commit)
       via  3092115a3d791e551209af2e1945666169a04de7 (commit)
       via  27c4a5d2ebbfd4f68a5e87b459adbbc6eeda7cf8 (commit)
       via  8c4195d13e945d3cf2c8583c9f818bbf4a3b5710 (commit)
       via  390ac7259731cdf469ea739345e64d3a7d248818 (commit)
       via  9533c58c4b0c692975a4b97267222ad002364a29 (commit)
       via  3f81316d6eb8f3c951acd8774da7bc8ad23bdedd (commit)
       via  c5f1a7ef72922178569418b5d5060f8240c1767e (commit)
       via  6f1a685bc7bfe44af998e54b99963dffc8e715e5 (commit)
       via  d7b3c9ecbb4f7c782aacbe4224c9aeb8d0d161b2 (commit)
       via  b20dff1b337ceb1bd5f241bff2ed1233780936df (commit)
       via  032f67142ca0678c31a574314adc53d316960f72 (commit)
       via  817ede0ad440e39f3311cc8a1f55ad5655b97e9a (commit)
       via  165709eaa90768f4d03e76188188e5e5afa4ac2c (commit)
       via  50a6b4966bccf97597d65486bd60561d05a65dff (commit)
       via  b3c3db206b652d19fad5290df7b630335acc5889 (commit)
       via  02dc98a6209b37e8473ee3218b5eb4ff6bc7e44d (commit)
       via  70e735001ef74606d3e86a75cf4fd04173e10974 (commit)
       via  90ab18a605385cb7e7984c4ac83a4f7461f99906 (commit)
       via  3836cfdf3b7de8b0f34fda25e5a1b4ae33e253ea (commit)
       via  6c2b67e0220165c9411c128b2f8f7d1e8856795b (commit)
       via  7f0e4fa27448e8da47cdedfa6f8342f94245ab76 (commit)
       via  ff21434d7a766aba9f937e270016e4e7d9e6ba40 (commit)
       via  40dd9754f21987e1fca43c2cde6b3adc18464f1d (commit)
       via  60194aaeeb94372651c09fb5dc0cb5d3329b921e (commit)
       via  c3bcf1c464f8633b5ce91cb72bafee27ce9b05ce (commit)
       via  7d1733001ce46390908da9e6868f45006409b056 (commit)
       via  214296a4b2a36f3e0bc8a270647da2fc21b8b874 (commit)
       via  7ad6aabd74342df423bc2ba496c9750e14d86e85 (commit)
       via  0ee8ee241dcc7feeaf538a120826051dcd8cccfd (commit)
       via  3caef2b656659161247d9c8d418ba8fcc889a04c (commit)
       via  da12fddea1a71fb3b808e88a5ef83bbca8e2cb30 (commit)
       via  297cccbb83721274c4df1eec08dde9eb9f51a733 (commit)
       via  7f43a566f95a1cf96ed799471319b5c574ee575e (commit)
       via  e0f2167a8e0855ab0a1545da2b5f1472cac923dc (commit)
       via  0db2376071441d14829885eaa95b2b8a69a3a1ae (commit)
       via  22a744906c7e0303d9f56c9160900946eff17206 (commit)
       via  d65e7bd9988748a8d39dba3439cbf3cfc873f724 (commit)
       via  e5e85060ca59a79204d185b1b4cf3e30eb0fd1ba (commit)
       via  50158e6deec5d6304429f655fd0a7990c0c14cfc (commit)
       via  f01a34d4d484fb2a8e69233429e993283ee39235 (commit)
       via  d33df476c193a636fbc205d541dce62a6b327fdb (commit)
       via  5943423dd8fd3c0df0586c8c05631165d84f341d (commit)
       via  b4494ffc89755afd15f3dda0b71b82244aa5ea2f (commit)
       via  095e9826734cc7660ab9f444e72a517736272902 (commit)
       via  a371c4d2c371566a571f9c9d08df72f200024b9c (commit)
       via  2e7a4dfe356485e3d14ec2b73b405f016336fcd2 (commit)
       via  d351e41f278158d1b8219d523b0fa03c02b76189 (commit)
       via  8a4ca176c977982bf74c885ec927ed3d6c677bde (commit)
       via  35ca449e9f1a4cd477df644f717bbe4e3362c486 (commit)
       via  92be0ce57f92882da916064cb10082e1e0bf4da1 (commit)
       via  78d06528148c82511b1e465763a14334762f2003 (commit)
      from  7dfd9ffe486fc3a781a96f432ab183c27427fa13 (commit)

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

- Log -----------------------------------------------------------------
commit b4cea04f7087964540e9d0db6e9657a15e440b98
Merge: ae28faf8149f10bc50cb934cd43322d7a087b288 68ac9fbeb0ff5bc68f44bfd25445a2243ef3dc79
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 26 23:18:29 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

commit ae28faf8149f10bc50cb934cd43322d7a087b288
Merge: 19fc9ea51670fe922d23666bf266d9989dfaf406 3ebbd04cee427232781580ec88e5d1ea854d1012
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 26 23:18:16 2009 +0100

    Merge commit 'origin/archer-keiths-expr-cumulative' into archer
    
    Conflicts:
    	gdb/ChangeLog

commit 19fc9ea51670fe922d23666bf266d9989dfaf406
Merge: f61b37d302f01d90aacd950bc07a28dfc7c65843 f6cb81d808067e2a1c443038130a558360afe58f
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 22:13:41 2009 +0100

    Merge commit 'origin/master' into archer
    
    Conflicts:
    	gdb/configure

commit f61b37d302f01d90aacd950bc07a28dfc7c65843
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Mar 15 18:01:08 2009 +0100

    Fix crash on C++ DW_AT_name "".
    
    Testcase is:
    12fab790f9fd169f857fbffcf66241e913d1f473
    
    Reproducer besides the testcase is:
    xulrunner-debuginfo-1.9.1-0.10.beta3.fc11.x86_64
    gdb /usr/lib/debug/usr/lib64/xulrunner-1.9.1/libxul.so.debug
    <crash>
    
    	* gdb/dwarf2read.c (dwarf2_canonicalize_name): Fix crash on NULL name.

commit 4ee4444d270da286405a6866ef9f5327a4134ccf
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Mar 15 17:54:08 2009 +0100

    New testcase: Exploit a bug in parsing DW_AT_name "".
    
    xulrunner-debuginfo-1.9.1-0.10.beta3.fc11.x86_64 file
    /usr/lib/debug/usr/lib64/xulrunner-1.9.1/libxul.so.debug
    on DIE offset 0x2070330 there is empty DW_AT_name:
     <2><2070330>: Abbrev Number: 24 (DW_TAG_variable)
        <2070331>   DW_AT_name        : (indirect string, offset: 0x1daea5):
        <2070335>   DW_AT_decl_file   : 5
        <2070336>   DW_AT_decl_line   : 1103
        <2070338>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2f0ff2): _ZN9nsGkAtoms7genericE
        <207033c>   DW_AT_type        : <0x206bc9f>
        <2070340>   DW_AT_external    : 1
        <2070341>   DW_AT_declaration : 1
    
    which crashes [expr-cumulative] due to its imported patch:
    b2f7b66e72ecc20a08dbec1e867b16adcf7b4e97
    
    Fedora Rawhide bugreport: https://bugzilla.redhat.com/show_bug.cgi?id=490319
    
    This is only a testcase, the bug does not exist on FSF GDB.
    
    gdb/testsuite/
    	* dw2-strp.S (DW_AT_language): Change to C++.
    	(DW_TAG_variable (name ""), Abbrev code 7, .Lemptyname): New.

commit 2452a5310e0cc74d821e9dd38fe732fd20b49bdd
Merge: b743cd1c3f2b189a94a131da8398f8cfd018b790 35ca449e9f1a4cd477df644f717bbe4e3362c486
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 22:06:14 2009 +0100

    Merge commit 'origin/archer-keiths-expr-cumulative' into archer
    
    Conflicts:
    	gdb/ChangeLog
    	gdb/testsuite/ChangeLog

commit b743cd1c3f2b189a94a131da8398f8cfd018b790
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 22:04:26 2009 +0100

    Patch in archer-keiths-expr-cumulative.

commit 149d3d63479f8e023eefeb4216708d13e48e5d6e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 21:51:15 2009 +0100

    Remove archer-jankratochvil-expr.

commit 2cfda40f4e2ff20e1c33aec7346a696007112c50
Merge: 677f32e1535ac08ee097d4658fc6d5eef6934db2 b5b3803e51adcd6d72e2cb884318cea9aa42ba7d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 21:30:02 2009 +0100

    Merge commit 'origin/archer-jankratochvil-type-refcount' into archer

commit 677f32e1535ac08ee097d4658fc6d5eef6934db2
Merge: 179567294703e9643a0aebb0896a1c7df9ba79d1 95b4138baf512e661d95b09c38bdd95c05234a1e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 21:29:53 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer
    
    Conflicts:
    	gdb/varobj.c

commit 179567294703e9643a0aebb0896a1c7df9ba79d1
Merge: 7dfd9ffe486fc3a781a96f432ab183c27427fa13 2425a4d7939bae66a15832bd8a325be4aa26e4bf
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 21:29:12 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer
    
    Conflicts:
    	gdb/Makefile.in
    	gdb/breakpoint.c
    	gdb/c-lang.c
    	gdb/charset.c
    	gdb/configure
    	gdb/doc/gdb.texinfo
    	gdb/eval.c
    	gdb/f-lang.c
    	gdb/python/python.c
    	gdb/varobj.c

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

Summary of changes:
 bfd/ChangeLog                         |   46 +
 bfd/cpu-i386.c                        |    8 +-
 bfd/elf32-cris.c                      |   37 +-
 bfd/elf32-crx.c                       |   40 +-
 bfd/elf32-ppc.c                       |   31 +-
 bfd/elf64-ppc.c                       |   12 +-
 bfd/version.h                         |    2 +-
 gdb/ChangeLog                         |  547 +++++
 gdb/Makefile.in                       |   17 +-
 gdb/acinclude.m4                      |   27 +-
 gdb/ada-exp.y                         |    1 +
 gdb/ada-lang.c                        |   29 +-
 gdb/breakpoint.c                      |   61 +-
 gdb/buildsym.c                        |   26 +
 gdb/c-lang.c                          |    4 +
 gdb/charset.c                         |   20 +-
 gdb/completer.c                       |   97 +-
 gdb/completer.h                       |    2 +
 gdb/config.in                         |    3 +
 gdb/configure                         |   88 +-
 gdb/configure.ac                      |   44 +-
 gdb/darwin-nat.c                      |    8 +-
 gdb/dbxread.c                         |    4 +-
 gdb/doc/ChangeLog                     |   50 +
 gdb/doc/gdb.texinfo                   |   44 +-
 gdb/doc/gdbint.texinfo                | 1651 +++++++++++----
 gdb/doc/observer.texi                 |    4 +
 gdb/doc/stack_frame.eps               | 3708 +++++++++++++++++++++++++++++++++
 gdb/doc/stack_frame.pdf               |  Bin 0 -> 77972 bytes
 gdb/doc/stack_frame.png               |  Bin 0 -> 67273 bytes
 gdb/doc/stack_frame.svg               |  866 ++++++++
 gdb/doc/stack_frame.txt               |   39 +
 gdb/dwarf2expr.c                      |    2 +-
 gdb/dwarf2read.c                      |   26 +-
 gdb/{mi/mi-main.h => gdb_usleep.c}    |   35 +-
 gdb/{mi/mi-main.h => gdb_usleep.h}    |   24 +-
 gdb/gdbserver/ChangeLog               |   25 +
 gdb/gdbserver/Makefile.in             |   18 +-
 gdb/gdbserver/configure               |    2 +-
 gdb/gdbserver/configure.ac            |    6 +-
 gdb/gdbserver/gdbreplay.c             |    2 +-
 gdb/gdbserver/i387-fp.c               |   40 +-
 gdb/gdbserver/inferiors.c             |    5 +-
 gdb/gdbserver/linux-arm-low.c         |    2 +-
 gdb/gdbserver/linux-cris-low.c        |    4 +-
 gdb/gdbserver/linux-crisv32-low.c     |   44 +-
 gdb/gdbserver/linux-i386-low.c        |    4 +-
 gdb/gdbserver/linux-low.c             |  177 +-
 gdb/gdbserver/linux-mips-low.c        |    2 +-
 gdb/gdbserver/linux-s390-low.c        |    1 -
 gdb/gdbserver/linux-sparc-low.c       |   39 +-
 gdb/gdbserver/linux-x86-64-low.c      |   10 +-
 gdb/gdbserver/linux-xtensa-low.c      |    2 +-
 gdb/gdbserver/proc-service.c          |    2 -
 gdb/gdbserver/regcache.c              |    5 +-
 gdb/gdbserver/remote-utils.c          |   48 +-
 gdb/gdbserver/server.c                |   56 +-
 gdb/gdbserver/spu-low.c               |    8 +-
 gdb/gdbserver/target.h                |    8 +-
 gdb/gdbserver/thread-db.c             |    2 +-
 gdb/gdbserver/win32-low.c             |   82 +-
 gdb/gdbserver/xtensa-xtregs.c         |    1 -
 gdb/gdbthread.h                       |    4 +
 gdb/infcall.c                         |   26 +-
 gdb/infcmd.c                          |   27 +-
 gdb/inferior.h                        |   12 -
 gdb/infrun.c                          |   34 +-
 gdb/linux-nat.c                       |    2 +-
 gdb/mi/mi-interp.c                    |   32 +-
 gdb/mi/mi-main.c                      |    5 +
 gdb/mi/mi-main.h                      |    1 +
 gdb/mn10300-tdep.c                    | 1270 +++++++-----
 gdb/python/python-cmd.c               |    2 +-
 gdb/ser-unix.c                        |    9 +-
 gdb/stabsread.c                       |   15 +-
 gdb/symfile.c                         |    9 +-
 gdb/symtab.c                          |   94 +-
 gdb/testsuite/ChangeLog               |   50 +
 gdb/testsuite/gdb.base/auxv.exp       |   12 +-
 gdb/testsuite/gdb.base/callfuncs.exp  |   12 +-
 gdb/testsuite/gdb.base/charset.exp    |   12 +
 gdb/testsuite/gdb.base/completion.exp |   30 +
 gdb/thread.c                          |    6 +-
 gdb/top.c                             |    1 +
 gdb/value.c                           |    1 +
 gdb/varobj.c                          |    2 +-
 gdb/version.in                        |    2 +-
 gdb/windows-nat.c                     |  350 ++--
 include/elf/ChangeLog                 |    4 +
 include/elf/common.h                  |    1 +
 libiberty/ChangeLog                   |    8 +
 libiberty/cp-demangle.c               |   24 +-
 libiberty/testsuite/demangle-expected |   10 +-
 93 files changed, 8519 insertions(+), 1746 deletions(-)
 create mode 100644 gdb/doc/stack_frame.eps
 create mode 100644 gdb/doc/stack_frame.pdf
 create mode 100644 gdb/doc/stack_frame.png
 create mode 100644 gdb/doc/stack_frame.svg
 create mode 100644 gdb/doc/stack_frame.txt
 copy gdb/{mi/mi-main.h => gdb_usleep.c} (58%)
 copy gdb/{mi/mi-main.h => gdb_usleep.h} (58%)

First 500 lines of diff:
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9342ddc..3103cfe 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,49 @@
+2009-03-25  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+
+	* elf32-crx.c (crx_elf_howto_table): Zero the src_mask field of
+	the reloc descriptions.
+
+2009-03-25  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GD>
+	<R_CRIS_16_GOT_GD, case R_CRIS_32_GOT_GD>: Handle COMMON symbols.
+	<case R_CRIS_16_TPREL, R_CRIS_32_TPREL>: Ditto.
+
+2009-03-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* cpu-i386.c (bfd_x86_64_arch_intel_syntax): Make it static.
+	(bfd_i386_arch_intel_syntax): Likewise.
+	(i8086_arch): Likewise.
+	(bfd_x86_64_arch): Likewise.
+
+2009-03-24  Hans-Peter Nilsson  <hp@axis.com>
+
+	* elf32-cris.c (cris_elf_relocate_section): <case
+	R_CRIS_16_DTPREL, R_CRIS_32_DTPREL>: Allow use of non-local
+	symbols for non-allocated sections.  Don't check whether to
+	generate R_CRIS_DTPMOD for non-allocated sections.
+	(cris_elf_gc_sweep_hook) <case R_CRIS_32_DTPREL>: Don't
+	handle relocation GC:ing if applied to non-allocated section.
+	(cris_elf_check_relocs): Similar.
+
+	* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GD>
+	<R_CRIS_16_GOT_GD, R_CRIS_32_GOT_GD>: Don't include the TLS size
+	when emitting a known TP offset in the GOT.
+
+2009-03-23  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (synthetic_opd): Delete.
+	(compare_symbols): Look for .opd name rather than section match.
+	(ppc64_elf_get_synthetic_symtab): Likewise.
+
+2009-03-21  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-ppc.c (is_pic_glink_stub): Delete.
+	(is_nonpic_glink_stub): New function.
+	(ppc_elf_get_synthetic_symtab): Check for last non-pic stub rather
+	than first pic one.
+	(struct ppc_elf_link_hash_table <glink_pltresolve>): Comment fix.
+
 2009-03-20  Martin Schwidefsky  <schwidefsky@de.ibm.com>
 	    Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c
index 4001a05..952e659 100644
--- a/bfd/cpu-i386.c
+++ b/bfd/cpu-i386.c
@@ -23,7 +23,7 @@
 #include "bfd.h"
 #include "libbfd.h"
 
-const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
+static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
 {
   64, /* 64 bits in a word */
   64, /* 64 bits in an address */
@@ -39,7 +39,7 @@ const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
   0
 };
 
-const bfd_arch_info_type bfd_i386_arch_intel_syntax =
+static const bfd_arch_info_type bfd_i386_arch_intel_syntax =
 {
   32,	/* 32 bits in a word */
   32,	/* 32 bits in an address */
@@ -55,7 +55,7 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
   &bfd_x86_64_arch_intel_syntax
 };
 
-const bfd_arch_info_type i8086_arch =
+static const bfd_arch_info_type i8086_arch =
 {
   32,	/* 32 bits in a word */
   32,	/* 32 bits in an address (well, not really) */
@@ -71,7 +71,7 @@ const bfd_arch_info_type i8086_arch =
   &bfd_i386_arch_intel_syntax
 };
 
-const bfd_arch_info_type bfd_x86_64_arch =
+static const bfd_arch_info_type bfd_x86_64_arch =
 {
   64, /* 32 bits in a word */
   64, /* 32 bits in an address */
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index bd6de29..2037b10 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1615,10 +1615,12 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	case R_CRIS_16_DTPREL:
 	case R_CRIS_32_DTPREL:
 	  /* This relocation must only be performed against local
-	     symbols.  It's also ok when we link a program and the
-	     symbol is defined in an ordinary (non-DSO) object (if
-	     it's undefined there, we've already seen an error).  */
+	     symbols, or to sections that are not loadable.  It's also
+	     ok when we link a program and the symbol is defined in an
+	     ordinary (non-DSO) object (if it's undefined there, we've
+	     already seen an error).  */
 	  if (h != NULL
+	      && (input_section->flags & SEC_ALLOC) != 0
 	      && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 	      && (info->shared
 		  || (!h->def_regular
@@ -1641,14 +1643,16 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	      return FALSE;
 	    }
 
-	  BFD_ASSERT (elf_cris_hash_table (info)->dtpmod_refcount != 0);
+	  BFD_ASSERT ((input_section->flags & SEC_ALLOC) == 0
+		      || elf_cris_hash_table (info)->dtpmod_refcount != 0);
 
 	  /* Fill in a R_CRIS_DTPMOD reloc at offset 3 if we haven't
 	     already done so.  Note that we do this in .got.plt, not
 	     in .got, as .got.plt contains the first part, still the
 	     reloc is against .got, because the linker script directs
 	     (is required to direct) them both into .got.  */
-	  if (elf_cris_hash_table (info)->dtpmod_refcount > 0)
+	  if (elf_cris_hash_table (info)->dtpmod_refcount > 0
+	      && (input_section->flags & SEC_ALLOC) != 0)
 	    {
 	      asection *sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
 	      BFD_ASSERT (sgotplt != NULL);
@@ -1729,15 +1733,15 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	      return FALSE;
 	    }
 
-	  if (!info->shared && (h == NULL || h->def_regular))
+	  if (!info->shared
+	      && (h == NULL || h->def_regular || ELF_COMMON_DEF_P (h)))
 	    {
 	      /* Known contents of the GOT.  */
 	      bfd_vma off;
 
 	      /* The symbol is defined in the program, so just write
-		 (1, -prog_tls_size+known_tpoffset) into the GOT.  */
+		 (1, known_tpoffset) into the GOT.  */
 	      relocation -= elf_hash_table (info)->tls_sec->vma;
-	      relocation -= elf_hash_table (info)->tls_size;
 
 	      if (h != NULL)
 		{
@@ -1997,7 +2001,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
 	  if (h != NULL
 	      && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
-	      && !h->def_regular
+	      && !(h->def_regular || ELF_COMMON_DEF_P (h))
 	      /* If it's undefined, then an error message has already
 		 been emitted.  */
 	      && h->root.type != bfd_link_hash_undefined)
@@ -2685,6 +2689,10 @@ cris_elf_gc_sweep_hook (bfd *abfd,
 	  break;
 
 	case R_CRIS_32_DTPREL:
+	  /* This'd be a .dtpreld entry in e.g. debug info.  */
+	  if ((sec->flags & SEC_ALLOC) == 0)
+	    break;
+	  /* Fall through.  */
 	case R_CRIS_16_DTPREL:
 	  elf_cris_hash_table (info)->dtpmod_refcount--;
 	  if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
@@ -3152,8 +3160,17 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
 	 on the first input bfd we found that contained dynamic relocs.  */
       switch (r_type)
 	{
-	case R_CRIS_16_DTPREL:
 	case R_CRIS_32_DTPREL:
+	  if ((sec->flags & SEC_ALLOC) == 0)
+	    /* This'd be a .dtpreld entry in e.g. debug info.  We have
+	       several different switch statements below, but none of
+	       that is needed; we need no preparations for resolving
+	       R_CRIS_32_DTPREL into a non-allocated section (debug
+	       info), so let's just move on to the next
+	       relocation.  */
+	    continue;
+	  /* Fall through.  */
+	case R_CRIS_16_DTPREL:
 	  /* The first .got.plt entry is right after the R_CRIS_DTPMOD
 	     entry at index 3. */
 	  if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c
index b0db783..54eea93 100644
--- a/bfd/elf32-crx.c
+++ b/bfd/elf32-crx.c
@@ -104,7 +104,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REL4",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xf,			/* src_mask */
+	 0x0,			/* src_mask */
 	 0xf,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -118,7 +118,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REL8",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xff,			/* src_mask */
+	 0x0,			/* src_mask */
 	 0xff,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -132,7 +132,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REL8_CMP",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xff,			/* src_mask */
+	 0x0,			/* src_mask */
 	 0xff,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -146,7 +146,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REL16",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -160,7 +160,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REL24",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -174,7 +174,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REL32",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -188,7 +188,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REGREL12",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xfff,			/* src_mask */
+	 0x0,			/* src_mask */
 	 0xfff,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -202,7 +202,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REGREL22",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0x3fffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0x3fffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -216,7 +216,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REGREL28",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xfffffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xfffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -230,7 +230,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_REGREL32",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -244,7 +244,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_ABS16",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -258,7 +258,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_ABS32",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -272,7 +272,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_NUM8",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xff,	  		/* src_mask */
+	 0x0,	  		/* src_mask */
 	 0xff,			/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -286,7 +286,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_NUM16",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffff,  		/* src_mask */
+	 0x0,	  		/* src_mask */
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -300,7 +300,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_NUM32",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffffff,  		/* src_mask */
+	 0x0,	  		/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -314,7 +314,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_IMM16",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffff,  		/* src_mask */
+	 0x0, 	 		/* src_mask */
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -328,7 +328,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_IMM32",		/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffffff,  		/* src_mask */
+	 0x0,  			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
  
@@ -345,7 +345,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_SWITCH8",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xff,			/* src_mask */
+	 0x0,			/* src_mask */
 	 0xff,			/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
@@ -362,7 +362,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_SWITCH16",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffff,		/* dst_mask */
 	 TRUE),			/* pcrel_offset */
 
@@ -379,7 +379,7 @@ static reloc_howto_type crx_elf_howto_table[] =
 	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_CRX_SWITCH32",	/* name */
 	 FALSE,			/* partial_inplace */
-	 0xffffffff,		/* src_mask */
+	 0x0,			/* src_mask */
 	 0xffffffff,		/* dst_mask */
 	 TRUE)			/* pcrel_offset */
 };
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 5db64b0..e15f88e 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -2328,26 +2328,17 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
 }
 \f
 static bfd_boolean
-is_pic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
+is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off)
 {
-  bfd_byte buf[16];
-  unsigned int insn;
+  bfd_byte buf[GLINK_ENTRY_SIZE];
 
-  if (!bfd_get_section_contents (abfd, glink, buf, off, 16))
+  if (!bfd_get_section_contents (abfd, glink, buf, off, GLINK_ENTRY_SIZE))
     return FALSE;
 
-  insn = bfd_get_32 (abfd, buf);
-  if ((insn & 0xffff0000) == LWZ_11_30
-      && bfd_get_32 (abfd, buf + 4) == MTCTR_11
-      && bfd_get_32 (abfd, buf + 8) == BCTR)
-    return TRUE;
-
-  if ((insn & 0xffff0000) == ADDIS_11_30
-      && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
-      && bfd_get_32 (abfd, buf + 8) == MTCTR_11
-      && bfd_get_32 (abfd, buf + 12) == BCTR)
-    return TRUE;
-  return FALSE;
+  return ((bfd_get_32 (abfd, buf + 0) & 0xffff0000) == LIS_11
+	  && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11
+	  && bfd_get_32 (abfd, buf + 8) == MTCTR_11
+	  && bfd_get_32 (abfd, buf + 12) == BCTR);
 }
 
 static bfd_boolean
@@ -2484,10 +2475,8 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
      multiple stubs for each plt entry.  If that is the case then
      there is no way to associate stubs with their plt entries short
      of figuring out the GOT pointer value used in the stub.  */
-  if (!bfd_get_section_contents (abfd, glink, buf,
-				 stub_vma - glink->vma, 4)
-      || ((bfd_get_32 (abfd, buf) & 0xffff0000) != LIS_11
-	  && is_pic_glink_stub (abfd, glink, stub_vma - glink->vma - 16)))
+  if (!is_nonpic_glink_stub (abfd, glink,
+			     glink_vma - GLINK_ENTRY_SIZE - glink->vma))
     return 0;
 
   slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
@@ -2722,7 +2711,7 @@ struct ppc_elf_link_hash_table
     bfd_vma offset;
   } tlsld_got;
 
-  /* Offset of PltResolve function in glink.  */
+  /* Offset of branch table to PltResolve function in glink.  */
   bfd_vma glink_pltresolve;
 
   /* Size of reserved GOT entries.  */
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 1873728..ce82e16 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2689,7 +2689,6 @@ get_opd_info (asection * sec)
 }
 \f
 /* Parameters for the qsort hook.  */
-static asection *synthetic_opd;
 static bfd_boolean synthetic_relocatable;
 
 /* qsort comparison function for ppc64_elf_get_synthetic_symtab.  */
@@ -2707,9 +2706,11 @@ compare_symbols (const void *ap, const void *bp)
     return 1;
 
   /* then .opd symbols.  */
-  if (a->section == synthetic_opd && b->section != synthetic_opd)
+  if (strcmp (a->section->name, ".opd") == 0
+      && strcmp (b->section->name, ".opd") != 0)
     return -1;
-  if (a->section != synthetic_opd && b->section == synthetic_opd)
+  if (strcmp (a->section->name, ".opd") != 0
+      && strcmp (b->section->name, ".opd") == 0)
     return 1;
 
   /* then other code symbols.  */
@@ -2863,7 +2864,6 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
   else
     memcpy (syms, static_syms, (symcount + 1) * sizeof (*syms));
 
-  synthetic_opd = opd;
   synthetic_relocatable = relocatable;
   qsort (syms, symcount, sizeof (*syms), compare_symbols);
 
@@ -2881,7 +2881,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
     }
 
   i = 0;
-  if (syms[i]->section == opd)
+  if (strcmp (syms[i]->section->name, ".opd") == 0)
     ++i;
   codesecsym = i;
 
@@ -2898,7 +2898,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
   secsymend = i;
 
   for (; i < symcount; ++i)
-    if (syms[i]->section != opd)
+    if (strcmp (syms[i]->section->name, ".opd") != 0)
       break;
   opdsymend = i;
 
diff --git a/bfd/version.h b/bfd/version.h
index 2738637..620b6c5 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20090320
+#define BFD_VERSION_DATE 20090325
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 107396e..c3e0482 100644
--- a/gdb/ChangeLog


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-30 19:06 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-30 19:06 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  bd2f6c97be2fa9058d941a16a047d10abbab2b87 (commit)
       via  250924957fe147f3d74543f4d731e0e7dcb1eeea (commit)
      from  1ffc3d262e82dca2cda7161d077daf504c83049d (commit)

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

- Log -----------------------------------------------------------------
commit bd2f6c97be2fa9058d941a16a047d10abbab2b87
Merge: 1ffc3d262e82dca2cda7161d077daf504c83049d 250924957fe147f3d74543f4d731e0e7dcb1eeea
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Mar 30 21:05:10 2009 +0200

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/doc/gdb.texinfo |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 63844a2..53e0d25 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18675,7 +18675,6 @@ will be used, if the current language is able to supply one.
 The optional @var{errors} argument is the same as the corresponding
 argument to Python's @code{string.decode} method.
 @end defmethod
-@end table
 
 @defmethod Value type
 Return the type of this @code{gdb.Value}.  The result is a


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-29 22:42 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-29 22:42 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  0bd30605d0f86a62c7dfa2f127b242bcbbe0e818 (commit)
       via  a99d5b6c1c3f8667b833b186eefe5f94dc1f6c22 (commit)
       via  7946cfed05838e9cd6475fca65f9a48662929959 (commit)
       via  51431bcab78f52fd56bd639e9572a1f075282c3d (commit)
       via  74b9d22a011e9f8c6b286647ee0a751063f9ed9f (commit)
       via  1948198702b51b31d79793fc49434b529b4e245f (commit)
       via  4d8ab8c4efc5939b06dee212d3883cf3b8c2c153 (commit)
      from  446b0b4faf66026411834eda53dfa76947ce00b7 (commit)

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

- Log -----------------------------------------------------------------
commit 0bd30605d0f86a62c7dfa2f127b242bcbbe0e818
Merge: 446b0b4faf66026411834eda53dfa76947ce00b7 a99d5b6c1c3f8667b833b186eefe5f94dc1f6c22
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Mar 30 00:42:00 2009 +0200

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/doc/gdb.texinfo                            |   18 +++++-----
 gdb/python/lib/gdb/command/backtrace.py        |    2 +-
 gdb/python/lib/gdb/libstdcxx/v6/printers.py    |    4 +-
 gdb/python/python-frame.c                      |   21 +++++++-----
 gdb/python/python-value.c                      |   41 +++++++++++++++++------
 gdb/python/python.c                            |   20 -----------
 gdb/testsuite/gdb.ada/lang_switch.exp          |    2 +
 gdb/testsuite/gdb.ada/ref_param.exp            |    2 +
 gdb/testsuite/gdb.base/call-ar-st.exp          |    1 +
 gdb/testsuite/gdb.base/funcargs.exp            |    2 +
 gdb/testsuite/gdb.python/find.exp              |   10 +++---
 gdb/testsuite/gdb.python/python-frame.exp      |    2 +-
 gdb/testsuite/gdb.python/python-prettyprint.py |    4 +-
 gdb/testsuite/gdb.python/python-value.exp      |    6 +++
 14 files changed, 75 insertions(+), 60 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 083546b..c711d3d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18602,9 +18602,15 @@ bar = some_val['foo']
 
 Again, @code{bar} will also be a @code{gdb.Value} object.
 
-The following attribute is provided:
+The following attributes are provided:
 
 @table @code
+@defmethod Value address
+If this object is addressable, this read-only attribute holds a
+@code{gdb.Value} object representing the address.  Otherwise,
+this attribute holds @code{None}.
+@end defmethod
+
 @cindex optimized out value in Python
 @defmethod Value is_optimized_out
 This read-only boolean attribute is true if the compiler optimized out
@@ -18615,12 +18621,6 @@ this value, thus it is not available for fetching from the inferior.
 The following methods are provided:
 
 @table @code
-@defmethod Value address
-If the @code{gdb.Value} object is addressable, this will return a new
-@code{gdb.Value} object representing the address.  Otherwise, this
-will throw an exception.
-@end defmethod
-
 @defmethod Value cast type
 Cast the @code{gdb.Value} to the type represented by @var{type}, and
 return a new @code{gdb.Value}.  @var{type} must be a @code{gdb.Type}
@@ -19760,8 +19760,8 @@ Returns the frame's resume address.
 Returns the frame's code block. @c (@pxref{Block,,Code Blocks and Scopes}).
 @end defmethod
 
-@defmethod Frame address_in_block
-Returns an address which falls within the frame's code block.
+@defmethod Frame function
+Returns the symbol for the function corresponding to this frame. @c (@pxref{Symbols In Python}).
 @end defmethod
 
 @defmethod Frame older
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index f07696e..17b1c18 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -92,7 +92,7 @@ class FrameWrapper:
                 stream.write (" 0x%08x in" % pc)
             stream.write (" " + name + " (")
 
-            func = gdb.find_pc_function (self.frame.addr_in_block ())
+            func = self.frame.function ()
             self.print_frame_args (stream, func)
 
             stream.write (")")
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index bcc5b28..58e7fa7 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -49,7 +49,7 @@ class StdListPrinter:
         def __init__(self, nodetype, head):
             self.nodetype = nodetype
             self.base = head['_M_next']
-            self.head = head.address()
+            self.head = head.address
             self.count = 0
 
         def __iter__(self):
@@ -73,7 +73,7 @@ class StdListPrinter:
         return self._iterator(nodetype, self.val['_M_impl']['_M_node'])
 
     def to_string(self):
-        if self.val['_M_impl']['_M_node'].address() == self.val['_M_impl']['_M_node']['_M_next']:
+        if self.val['_M_impl']['_M_node'].address == self.val['_M_impl']['_M_node']['_M_next']:
             return 'empty std::list'
         return 'std::list'
 
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 1fc553b..4b76709 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -253,13 +253,13 @@ frapy_block (PyObject *self, PyObject *args)
 }
 
 
-/* Implementation of gdb.Frame.addr_in_block (self) -> Long.
-   Returns an address which falls within the frame's code block.  */
+/* Implementation of gdb.Frame.function (self) -> gdb.Symbol.
+   Returns the symbol for the function corresponding to this frame.  */
 
 static PyObject *
-frapy_addr_in_block (PyObject *self, PyObject *args)
+frapy_function (PyObject *self, PyObject *args)
 {
-  CORE_ADDR pc = 0;	      /* Initialize to appease gcc warning.  */
+  struct symbol *sym = NULL;
   struct frame_info *frame;
   volatile struct gdb_exception except;
 
@@ -267,11 +267,14 @@ frapy_addr_in_block (PyObject *self, PyObject *args)
     {
       FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
 
-      pc = get_frame_address_in_block (frame);
+      sym = find_pc_function (get_frame_address_in_block (frame));
     }
   GDB_PY_HANDLE_EXCEPTION (except);
 
-  return PyLong_FromUnsignedLongLong (pc);
+  if (sym)
+    return symbol_to_symbol_object (sym);
+
+  Py_RETURN_NONE;
 }
 
 /* Convert a frame_info struct to a Python Frame object.
@@ -634,9 +637,9 @@ Return the frame's resume address." },
   { "block", frapy_block, METH_NOARGS,
     "block () -> gdb.Block.\n\
 Return the frame's code block." },
-  { "addr_in_block", frapy_addr_in_block, METH_NOARGS,
-    "addr_in_block () -> Long.\n\
-Return an address which falls within the frame's code block." },
+  { "function", frapy_function, METH_NOARGS,
+    "function () -> gdb.Symbol.\n\
+Returns the symbol for the function corresponding to this frame." },
   { "older", frapy_older, METH_NOARGS,
     "older () -> gdb.Frame.\n\
 Return the frame immediately older (outer) to this frame." },
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 5d4f596..b55463c 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -62,7 +62,7 @@ struct value *values_in_python = NULL;
 typedef struct {
   PyObject_HEAD
   struct value *value;
-  int owned_by_gdb;
+  PyObject *address;
 } value_object;
 
 /* Called by the Python interpreter when deallocating a value object.  */
@@ -73,8 +73,14 @@ valpy_dealloc (PyObject *obj)
 
   value_remove_from_list (&values_in_python, self->value);
 
-  if (!self->owned_by_gdb)
-    value_free (self->value);
+  value_free (self->value);
+
+  if (self->address)
+    /* Use braces to appease gcc warning.  *sigh*  */
+    {
+      Py_DECREF (self->address);
+    }
+
   self->ob_type->tp_free (self);
 }
 
@@ -108,7 +114,7 @@ valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords)
     }
 
   value_obj->value = value;
-  value_obj->owned_by_gdb = 0;
+  value_obj->address = NULL;
   release_value (value);
   value_prepend_to_list (&values_in_python, value);
 
@@ -133,18 +139,30 @@ valpy_dereference (PyObject *self, PyObject *args)
 
 /* Return "&value".  */
 static PyObject *
-valpy_address (PyObject *self, PyObject *args)
+valpy_get_address (PyObject *self, void *closure)
 {
   struct value *res_val = NULL;	  /* Initialize to appease gcc warning.  */
+  value_object *val_obj = (value_object *) self;
   volatile struct gdb_exception except;
 
-  TRY_CATCH (except, RETURN_MASK_ALL)
+  if (!val_obj->address)
     {
-      res_val = value_addr (((value_object *) self)->value);
+      TRY_CATCH (except, RETURN_MASK_ALL)
+	{
+	  res_val = value_addr (val_obj->value);
+	}
+      if (except.reason < 0)
+	{
+	  val_obj->address = Py_None;
+	  Py_INCREF (Py_None);
+	}
+      else
+	val_obj->address = value_to_value_object (res_val);
     }
-  GDB_PY_HANDLE_EXCEPTION (except);
 
-  return value_to_value_object (res_val);
+  Py_INCREF (val_obj->address);
+
+  return val_obj->address;
 }
 
 /* Return type of the value.  */
@@ -765,7 +783,7 @@ value_to_value_object (struct value *val)
   if (val_obj != NULL)
     {
       val_obj->value = val;
-      val_obj->owned_by_gdb = 0;
+      val_obj->address = NULL;
       release_value (val);
       value_prepend_to_list (&values_in_python, val);
     }
@@ -926,6 +944,8 @@ gdbpy_initialize_values (void)
 \f
 
 static PyGetSetDef value_object_getset[] = {
+  { "address", valpy_get_address, NULL, "The address of the value.",
+    NULL },
   { "is_optimized_out", valpy_get_is_optimized_out, NULL,
     "Boolean telling whether the value is optimized out (i.e., not available).",
     NULL },
@@ -933,7 +953,6 @@ static PyGetSetDef value_object_getset[] = {
 };
 
 static PyMethodDef value_object_methods[] = {
-  { "address", valpy_address, METH_NOARGS, "Return the address of the value." },
   { "cast", valpy_cast, METH_VARARGS, "Cast the value to the supplied type." },
   { "dereference", valpy_dereference, METH_NOARGS, "Dereferences the value." },
   { "type", valpy_type, METH_NOARGS, "Return type of the value." },
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 0bc25b1..f5c20d4 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -313,23 +313,6 @@ gdbpy_solib_address (PyObject *self, PyObject *args)
   return str_obj;
 }
 
-static PyObject *
-gdbpy_find_pc_function (PyObject *self, PyObject *args)
-{
-  unsigned long long pc;
-  struct symbol *sym;
-  PyObject *sym_obj;
-
-  if (!PyArg_ParseTuple (args, "K", &pc))
-    return NULL;
-
-  sym = find_pc_function (pc);
-  if (sym)
-    return symbol_to_symbol_object (sym);
-
-  Py_RETURN_NONE;
-}
-
 /* Adds GDB value V to the pattern buffer in *PATTERN_BUF.  If SIZE is not zero,
    it specifies the number of bytes from V to copy to *PATTERN_BUF.  The
    function increases the size of *PATTERN_BUF as necessary, adjusting
@@ -1907,9 +1890,6 @@ a boolean indicating if name is a field of the current implied argument\n\
     "solib_address (Long) -> String.\n\
 Return the name of the shared library holding a given address, or None." },
 
-  { "find_pc_function", gdbpy_find_pc_function, METH_VARARGS,
-    "Return the function containing the given pc value, or None." },
-
   { "block_for_pc", gdbpy_block_for_pc, METH_VARARGS,
     "Return the block containing the given pc value, or None." },
 
diff --git a/gdb/testsuite/gdb.ada/lang_switch.exp b/gdb/testsuite/gdb.ada/lang_switch.exp
index 45a4e53..3fc3584 100644
--- a/gdb/testsuite/gdb.ada/lang_switch.exp
+++ b/gdb/testsuite/gdb.ada/lang_switch.exp
@@ -41,6 +41,8 @@ gdb_load ${binfile}
 set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.c]
 runto "foo.c:$bp_location"
 
+gdb_test "set print frame-arguments all" ""
+
 # Make sure that the language is switched to Ada for the second frame
 # by checking the string parameter.
 gdb_test "bt" \
diff --git a/gdb/testsuite/gdb.ada/ref_param.exp b/gdb/testsuite/gdb.ada/ref_param.exp
index 5325dd2..4d49296 100644
--- a/gdb/testsuite/gdb.ada/ref_param.exp
+++ b/gdb/testsuite/gdb.ada/ref_param.exp
@@ -39,6 +39,8 @@ if ![runto call_me] then {
   return
 } 
 
+gdb_test "set print frame-arguments all" ""
+
 set expected_d "\\(one => 1, two => 2, three => 3, four => 4, five => 5, six => 6\\)"
 gdb_test "frame" \
          "#0\[ \t\]*pck\\.call_me \\(d=${expected_d}\\).*"  \
diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp
index b88ff02..a058f67 100644
--- a/gdb/testsuite/gdb.base/call-ar-st.exp
+++ b/gdb/testsuite/gdb.base/call-ar-st.exp
@@ -332,6 +332,7 @@ gdb_expect {
 gdb_test "break sum_array_print" \
 	".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \
 	"set breakpoint in sum_array_print"
+gdb_test "set print frame-arguments all" ""
 gdb_test "continue" \
 	".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:1105\[ \t\n\r\]+1105.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
 	"check args of sum_array_print"
diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp
index 1cf3e9d..037f0a0 100644
--- a/gdb/testsuite/gdb.base/funcargs.exp
+++ b/gdb/testsuite/gdb.base/funcargs.exp
@@ -1194,6 +1194,8 @@ gdb_expect {
 
 # Perform tests
 
+gdb_test "set print frame-arguments all" ""
+
 integral_args
 funcargs_reload
 unsigned_integral_args
diff --git a/gdb/testsuite/gdb.python/find.exp b/gdb/testsuite/gdb.python/find.exp
index dd9aabc..d63ea84 100644
--- a/gdb/testsuite/gdb.python/find.exp
+++ b/gdb/testsuite/gdb.python/find.exp
@@ -91,7 +91,7 @@ set two_patterns_found "${newline}.${dec_number}L, ${dec_number}L]"
 
 gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 
 gdb_test "py print gdb.search_memory (start_addr, length, 'aaa')" \
@@ -129,7 +129,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, \['a', 'a'\], max_coun
 
 gdb_test "set int16_search_buf\[10\] = 0x1234" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int16_t) 0x1234')" "" ""
 
@@ -143,7 +143,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 
 gdb_test "set int32_search_buf\[10\] = 0x12345678" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int32_t) 0x12345678')" "" ""
 
@@ -156,7 +156,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 
 gdb_test "set int64_search_buf\[10\] = 0xfedcba9876543210LL" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')" "" ""
-gdb_test "py start_addr = search_buf.address ()" "" ""
+gdb_test "py start_addr = search_buf.address" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int64_t) 0xfedcba9876543210LL')" "" ""
 
@@ -171,7 +171,7 @@ gdb_test "set *(int8_t*) &search_buf\[10\] = 0x62" "" ""
 gdb_test "set *(int16_t*) &search_buf\[11\] = 0x6363" "" ""
 gdb_test "set *(int32_t*) &search_buf\[13\] = 0x64646464" "" ""
 gdb_test "py search_buf = gdb.selected_frame ().read_var ('search_buf')" "" ""
-gdb_test "py start_addr = search_buf\[0\].address ()" "" ""
+gdb_test "py start_addr = search_buf\[0\].address" "" ""
 gdb_test "py pattern1 = gdb.parse_and_eval ('(int8_t) 0x62')" "" ""
 gdb_test "py pattern2 = gdb.parse_and_eval ('(int16_t) 0x6363')" "" ""
 gdb_test "py pattern3 = gdb.parse_and_eval ('(int32_t) 0x64646464')" "" ""
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index 674c25e..93a3d21 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -78,7 +78,7 @@ gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "te
 gdb_test "python print 'result =', f0.unwind_stop_reason () == gdb.FRAME_UNWIND_NO_REASON" " = True" "test Frame.type"
 gdb_test "python print 'result =', gdb.frame_stop_reason_string (gdb.FRAME_UNWIND_INNER_ID)" " = previous frame inner to this frame \\(corrupt stack\\?\\)" "test gdb.frame_stop_reason_string"
 gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc"
-gdb_test "python print 'result =', f0.addr_in_block ()" " = \[0-9\]+" "test Frame.addr_in_block"
+gdb_test "python print 'result =', f0.function ()" " = symbol for f2" "test Frame.function"
 gdb_test "python print 'result =', f0.older ().equals (f1)" " = True" "test Frame.older"
 gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer"
 gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.py b/gdb/testsuite/gdb.python/python-prettyprint.py
index 0d9cb87..e032303 100644
--- a/gdb/testsuite/gdb.python/python-prettyprint.py
+++ b/gdb/testsuite/gdb.python/python-prettyprint.py
@@ -60,8 +60,8 @@ class pp_s:
     def to_string(self):
         a = self.val["a"]
         b = self.val["b"]
-        if a.address() != b:
-            raise Exception("&a(%s) != b(%s)" % (str(a.address()), str(b)))
+        if a.address != b:
+            raise Exception("&a(%s) != b(%s)" % (str(a.address), str(b)))
         return " a=<" + str(self.val["a"]) + "> b=<" + str(self.val["b"]) + ">"
 
 class pp_ss:
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp
index bd54b2f..6825f03 100644
--- a/gdb/testsuite/gdb.python/python-value.exp
+++ b/gdb/testsuite/gdb.python/python-value.exp
@@ -70,6 +70,9 @@ proc test_value_creation {} {
   gdb_py_test_silent_cmd "python a = gdb.Value (u'unicode test')" "create unicode value" 1
   gdb_test "python print a" "\"unicode test\"" "print Unicode string"
   gdb_test "python print a.__class__" "<type 'gdb.Value'>" "verify type of unicode string"
+
+  # Test address attribute is None in a non-addressable value
+  gdb_test "python print 'result =', i.address" "= None" "Test address attribute in non-addressable value"
 }
 
 proc test_value_numeric_ops {} {
@@ -228,6 +231,9 @@ proc test_value_in_inferior {} {
 
   # Smoke-test is_optimized_out attribute
   gdb_test "python print 'result =', arg0.is_optimized_out" "= False" "Test is_optimized_out attribute"
+
+  # Test address attribute
+  gdb_test "python print 'result =', arg0.address" "= 0x\[\[:xdigit:\]\]+" "Test address attribute"
 }
 
 proc test_value_after_death {} {


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-25 19:00 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-25 19:00 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  7dfd9ffe486fc3a781a96f432ab183c27427fa13 (commit)
       via  2e4985cad1fc3d054eaceac9aef5fed7dfa2fd37 (commit)
       via  ffcb73fcb226abe0bb6d6f6855f479f0c5456527 (commit)
      from  3866a85264a0f35029b5c8a49b7c0b94d3730226 (commit)

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

- Log -----------------------------------------------------------------
commit 7dfd9ffe486fc3a781a96f432ab183c27427fa13
Merge: 3866a85264a0f35029b5c8a49b7c0b94d3730226 2e4985cad1fc3d054eaceac9aef5fed7dfa2fd37
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 25 20:00:07 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/stack.c    |   53 ++++++++---------------------------------------------
 gdb/valprint.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 45 deletions(-)

First 500 lines of diff:
diff --git a/gdb/stack.c b/gdb/stack.c
index 20f41ba..37a8c85 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -58,7 +58,7 @@ void (*deprecated_selected_frame_level_changed_hook) (int);
 
 static const char *print_frame_arguments_choices[] =
   {"all", "scalars", "none", NULL};
-static const char *print_frame_arguments = "all";
+static const char *print_frame_arguments = "scalars";
 
 /* Prototypes for local functions. */
 
@@ -158,46 +158,6 @@ print_frame_nameless_args (struct frame_info *frame, long start, int num,
     }
 }
 
-/* Return non-zero if the debugger should print the value of the provided
-   symbol parameter (SYM).  */
-
-static int
-print_this_frame_argument_p (struct symbol *sym)
-{
-  struct type *type;
-  
-  /* If the user asked to print no argument at all, then obviously
-     do not print this argument.  */
-
-  if (strcmp (print_frame_arguments, "none") == 0)
-    return 0;
-
-  /* If the user asked to print all arguments, then we should print
-     that one.  */
-
-  if (strcmp (print_frame_arguments, "all") == 0)
-    return 1;
-
-  /* The user asked to print only the scalar arguments, so do not
-     print the non-scalar ones.  */
-
-  type = CHECK_TYPEDEF (SYMBOL_TYPE (sym));
-  while (TYPE_CODE (type) == TYPE_CODE_REF)
-    type = CHECK_TYPEDEF (TYPE_TARGET_TYPE (type));
-  switch (TYPE_CODE (type))
-    {
-      case TYPE_CODE_ARRAY:
-      case TYPE_CODE_STRUCT:
-      case TYPE_CODE_UNION:
-      case TYPE_CODE_SET:
-      case TYPE_CODE_STRING:
-      case TYPE_CODE_BITSTRING:
-        return 0;
-      default:
-        return 1;
-    }
-}
-
 /* Print the arguments of frame FRAME on STREAM, given the function
    FUNC running in that frame (as a symbol), where NUM is the number
    of arguments according to the stack frame (or -1 if the number of
@@ -220,6 +180,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
   int args_printed = 0;
   struct cleanup *old_chain, *list_chain;
   struct ui_stream *stb;
+  /* True if we should print arguments, false otherwise.  */
+  int print_args = strcmp (print_frame_arguments, "none");
+  /* True in "summary" mode, false otherwise.  */
+  int summary = !strcmp (print_frame_arguments, "scalars");
 
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -354,7 +318,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 	  annotate_arg_name_end ();
 	  ui_out_text (uiout, "=");
 
-          if (print_this_frame_argument_p (sym))
+          if (print_args)
             {
 	      /* Avoid value_print because it will deref ref parameters.
 		 We just want to print their addresses.  Print ??? for
@@ -381,9 +345,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 
 		  get_raw_print_options (&opts);
 		  opts.deref_ref = 0;
-		  opts.summary = 1;
-		  common_val_print (val, stb->stream, 2,
-				    &opts, language);
+		  opts.summary = summary;
+		  common_val_print (val, stb->stream, 2, &opts, language);
 		  ui_out_field_stream (uiout, "value", stb);
 	        }
 	      else
diff --git a/gdb/valprint.c b/gdb/valprint.c
index a9e8227..49ba057 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -217,6 +217,33 @@ show_addressprint (struct ui_file *file, int from_tty,
 }
 \f
 
+/* A helper function for val_print.  When printing in "summary" mode,
+   we want to print scalar arguments, but not aggregate arguments.
+   This function distinguishes between the two.  */
+
+static int
+scalar_type_p (struct type *type)
+{
+  CHECK_TYPEDEF (type);
+  while (TYPE_CODE (type) == TYPE_CODE_REF)
+    {
+      type = TYPE_TARGET_TYPE (type);
+      CHECK_TYPEDEF (type);
+    }
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_ARRAY:
+    case TYPE_CODE_STRUCT:
+    case TYPE_CODE_UNION:
+    case TYPE_CODE_SET:
+    case TYPE_CODE_STRING:
+    case TYPE_CODE_BITSTRING:
+      return 0;
+    default:
+      return 1;
+    }
+}
+
 /* Print using the given LANGUAGE the data of type TYPE located at VALADDR
    (within GDB), which came from the inferior at address ADDRESS, onto
    stdio stream STREAM according to OPTIONS.
@@ -269,6 +296,14 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	return ret;
     }
 
+  /* Handle summary mode.  If the value is a scalar, print it;
+     otherwise, print an ellipsis.  */
+  if (options->summary && !scalar_type_p (type))
+    {
+      fprintf_filtered (stream, "...");
+      return 0;
+    }
+
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
       ret = language->la_val_print (type, valaddr, embedded_offset, address,


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-24 17:33 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-24 17:33 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  3866a85264a0f35029b5c8a49b7c0b94d3730226 (commit)
       via  57ef0cba8a93024e781a32a323884f8a7ff1d557 (commit)
       via  cb7eaa7343fa9fa04f8deee2471b85be2b44fe13 (commit)
       via  cb27ee6e1ada4fd6992dd51da402baef10ad88e3 (commit)
       via  e107fb9687bb1e7f74170aa3d19c4a8f6edbb10f (commit)
       via  6e85bcb66b4c94185c527f475c14711b621d0fdf (commit)
      from  1766bf14929c3a3638e14073b5577cce4d49a146 (commit)

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

- Log -----------------------------------------------------------------
commit 3866a85264a0f35029b5c8a49b7c0b94d3730226
Merge: 1766bf14929c3a3638e14073b5577cce4d49a146 57ef0cba8a93024e781a32a323884f8a7ff1d557
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Mar 24 18:33:05 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/doc/gdb.texinfo                         |   12 +++++++++++-
 gdb/python/lib/gdb/libstdcxx/v6/printers.py |   23 ++++++++++++++++-------
 gdb/python/python-frame.c                   |    2 +-
 gdb/python/python-type.c                    |    9 ++++++++-
 gdb/python/python-value.c                   |   21 ++++++++++++++++++++-
 gdb/testsuite/gdb.python/python-value.exp   |    3 +++
 6 files changed, 59 insertions(+), 11 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 66330af..45cd72b 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18601,6 +18601,15 @@ bar = some_val['foo']
 
 Again, @code{bar} will also be a @code{gdb.Value} object.
 
+The following attribute is provided:
+
+@table @code
+@defmethod Value is_optimized_out
+This read-only boolean attribute is true if the compiler optimized out
+this value, thus it is not available for fetching from the inferior.
+@end defmethod
+@end table
+
 The following methods are provided:
 
 @table @code
@@ -18724,7 +18733,8 @@ non-zero value, which is the size of the field in bits.  Otherwise,
 this will be zero; in this case the field's size is given by its type.
 
 @item type
-The type of the field.
+The type of the field.  This is usually an instance of @code{Type},
+but it can be @code{None} in some situations.
 @end table
 @end defmethod
 
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index 2572731..bcc5b28 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -27,6 +27,8 @@ class StdPointerPrinter:
         self.val = val
 
     def to_string (self):
+        if self.val['_M_refcount']['_M_pi'] == 0:
+            return '%s (empty) %s' % (self.typename, self.val['_M_ptr'])
         return '%s (count %d) %s' % (self.typename,
         self.val['_M_refcount']['_M_pi']['_M_use_count'],
         self.val['_M_ptr'])
@@ -599,14 +601,21 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
     # vector<bool>
 
-    # These are the C++0x printers. They also exist in the standard namespace.
+    # These are the TR1 and C++0x printers.
     # For array - the default GDB pretty-printer seems reasonable.
-    pretty_printers_dict[re.compile('^std::(tr1::)?shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
-    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+    pretty_printers_dict[re.compile('^std::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::unordered_multiset', val)
+
+    pretty_printers_dict[re.compile('^std::tr1::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::tr1::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::tr1::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
 
 
     # Extensions.
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index dc3f45e..1fc553b 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -419,7 +419,7 @@ frapy_read_var (PyObject *self, PyObject *args)
 
       var_name = python_string_to_target_string (sym_obj);
       if (!var_name)
-      	return NULL;
+	return NULL;
       cleanup = make_cleanup (xfree, var_name);
 
       TRY_CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 772a011..c851cdb 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -176,7 +176,14 @@ convert_field (struct type *type, int field)
   if (PyObject_SetAttrString (result, "bitsize", arg) < 0)
     goto failarg;
 
-  arg = type_to_type_object (TYPE_FIELD_TYPE (type, field));
+  /* A field can have a NULL type in some situations.  */
+  if (TYPE_FIELD_TYPE (type, field) == NULL)
+    {
+      arg = Py_None;
+      Py_INCREF (arg);
+    }
+  else
+    arg = type_to_type_object (TYPE_FIELD_TYPE (type, field));
   if (!arg)
     goto fail;
   if (PyObject_SetAttrString (result, "type", arg) < 0)
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 2507fcd..5d4f596 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -312,6 +312,18 @@ valpy_str (PyObject *self)
   return result;
 }
 
+/* Implements gdb.Value.is_optimized_out.  */
+static PyObject *
+valpy_get_is_optimized_out (PyObject *self, void *closure)
+{
+  struct value *value = ((value_object *) self)->value;
+
+  if (value_optimized_out (value))
+    Py_RETURN_TRUE;
+
+  Py_RETURN_FALSE;
+}
+
 enum valpy_opcode
 {
   VALPY_ADD,
@@ -913,6 +925,13 @@ gdbpy_initialize_values (void)
 
 \f
 
+static PyGetSetDef value_object_getset[] = {
+  { "is_optimized_out", valpy_get_is_optimized_out, NULL,
+    "Boolean telling whether the value is optimized out (i.e., not available).",
+    NULL },
+  {NULL}  /* Sentinel */
+};
+
 static PyMethodDef value_object_methods[] = {
   { "address", valpy_address, METH_NOARGS, "Return the address of the value." },
   { "cast", valpy_cast, METH_VARARGS, "Cast the value to the supplied type." },
@@ -987,7 +1006,7 @@ PyTypeObject value_object_type = {
   0,				  /* tp_iternext */
   value_object_methods,		  /* tp_methods */
   0,				  /* tp_members */
-  0,				  /* tp_getset */
+  value_object_getset,		  /* tp_getset */
   0,				  /* tp_base */
   0,				  /* tp_dict */
   0,				  /* tp_descr_get */
diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp
index 9ca9593..bd54b2f 100644
--- a/gdb/testsuite/gdb.python/python-value.exp
+++ b/gdb/testsuite/gdb.python/python-value.exp
@@ -225,6 +225,9 @@ proc test_value_in_inferior {} {
 
   # Check that the dereferenced value is sane
   gdb_test "python print arg0" "0x.*$testfile\"" "verify dereferenced value"
+
+  # Smoke-test is_optimized_out attribute
+  gdb_test "python print 'result =', arg0.is_optimized_out" "= False" "Test is_optimized_out attribute"
 }
 
 proc test_value_after_death {} {


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-12 20:25 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-12 20:25 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  1a226d16e0e38250c8d82406d0f91c836a70971a (commit)
       via  0b094dd645f7ec3b9da219b49997bdda1c467e8d (commit)
      from  96be6c5398456337a1b394ff7ab38d4c4278fa69 (commit)

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

- Log -----------------------------------------------------------------
commit 1a226d16e0e38250c8d82406d0f91c836a70971a
Merge: 96be6c5398456337a1b394ff7ab38d4c4278fa69 0b094dd645f7ec3b9da219b49997bdda1c467e8d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 12 21:25:01 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/python.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 3994172..0bc25b1 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -301,7 +301,7 @@ gdbpy_solib_address (PyObject *self, PyObject *args)
   if (!PyArg_ParseTuple (args, "K", &pc))
     return NULL;
 
-  soname = solib_address (pc);
+  soname = solib_name_from_address (pc);
   if (soname)
     str_obj = PyString_Decode (soname, strlen (soname), host_charset (), NULL);
   else


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-09 17:05 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-09 17:05 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  ec29855686f2a78d90ebcc63765681249bbbe808 (commit)
       via  534f5de0c9569a9eae535d722864afa1d78dc9dc (commit)
       via  0874c29c3341c169ebaaf3f125792d57595fc525 (commit)
      from  543fb2154d3bd551344b990b911be5c6cc703504 (commit)

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

- Log -----------------------------------------------------------------
commit ec29855686f2a78d90ebcc63765681249bbbe808
Merge: 543fb2154d3bd551344b990b911be5c6cc703504 534f5de0c9569a9eae535d722864afa1d78dc9dc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Mar 9 18:03:07 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/lib/gdb/libstdcxx/v6/printers.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index ccef97d..c0dc987 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -615,6 +615,7 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
     pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
     pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
+    # vector<bool>
 
     # These are the C++0x printers. They also exist in the standard namespace.
     # For array - the default GDB pretty-printer seems reasonable.
@@ -626,7 +627,7 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
 
 
-    # Extensions to std, tr1 pretty-printers.
+    # Extensions.
     pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter
 
     if True:


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-06 21:16 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-06 21:16 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  46c9c97c70d8a5670691a7a7f62e76d48213bf4e (commit)
       via  9ae706a486c079a09f55352803456dc2588d5b92 (commit)
      from  6cf16c0711e844094ab694b3d929f7bd30b49f61 (commit)

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

- Log -----------------------------------------------------------------
commit 46c9c97c70d8a5670691a7a7f62e76d48213bf4e
Merge: 6cf16c0711e844094ab694b3d929f7bd30b49f61 9ae706a486c079a09f55352803456dc2588d5b92
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Mar 6 22:16:29 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/lib/gdb/libstdcxx/v6/hook.in     |   27 ++++++++++++++++++++++
 gdb/python/lib/gdb/libstdcxx/v6/printers.py |   33 +++++++++++++--------------
 2 files changed, 43 insertions(+), 17 deletions(-)
 create mode 100644 gdb/python/lib/gdb/libstdcxx/v6/hook.in

First 500 lines of diff:
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/hook.in b/gdb/python/lib/gdb/libstdcxx/v6/hook.in
new file mode 100644
index 0000000..fe7c072
--- /dev/null
+++ b/gdb/python/lib/gdb/libstdcxx/v6/hook.in
@@ -0,0 +1,27 @@
+# -*- python -*-
+# 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 sys
+import gdb
+
+# Update module path.
+dir = '@dir@'
+if not dir in sys.path:
+    sys.path.insert(0, dir)
+
+# Load the pretty-printers.
+from libstdcxx.v6.printers import register_libstdcxx_printers
+register_libstdcxx_printers (gdb.current_objfile ())
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index 7a77ad4..ccef97d 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -27,8 +27,9 @@ class StdPointerPrinter:
         self.val = val
 
     def to_string (self):
-        return '%s (count %d) %s' % (self.typename, self.val['_M_refcount'],
-                                     self.val['_M_ptr'])
+        return '%s (count %d) %s' % (self.typename,
+        self.val['_M_refcount']['_M_pi']['_M_use_count'],
+        self.val['_M_ptr'])
 
 class UniquePointerPrinter:
     "Print a unique_ptr"
@@ -612,21 +613,20 @@ def build_libstdcxx_dictionary ():
     pretty_printers_dict[re.compile('^std::queue<.*>$')] = lambda val: StdStackOrQueuePrinter("std::queue", val)
     pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
     pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
+    pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
     pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
-    # vector<bool>
-
-    # C++0x stuff.
-    # array - the default seems reasonable
-    # smart_ptr?  seems to only be in boost right now
-    pretty_printers_dict[re.compile('^std::tr1::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
-    pretty_printers_dict[re.compile('^std::tr1::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
-    pretty_printers_dict[re.compile('^std::tr1::unique_ptr<.*>$')] = UniquePointerPrinter
-    pretty_printers_dict[re.compile('^std::tr1::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
-    pretty_printers_dict[re.compile('^std::tr1::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
-    pretty_printers_dict[re.compile('^std::tr1::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
-    pretty_printers_dict[re.compile('^std::tr1::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
-
-    # Extensions.
+
+    # These are the C++0x printers. They also exist in the standard namespace.
+    # For array - the default GDB pretty-printer seems reasonable.
+    pretty_printers_dict[re.compile('^std::(tr1::)?shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::(tr1::)?weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+
+
+    # Extensions to std, tr1 pretty-printers.
     pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter
 
     if True:
@@ -644,4 +644,3 @@ def build_libstdcxx_dictionary ():
 pretty_printers_dict = {}
 
 build_libstdcxx_dictionary ()
-register_libstdcxx_printers (gdb.current_objfile())


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-06 16:59 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-06 16:59 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  6cf16c0711e844094ab694b3d929f7bd30b49f61 (commit)
       via  ed5683b8c1957677e95baa80db811894c39a321e (commit)
       via  7479ac4e385bcaa2846c3aad5c616f571ff53c97 (commit)
      from  bf6147356894cacabfbf511cfb7044a4845d2dfd (commit)

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

- Log -----------------------------------------------------------------
commit 6cf16c0711e844094ab694b3d929f7bd30b49f61
Merge: bf6147356894cacabfbf511cfb7044a4845d2dfd ed5683b8c1957677e95baa80db811894c39a321e
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Mar 6 17:58:45 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/testsuite/gdb.python/python-frame.exp |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index e9e063a..674c25e 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -81,20 +81,9 @@ gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc"
 gdb_test "python print 'result =', f0.addr_in_block ()" " = \[0-9\]+" "test Frame.addr_in_block"
 gdb_test "python print 'result =', f0.older ().equals (f1)" " = True" "test Frame.older"
 gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer"
-
-set test "test Frame.read_var - error"
-gdb_test_multiple "python print 'result =', f0.read_var ('b')" $test {
-    -re "ValueError: variable 'b' not found.*Error while executing Python code.\r\n$gdb_prompt $" {
-	pass $test
-    }
-    -re "result = \\\{i = \\\{0, \[0-9\]+\\\}, d = 0\\.\[0-9\]+\\\}\r\n$gdb_prompt $" {
-	# libm.so debuginfo contains file static symbol `b' from `atnat.h'.
-	# local `b' would be find first if it would exist so it is more a PASS.
-	setup_xfail *-*-*
-	fail $test
-    }
-}
-
+gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \
+  "ValueError: variable 'variable_which_surely_doesnt_exist' not found.*Error while executing Python code." \
+  "test Frame.read_var - error"
 gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
 gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-06 14:26 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-06 14:26 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  b5a96cb6abf55cbe4e62eba8bfd3f816271b1189 (commit)
       via  652968509fe26811de7e57036ec8bd801593ccbb (commit)
       via  eff2403b365bdda84c08eb68890152ca1a58f1c6 (commit)
      from  ab1b64243b1f5f92f2161fe583e9eab5c79a62be (commit)

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

- Log -----------------------------------------------------------------
commit b5a96cb6abf55cbe4e62eba8bfd3f816271b1189
Merge: ab1b64243b1f5f92f2161fe583e9eab5c79a62be 652968509fe26811de7e57036ec8bd801593ccbb
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Mar 6 15:26:41 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/testsuite/gdb.python/python-frame.exp |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index 083fa90..e9e063a 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -81,9 +81,20 @@ gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc"
 gdb_test "python print 'result =', f0.addr_in_block ()" " = \[0-9\]+" "test Frame.addr_in_block"
 gdb_test "python print 'result =', f0.older ().equals (f1)" " = True" "test Frame.older"
 gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer"
-gdb_test "python print 'result =', f0.read_var ('b')" \
-  "ValueError: variable 'b' not found.*Error while executing Python code." \
-  "test Frame.read_var - error"
+
+set test "test Frame.read_var - error"
+gdb_test_multiple "python print 'result =', f0.read_var ('b')" $test {
+    -re "ValueError: variable 'b' not found.*Error while executing Python code.\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "result = \\\{i = \\\{0, \[0-9\]+\\\}, d = 0\\.\[0-9\]+\\\}\r\n$gdb_prompt $" {
+	# libm.so debuginfo contains file static symbol `b' from `atnat.h'.
+	# local `b' would be find first if it would exist so it is more a PASS.
+	setup_xfail *-*-*
+	fail $test
+    }
+}
+
 gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
 gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-05 21:53 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-05 21:53 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  337f0763307e136ea5897beddc64d0cf75eb85f6 (commit)
       via  b4c50b1c09c24b8796dbc6c5d82572029472c014 (commit)
       via  5d73409799981c07fba0c15494f53285bb662437 (commit)
      from  a02ff1c049b55fae6e887eb4130e82aba3b4f897 (commit)

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

- Log -----------------------------------------------------------------
commit 337f0763307e136ea5897beddc64d0cf75eb85f6
Merge: a02ff1c049b55fae6e887eb4130e82aba3b4f897 b4c50b1c09c24b8796dbc6c5d82572029472c014
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 5 22:53:15 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/python-function.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python-function.c b/gdb/python/python-function.c
index 608ac28..4a85a33 100644
--- a/gdb/python/python-function.c
+++ b/gdb/python/python-function.c
@@ -93,7 +93,7 @@ fnpy_call (void *cookie, int argc, struct value **argv)
 
   Py_DECREF (result);
   do_cleanups (cleanup);
-  
+
   return value;
 }
 
@@ -127,10 +127,9 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 void
 gdbpy_initialize_functions (void)
 {
-  fnpy_object_type.tp_new = PyType_GenericNew;
-  fnpy_object_type.tp_init = fnpy_init;
   if (PyType_Ready (&fnpy_object_type) < 0)
     return;
+
   Py_INCREF (&fnpy_object_type);
   PyModule_AddObject (gdb_module, "Function", (PyObject *) &fnpy_object_type);
 }
@@ -167,5 +166,15 @@ static PyTypeObject fnpy_object_type =
   0,				  /* tp_weaklistoffset */
   0,				  /* tp_iter */
   0,				  /* tp_iternext */
-  0				  /* tp_methods */
+  0,				  /* tp_methods */
+  0,				  /* tp_members */
+  0,				  /* tp_getset */
+  0,				  /* tp_base */
+  0,				  /* tp_dict */
+  0,				  /* tp_descr_get */
+  0,				  /* tp_descr_set */
+  0,				  /* tp_dictoffset */
+  fnpy_init,			  /* tp_init */
+  0,				  /* tp_alloc */
+  PyType_GenericNew		  /* tp_new */
 };


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-05 21:15 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-05 21:15 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  ace5ac468d6708dd9d078fe264e38cf8ba5ebc37 (commit)
       via  a0d288848d0d1ae00798d5f5a86ee8d48ea8f87c (commit)
       via  a9edccdb7bff2cbea16f21972531097a8bcccc90 (commit)
       via  f61c9e6e4488ddec2eb88bfef2aaa3fb12aba9db (commit)
      from  1c279e7757c153b751d87d7da7592b8d3983da19 (commit)

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

- Log -----------------------------------------------------------------
commit ace5ac468d6708dd9d078fe264e38cf8ba5ebc37
Merge: 1c279e7757c153b751d87d7da7592b8d3983da19 a0d288848d0d1ae00798d5f5a86ee8d48ea8f87c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 5 22:15:00 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/lib/gdb/command/require.py |    4 ++--
 gdb/python/python-function.c          |   17 ++---------------
 gdb/value.c                           |   29 ++++++++++-------------------
 gdb/value.h                           |    5 ++++-
 4 files changed, 18 insertions(+), 37 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/lib/gdb/command/require.py b/gdb/python/lib/gdb/command/require.py
index f75faad..1fbc1e8 100644
--- a/gdb/python/lib/gdb/command/require.py
+++ b/gdb/python/lib/gdb/command/require.py
@@ -1,6 +1,6 @@
 # Demand-loading commands.
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# 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
@@ -41,7 +41,7 @@ class RequireSubcommand (gdb.Command):
             exec ('import gdb.' + self.name + '.' + cmd, globals ())
 
     def complete (self, text, word):
-        dir = gdb.pythonlibdir + '/gdb/' + self.name
+        dir = gdb.pythondir + '/gdb/' + self.name
         result = []
         for file in os.listdir(dir):
             if not file.startswith (word) or not file.endswith ('.py'):
diff --git a/gdb/python/python-function.c b/gdb/python/python-function.c
index 5e346d6..608ac28 100644
--- a/gdb/python/python-function.c
+++ b/gdb/python/python-function.c
@@ -1,6 +1,6 @@
 /* Convenience functions implemented in Python.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -97,19 +97,6 @@ fnpy_call (void *cookie, int argc, struct value **argv)
   return value;
 }
 
-/* Called when destroying a struct internal_function.  */
-
-static void
-fnpy_destroy (void *cookie)
-{
-  PyGILState_STATE state;
-
-  state = PyGILState_Ensure ();
-  Py_DECREF ((PyObject *) cookie);
-  PyGILState_Release (state);
-
-}
-
 /* Initializer for a Function object.  It takes one argument, the name
    of the function.  */
 
@@ -131,7 +118,7 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   if (! docstring)
     docstring = _("This function is not documented.");
 
-  add_internal_function (name, docstring, fnpy_call, self, fnpy_destroy);
+  add_internal_function (name, docstring, fnpy_call, self);
   return 0;
 }
 
diff --git a/gdb/value.c b/gdb/value.c
index 9312468..5c81d83 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -58,10 +58,6 @@ struct internal_function
 
   /* User data for the handler.  */
   void *cookie;
-
-  /* Function called to destroy the cookie when the function object is
-     destroyed.  */
-  void (*destroyer) (void *cookie);
 };
 
 static struct cmd_list_element *functionlist;
@@ -983,6 +979,7 @@ create_internalvar (const char *name)
   var->value = allocate_value (builtin_type_void);
   var->endian = gdbarch_byte_order (current_gdbarch);
   var->make_value = NULL;
+  var->canonical = 0;
   release_value (var->value);
   var->next = internalvars;
   internalvars = var;
@@ -1112,6 +1109,9 @@ set_internalvar (struct internalvar *var, struct value *val)
 {
   struct value *newval;
 
+  if (var->canonical)
+    error (_("Cannot overwrite convenience function %s"), var->name);
+
   newval = value_copy (val);
   newval->modifiable = 1;
 
@@ -1143,22 +1143,15 @@ internalvar_name (struct internalvar *var)
 static struct value *
 value_create_internal_function (const char *name,
 				internal_function_fn handler,
-				void *cookie,
-				void (*destroyer) (void *))
+				void *cookie)
 {
   struct value *result = allocate_value (internal_fn_type);
   gdb_byte *addr = value_contents_writeable (result);
   struct internal_function **fnp = (struct internal_function **) addr;
-  /* The internal_function object is leaked here -- to make it truly
-     deletable, we would have to reference count it and add special
-     code to value_free and value_copy.  The setup here is a bit odd
-     in general.  It would be better to have a special case in
-     help_command.  */
   struct internal_function *ifn = XNEW (struct internal_function);
   ifn->name = xstrdup (name);
   ifn->handler = handler;
   ifn->cookie = cookie;
-  ifn->destroyer = destroyer;
   *fnp = ifn;
   return result;
 }
@@ -1200,19 +1193,17 @@ function_destroyer (struct cmd_list_element *self, void *ignore)
 /* Add a new internal function.  NAME is the name of the function; DOC
    is a documentation string describing the function.  HANDLER is
    called when the function is invoked.  COOKIE is an arbitrary
-   pointer which is passed to HANDLER and is intended for "user data".
-   DESTROYER is invoked when the function is destroyed.  */
+   pointer which is passed to HANDLER and is intended for "user
+   data".  */
 void
 add_internal_function (const char *name, const char *doc,
-		       internal_function_fn handler,
-		       void *cookie, void (*destroyer) (void *))
+		       internal_function_fn handler, void *cookie)
 {
   struct cmd_list_element *cmd;
   struct internalvar *var = lookup_internalvar (name);
-  struct value *fnval = value_create_internal_function (name, handler, cookie,
-							destroyer);
-  release_value (fnval);
+  struct value *fnval = value_create_internal_function (name, handler, cookie);
   set_internalvar (var, fnval);
+  var->canonical = 1;
 
   cmd = add_cmd (xstrdup (name), no_class, function_command, (char *) doc,
 		 &functionlist);
diff --git a/gdb/value.h b/gdb/value.h
index f41def9..1ad3c75 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -325,6 +325,9 @@ struct internalvar
   struct value *value;
   internalvar_make_value make_value;
   int endian;
+  /* True if this internalvar is the canonical name for a convenience
+     function.  */
+  int canonical;
 };
 
 \f
@@ -688,7 +691,7 @@ typedef struct value *(*internal_function_fn) (void *cookie,
 
 void add_internal_function (const char *name, const char *doc,
 			    internal_function_fn handler,
-			    void *cookie, void (*destroyer) (void *));
+			    void *cookie);
 
 struct value *call_internal_function (struct value *function,
 				      int argc, struct value **argv);


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-04 23:54 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-04 23:54 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  1c279e7757c153b751d87d7da7592b8d3983da19 (commit)
       via  5cb172eb14db3f9b01bb8229fb001617ee447b9b (commit)
       via  80e9d289cba705a6d9a834fb659df9640b4a2a6e (commit)
      from  91200d8f856c3165270b24ab392b74d9155b7180 (commit)

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

- Log -----------------------------------------------------------------
commit 1c279e7757c153b751d87d7da7592b8d3983da19
Merge: 91200d8f856c3165270b24ab392b74d9155b7180 5cb172eb14db3f9b01bb8229fb001617ee447b9b
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Mar 5 00:54:25 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/Makefile.in |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 01cb9e9..c84a4ac 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1997,9 +1997,17 @@ install-python:
 	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \
 	done
 
-# Brute force.
+# Other packages may have their files installed in $(pythondir).
 uninstall-python:
-	rm -rf $(DESTDIR)/$(pythondir)
+	files='$(PY_FILES)'; for file in $$files; do \
+	  slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'`; \
+	  rm -f $(DESTDIR)$(pythondir)/$$file; \
+	  while test "x$$file" != "x$$slashdir"; do \
+	    rmdir 2>/dev/null "$(DESTDIR)$(pythondir)$$slashdir"; \
+	    file="$$slashdir"; \
+	    slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  done \
+	done
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-04 22:34 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-04 22:34 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  91200d8f856c3165270b24ab392b74d9155b7180 (commit)
       via  e42b07c2ea95c94f7f08f35479758953fa6a7d1c (commit)
       via  a0533baa7d7bb7110d5acc5bd4dabca8871af538 (commit)
       via  84db8f9a3164350cdaa19dcc0c9122d55a5019bd (commit)
       via  8cd105bd9c53585384cb4249c942bed395ba2b89 (commit)
       via  dea5a03d229ce609df3ab3dd10f762608e8df094 (commit)
       via  9a0e06375eeafd272d38863feed8c9a8c1408701 (commit)
       via  7322121d6f77ef446b26f5d048529ae85de30ffd (commit)
       via  e180fc688f2f720ed9431d5712821142db49b46f (commit)
       via  7d013430def2b170f8e8ab1d24312dfecaccc13d (commit)
       via  661248db174bd85e6816ab6794483533f95e3097 (commit)
       via  db7ebad5e30d3ba79028421b7aa39779f796769b (commit)
      from  ff1b04aa80fbb589c4a1bc5e1cdcd1a386022c69 (commit)

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

- Log -----------------------------------------------------------------
commit 91200d8f856c3165270b24ab392b74d9155b7180
Merge: a0533baa7d7bb7110d5acc5bd4dabca8871af538 e42b07c2ea95c94f7f08f35479758953fa6a7d1c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 23:33:44 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

commit a0533baa7d7bb7110d5acc5bd4dabca8871af538
Merge: ff1b04aa80fbb589c4a1bc5e1cdcd1a386022c69 84db8f9a3164350cdaa19dcc0c9122d55a5019bd
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 23:32:45 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer
    
    Conflicts:
    	gdb/Makefile.in
    	gdb/configure
    	gdb/configure.ac

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

Summary of changes:
 gdb/Makefile.in            |   23 ++++++------------
 gdb/config.in              |    6 ++--
 gdb/configure              |   47 ++++++++++++++++++++++---------------
 gdb/configure.ac           |   24 ++++++++++++------
 gdb/doc/gdb.texinfo        |    6 ++++
 gdb/python/python-membuf.c |   34 ++++++++++++++++++++-------
 gdb/python/python.c        |   55 +++++++++++++++++++++++++++++++------------
 7 files changed, 125 insertions(+), 70 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index fdb0582..01cb9e9 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -177,7 +177,9 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
 # Did the user give us a --with-gdb-datadir option?
 GDB_DATADIR_PATH = @GDB_DATADIR_PATH@
 
-GDB_PYTHONDIR_PATH = @GDB_PYTHONDIR_PATH@
+# The argument to --with-pythondir.  If not given, this is
+# GDB_DATADIR_PATH/python.
+pythondir = @pythondir@
 
 # Helper code from gnulib.
 LIBGNU = gnulib/libgnu.a
@@ -1987,26 +1989,17 @@ PY_FILES = gdb/FrameIterator.py gdb/command/alias.py \
     gdb/__init__.py
 
 # Install the Python library.  Python library files go under
-# $(GDB_PYTHONDIR_PATH)/python.
+# $(pythondir).
 install-python:
 	files='$(PY_FILES)'; for file in $$files; do \
 	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir; \
-	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
+	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(pythondir)/$$dir; \
+	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \
 	done
 
-# Other packages may have their files installed in $(GDB_PYTHONDIR_PATH).
+# Brute force.
 uninstall-python:
-	rm -rf $(DESTDIR)/$(GDB_PYTHONDIR_PATH)/python
-	files='$(PY_FILES)'; for file in $$files; do \
-	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  rm -f $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
-	  while test "x$$file" != "x$$dir"; do \
-	    rmdir 2>/dev/null "$(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir"; \
-	    file="$$dir"; \
-	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  done \
-	done
+	rm -rf $(DESTDIR)/$(pythondir)
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being
diff --git a/gdb/config.in b/gdb/config.in
index 1cfb12b..0c8ccab 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -66,9 +66,6 @@
 /* Define to the default OS ABI for this configuration. */
 #undef GDB_OSABI_DEFAULT
 
-/* Base directory for GDB Python modules. */
-#undef GDB_PYTHONDIR_PATH
-
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
@@ -633,6 +630,9 @@
    'ptrdiff_t'. */
 #undef PTRDIFF_T_SUFFIX
 
+/* Define to install path for Python sources */
+#undef PYTHONDIR
+
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
diff --git a/gdb/configure b/gdb/configure
index aa1dd84..3a5b582 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite"
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT GDB_PYTHONDIR_PATH PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH pythondir subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
 ac_pwd=`pwd`
 
@@ -884,6 +884,8 @@ Optional Packages:
   --with-separate-debug-dir=path   Look for global separate debug info in this path LIBDIR/debug
   --with-gdb-datadir      look for global separate data files in this path
                           [DATADIR/gdb]
+  --with-pythondir        install Python data files in this path
+                          [DATADIR/gdb/python]
   --with-libunwind            Use libunwind frame unwinding support
   --with-pkgversion=PKG   Use PKG in the version string in place of "GDB"
   --with-bugurl=URL       Direct users to URL to report a bug
@@ -7179,6 +7181,29 @@ GDB_DATADIR_PATH=${gdbdatadir}
 
 
 
+# Check whether --with-pythondir or --without-pythondir was given.
+if test "${with_pythondir+set}" = set; then
+  withval="$with_pythondir"
+  pythondir="${withval}"
+else
+  pythondir=no
+fi;
+
+# If the user passed in a path, define it.  Otherwise, compute it at
+# runtime based on the possibly-relocatable datadir.
+if test "$pythondir" = "no"; then
+  pythondir='$(GDB_DATADIR_PATH)/python'
+else
+
+cat >>confdefs.h <<_ACEOF
+#define PYTHONDIR "$pythondir"
+_ACEOF
+
+fi
+
+
+
+
 
 subdirs="$subdirs doc testsuite"
 
@@ -11424,7 +11449,6 @@ echo $ECHO_N "checking whether to use python... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: $with_python" >&5
 echo "${ECHO_T}$with_python" >&6
 
-GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   { echo "$as_me:$LINENO: WARNING: python support disabled; some features may be unavailable." >&5
 echo "$as_me: WARNING: python support disabled; some features may be unavailable." >&2;}
@@ -11656,20 +11680,7 @@ _ACEOF
 
     fi
   fi
-  if test ${have_libpython} != no; then
-    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
-
-  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
-  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-  ac_define_dir=`eval echo $GDB_PYTHONDIR_PATH`
-  ac_define_dir=`eval echo $ac_define_dir`
-
-cat >>confdefs.h <<_ACEOF
-#define GDB_PYTHONDIR_PATH "$ac_define_dir"
-_ACEOF
-
-
-  else
+  if test ${have_libpython} = no; then
     case "${with_python}" in
     yes)
       { { echo "$as_me:$LINENO: error: python is missing or unusable" >&5
@@ -11691,8 +11702,6 @@ echo "$as_me: error: no usable python found at ${with_python}" >&2;}
   fi
 fi
 
-
-PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21998,6 +22007,7 @@ s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
 s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
 s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
 s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t
+s,@pythondir@,$pythondir,;t t
 s,@subdirs@,$subdirs,;t t
 s,@TARGET_OBS@,$TARGET_OBS,;t t
 s,@PKGVERSION@,$PKGVERSION,;t t
@@ -22022,7 +22032,6 @@ s,@READLINE_CFLAGS@,$READLINE_CFLAGS,;t t
 s,@HAVE_LIBEXPAT@,$HAVE_LIBEXPAT,;t t
 s,@LIBEXPAT@,$LIBEXPAT,;t t
 s,@LTLIBEXPAT@,$LTLIBEXPAT,;t t
-s,@GDB_PYTHONDIR_PATH@,$GDB_PYTHONDIR_PATH,;t t
 s,@PYTHON_CFLAGS@,$PYTHON_CFLAGS,;t t
 s,@ALLOCA@,$ALLOCA,;t t
 s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 857a7cd..ff76053 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -148,6 +148,21 @@ esac
 GDB_DATADIR_PATH=${gdbdatadir}
 AC_SUBST(GDB_DATADIR_PATH)
 
+AC_ARG_WITH([pythondir],
+  [AS_HELP_STRING([--with-pythondir],
+                  [install Python data files in this path [DATADIR/gdb/python]])], [pythondir="${withval}"], [pythondir=no])
+
+# If the user passed in a path, define it.  Otherwise, compute it at
+# runtime based on the possibly-relocatable datadir.
+if test "$pythondir" = "no"; then
+  pythondir='$(GDB_DATADIR_PATH)/python'
+else
+  AC_DEFINE_UNQUOTED(PYTHONDIR, "$pythondir",
+      [Define to install path for Python sources])
+fi
+AC_SUBST(pythondir)
+
+
 AC_CONFIG_SUBDIRS(doc testsuite)
 
 # Check whether to support alternative target configurations
@@ -617,7 +632,6 @@ AC_ARG_WITH(python,
 AC_MSG_CHECKING([whether to use python])
 AC_MSG_RESULT([$with_python])
 
-GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   AC_MSG_WARN([python support disabled; some features may be unavailable.])
   have_libpython=no
@@ -660,11 +674,7 @@ else
       AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
     fi
   fi
-  if test ${have_libpython} != no; then
-    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
-    AC_DEFINE_DIR(GDB_PYTHONDIR_PATH, GDB_PYTHONDIR_PATH, 
-		  [Base directory for GDB Python modules.])
-  else
+  if test ${have_libpython} = no; then
     case "${with_python}" in
     yes)
       AC_MSG_ERROR([python is missing or unusable])
@@ -680,9 +690,7 @@ else
     LIBS=$save_LIBS
   fi
 fi
-AC_SUBST(GDB_PYTHONDIR_PATH)
 
-PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
   AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e44a64e..86941fe 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18488,6 +18488,12 @@ If this file does not exist, and if the parameter
 @code{debug-file-directory} is set, then @value{GDBN} will append the
 object file's real name to the value of this parameter, and try again.
 
+Finally, if this file does not exist, then @value{GDBN} will look in
+subdirectory of @code{gdb_datadir} (whose value is available from
+@code{maint show gdb_datadir}).  Specifically, @value{GDBN} will take
+the value of @code{gdb_datadir}, append @samp{python/auto-load}, and
+then append the object file's real name.
+
 Also, if a separate debug file is used, @value{GDBN} will look for the
 @samp{-gdb.py} file both in the directory associated with the
 application and the directory associated with the separate debug file.
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index 57836f9..a4c7d74 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -125,12 +125,12 @@ mbpy_str (PyObject *self)
 {
   membuf_object *membuf_obj = (membuf_object *) self;
 
-  return PyString_FromFormat ("memory buffer for address %p, %u bytes long",
-			      (void *) (uintptr_t) membuf_obj->addr,
-			      (unsigned int) membuf_obj->length);
+  return PyString_FromFormat ("memory buffer for address %s, %s bytes long",
+			      paddress (membuf_obj->addr),
+			      pulongest (membuf_obj->length));
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
 {
   membuf_object *membuf_obj = (membuf_object *) self;
@@ -147,13 +147,13 @@ get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
   return membuf_obj->length;
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr)
 {
   return get_read_buffer (self, segment, ptrptr);
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_seg_count (PyObject *self, Py_ssize_t *lenp)
 {
   if (lenp)
@@ -162,7 +162,7 @@ get_seg_count (PyObject *self, Py_ssize_t *lenp)
   return 1;
 }
 
-Py_ssize_t
+static Py_ssize_t
 get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 {
   void *ptr = NULL;
@@ -212,13 +212,29 @@ static PyTypeObject membuf_object_type = {
   0,				  /*tp_setattro*/
   &buffer_procs,		  /*tp_as_buffer*/
   Py_TPFLAGS_DEFAULT,		  /*tp_flags*/
-  "GDB memory buffer object" 	  /*tp_doc*/
+  "GDB memory buffer object", 	  /*tp_doc*/
+  0,				  /* tp_traverse */
+  0,				  /* tp_clear */
+  0,				  /* tp_richcompare */
+  0,				  /* tp_weaklistoffset */
+  0,				  /* tp_iter */
+  0,				  /* tp_iternext */
+  0,				  /* tp_methods */
+  0,				  /* tp_members */
+  0,				  /* tp_getset */
+  0,				  /* tp_base */
+  0,				  /* tp_dict */
+  0,				  /* tp_descr_get */
+  0,				  /* tp_descr_set */
+  0,				  /* tp_dictoffset */
+  0,				  /* tp_init */
+  0,				  /* tp_alloc */
+  PyType_GenericNew		  /* tp_new */
 };
 
 void
 gdbpy_initialize_membuf (void)
 {
-  membuf_object_type.tp_new = PyType_GenericNew;
   if (PyType_Ready (&membuf_object_type) < 0)
     return;
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 554b2bc..2b06748 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -967,10 +967,11 @@ static void
 gdbpy_new_objfile (struct objfile *objfile)
 {
   char *realname;
-  char *filename;
+  char *filename, *debugfile;
   int len;
   FILE *input;
   PyGILState_STATE state;
+  struct cleanup *cleanups;
 
   if (!gdbpy_auto_load || !objfile || !objfile->name)
     return;
@@ -986,35 +987,49 @@ gdbpy_new_objfile (struct objfile *objfile)
   strcpy (filename + len, GDBPY_AUTO_FILENAME);
 
   input = fopen (filename, "r");
+  debugfile = filename;
+
+  cleanups = make_cleanup (xfree, filename);
+  make_cleanup (xfree, realname);
 
   if (!input && debug_file_directory)
     {
       /* Also try the same file in the separate debug info directory.  */
-      char *debugfile;
-
       debugfile = xmalloc (strlen (filename)
 			   + strlen (debug_file_directory) + 1);
       strcpy (debugfile, debug_file_directory);
       /* FILENAME is absolute, so we don't need a "/" here.  */
       strcat (debugfile, filename);
 
-      xfree (filename);
-      filename = debugfile;
+      make_cleanup (xfree, debugfile);
+      input = fopen (debugfile, "r");
+    }
+
+  if (!input && gdb_datadir)
+    {
+      /* Also try the same file in a subdirectory of gdb's data
+	 directory.  */
+      debugfile = xmalloc (strlen (gdb_datadir) + strlen (filename)
+			   + strlen ("/auto-load") + 1);
+      strcpy (debugfile, gdb_datadir);
+      strcat (debugfile, "/auto-load");
+      /* FILENAME is absolute, so we don't need a "/" here.  */
+      strcat (debugfile, filename);
 
-      input = fopen (filename, "r");
+      make_cleanup (xfree, debugfile);
+      input = fopen (debugfile, "r");
     }
 
   if (input)
     {
       /* We don't want to throw an exception here -- but the user
 	 would like to know that something went wrong.  */
-      if (PyRun_SimpleFile (input, filename))
+      if (PyRun_SimpleFile (input, debugfile))
 	gdbpy_print_stack ();
       fclose (input);
     }
 
-  xfree (realname);
-  xfree (filename);
+  do_cleanups (cleanups);
   gdbpy_current_objfile = NULL;
 
   PyGILState_Release (state);
@@ -1768,6 +1783,12 @@ Enables or disables auto-loading of Python code when an object is opened."),
   PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version);
   PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name);
   PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name);
+#ifdef PYTHONDIR
+  PyModule_AddStringConstant (gdb_module, "pythondir", PYTHONDIR);
+#else
+  if (gdb_datadir)
+    PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir);
+#endif
 
   gdbpy_initialize_values ();
   gdbpy_initialize_breakpoints ();
@@ -1819,13 +1840,15 @@ class GdbOutputFile:\n\
 \n\
 sys.stderr = GdbOutputFile()\n\
 sys.stdout = GdbOutputFile()\n\
-# FIXME: gdb.pythonlibdir is deprecated as it is just the standard libdir.\n\
-gdb.pythonlibdir = '" GDB_PYTHONDIR_PATH "'\n\
-gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\
-from os.path import exists\n\
-ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\
-if exists (ipy):\n\
-  execfile (ipy)\n\
+if hasattr (gdb, 'datadir'):\n\
+  gdb.pythondir = gdb.datadir + '/python'\n\
+if hasattr (gdb, 'pythondir'):\n\
+  sys.path.insert(0, gdb.pythondir)\n\
+  gdb.__path__ = [gdb.pythondir + '/gdb']\n\
+  from os.path import exists\n\
+  ipy = gdb.pythondir + '/gdb/__init__.py'\n\
+  if exists (ipy):\n\
+    execfile (ipy)\n\
 ");
 
   /* Release the GIL while gdb runs.  */


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-04 15:04 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-04 15:04 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  ff1b04aa80fbb589c4a1bc5e1cdcd1a386022c69 (commit)
       via  fd8b0f7d6beeeb51c5b718275741d8dc44675f06 (commit)
       via  a6074bdc87ab8bfe8f517b7eccb1698af8dd0622 (commit)
       via  b2d8ee40deb869373afc86c870c85aa720870072 (commit)
       via  8376995d229ccbbec3d59897c511bdb35c9e0944 (commit)
       via  20fda2542b13b670951fcfcf9d89a13ca97b5bbb (commit)
       via  0170e791d1e9e2d4af3050b7c1965b177b65dc01 (commit)
       via  024b00ee6cb996b3d49e538352744d5af389cc0b (commit)
      from  af200f3fd762fd1a1b918c8e003f25c150d6e9dc (commit)

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

- Log -----------------------------------------------------------------
commit ff1b04aa80fbb589c4a1bc5e1cdcd1a386022c69
Merge: fd8b0f7d6beeeb51c5b718275741d8dc44675f06 a6074bdc87ab8bfe8f517b7eccb1698af8dd0622
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 16:04:15 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

commit fd8b0f7d6beeeb51c5b718275741d8dc44675f06
Merge: af200f3fd762fd1a1b918c8e003f25c150d6e9dc 0170e791d1e9e2d4af3050b7c1965b177b65dc01
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Mar 4 16:03:54 2009 +0100

    Merge commit 'origin/archer-jankratochvil-misc' into archer

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

Summary of changes:
 gdb/python/python-frame.c |    2 ++
 gdb/python/python-value.c |    6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index c98dc39..c257ac3 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -418,6 +418,8 @@ frapy_read_var (PyObject *self, PyObject *args)
       volatile struct gdb_exception except;
 
       var_name = python_string_to_target_string (sym_obj);
+      if (!var_name)
+      	return NULL;
       cleanup = make_cleanup (xfree, var_name);
 
       TRY_CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index de54b9d..2507fcd 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -349,11 +349,11 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
 	 a gdb.Value object and need to convert it from python as well.  */
       arg1 = convert_value_from_python (self);
       if (arg1 == NULL)
-	return NULL;
+	break;
 
       arg2 = convert_value_from_python (other);
       if (arg2 == NULL)
-	return NULL;
+	break;
 
       switch (opcode)
 	{
@@ -430,7 +430,7 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
     }
   GDB_PY_HANDLE_EXCEPTION (except);
 
-  return value_to_value_object (res_val);
+  return res_val ? value_to_value_object (res_val) : NULL;
 }
 
 static PyObject *


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-03 21:47 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-03 21:47 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  af200f3fd762fd1a1b918c8e003f25c150d6e9dc (commit)
       via  b7d72995b3fb6e6ef1ca3d5cf33269dc523a561f (commit)
       via  2c02a8f709f15aa25a10fb47a9e3bd98ff9d9a78 (commit)
      from  fd3ac4e44355bf7ebfd9e2719e67c1b888b87070 (commit)

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

- Log -----------------------------------------------------------------
commit af200f3fd762fd1a1b918c8e003f25c150d6e9dc
Merge: fd3ac4e44355bf7ebfd9e2719e67c1b888b87070 b7d72995b3fb6e6ef1ca3d5cf33269dc523a561f
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Mar 3 22:46:58 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/doc/gdb.texinfo                       |    2 +-
 gdb/python/lib/gdb/command/backtrace.py   |    2 +-
 gdb/python/python-frame.c                 |    8 ++++----
 gdb/testsuite/gdb.python/find.exp         |   14 +++++++-------
 gdb/testsuite/gdb.python/python-frame.exp |    6 +++---
 5 files changed, 16 insertions(+), 16 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index ef41312..e44a64e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19681,7 +19681,7 @@ Return the frame immediately newer (inner) to this frame.
 Return the frame's symtab and line object. @c (see @xref{Symtab_and_line,, Symtab and line}).
 @end defmethod
 
-@defmethod Frame read_var_value @var{variable}
+@defmethod Frame read_var @var{variable}
 Return the value of the given variable in this frame.  @code{variable} can be
 either a string or a @code{gdb.Symbol} object. @c (@pxref{Symbols In Python}).
 @end defmethod
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index 008e5dd..f07696e 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -33,7 +33,7 @@ class FrameWrapper:
 
         stream.write (sym.print_name + "=")
         try:
-            val = self.frame.read_var_value (sym)
+            val = self.frame.read_var (sym)
             if val != None:
                 val = str (val)
         # FIXME: would be nice to have a more precise exception here.
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 1729717..c98dc39 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -391,13 +391,13 @@ frapy_find_sal (PyObject *self, PyObject *args)
   return sal_obj;
 }
 
-/* Implementation of gdb.Frame.read_var_value (self, variable) -> gdb.Value.
+/* Implementation of gdb.Frame.read_var (self, variable) -> gdb.Value.
    Returns the value of the given variable in this frame.  The argument can be
    either a gdb.Symbol or a string.  Returns None if GDB can't find the
    specified variable.  */
 
 static PyObject *
-frapy_read_var_value (PyObject *self, PyObject *args)
+frapy_read_var (PyObject *self, PyObject *args)
 {
   struct frame_info *frame;
   PyObject *sym_obj;
@@ -645,8 +645,8 @@ Return the frame immetidaely newer (inner) to this frame." },
   { "find_sal", frapy_find_sal, METH_NOARGS,
     "find_sal () -> gdb.Symtab_and_line.\n\
 Return the frame's symtab and line." },
-  { "read_var_value", frapy_read_var_value, METH_VARARGS,
-    "read_var_value (variable) -> gdb.Value.\n\
+  { "read_var", frapy_read_var, METH_VARARGS,
+    "read_var (variable) -> gdb.Value.\n\
 Return the value of the variable in this frame." },
   {NULL}  /* Sentinel */
 };
diff --git a/gdb/testsuite/gdb.python/find.exp b/gdb/testsuite/gdb.python/find.exp
index a7dad97..dd9aabc 100644
--- a/gdb/testsuite/gdb.python/find.exp
+++ b/gdb/testsuite/gdb.python/find.exp
@@ -90,7 +90,7 @@ set two_patterns_found "${newline}.${dec_number}L, ${dec_number}L]"
 # Test string pattern.
 
 gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int8_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 
@@ -128,7 +128,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, \['a', 'a'\], max_coun
 # Test 16-bit pattern.
 
 gdb_test "set int16_search_buf\[10\] = 0x1234" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int16_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int16_t) 0x1234')" "" ""
@@ -142,7 +142,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 # Test 32-bit pattern.
 
 gdb_test "set int32_search_buf\[10\] = 0x12345678" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int32_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int32_t) 0x12345678')" "" ""
@@ -155,7 +155,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 # Test 64-bit pattern.
 
 gdb_test "set int64_search_buf\[10\] = 0xfedcba9876543210LL" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('int64_search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')" "" ""
 gdb_test "py start_addr = search_buf.address ()" "" ""
 gdb_test "py length = search_buf.type ().sizeof ()" "" ""
 gdb_test "py pattern = gdb.parse_and_eval ('(int64_t) 0xfedcba9876543210LL')" "" ""
@@ -170,7 +170,7 @@ gdb_test "py print gdb.search_memory (start_addr, length, pattern)" \
 gdb_test "set *(int8_t*) &search_buf\[10\] = 0x62" "" ""
 gdb_test "set *(int16_t*) &search_buf\[11\] = 0x6363" "" ""
 gdb_test "set *(int32_t*) &search_buf\[13\] = 0x64646464" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var_value ('search_buf')" "" ""
+gdb_test "py search_buf = gdb.selected_frame ().read_var ('search_buf')" "" ""
 gdb_test "py start_addr = search_buf\[0\].address ()" "" ""
 gdb_test "py pattern1 = gdb.parse_and_eval ('(int8_t) 0x62')" "" ""
 gdb_test "py pattern2 = gdb.parse_and_eval ('(int16_t) 0x6363')" "" ""
@@ -187,8 +187,8 @@ set CHUNK_SIZE 16000 ;
 
 gdb_test "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678" "" ""
 gdb_test "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678" "" ""
-gdb_test "py start_addr = gdb.selected_frame ().read_var_value ('search_buf')" "" ""
-gdb_test "py length = gdb.selected_frame ().read_var_value ('search_buf_size')" "" ""
+gdb_test "py start_addr = gdb.selected_frame ().read_var ('search_buf')" "" ""
+gdb_test "py length = gdb.selected_frame ().read_var ('search_buf_size')" "" ""
 
 gdb_test "py print gdb.search_memory (start_addr, length, 0x12345678, 4)" \
   "${two_patterns_found}" "search spanning large range"
diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp
index f62f63d..083fa90 100644
--- a/gdb/testsuite/gdb.python/python-frame.exp
+++ b/gdb/testsuite/gdb.python/python-frame.exp
@@ -81,10 +81,10 @@ gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc"
 gdb_test "python print 'result =', f0.addr_in_block ()" " = \[0-9\]+" "test Frame.addr_in_block"
 gdb_test "python print 'result =', f0.older ().equals (f1)" " = True" "test Frame.older"
 gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer"
-gdb_test "python print 'result =', f0.read_var_value ('b')" \
+gdb_test "python print 'result =', f0.read_var ('b')" \
   "ValueError: variable 'b' not found.*Error while executing Python code." \
-  "test Frame.read_var_value - error"
-gdb_test "python print 'result =', f0.read_var_value ('a')" " = 1" "test Frame.read_var_value - success"
+  "test Frame.read_var - error"
+gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success"
 
 gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame"
 gdb_test "python print 'result =', gdb.selected_frame ().equals (f1)" " = True" "test gdb.selected_frame"


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-03 21:45 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-03 21:45 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  fd3ac4e44355bf7ebfd9e2719e67c1b888b87070 (commit)
       via  f3ec9b4195a8b4b4de2c513841f469553d9f3b38 (commit)
       via  e906c13419e917c520586e8ae04a396bc3018395 (commit)
       via  75c9f663904378be08bae1172f61204b2c0ec5ca (commit)
       via  258d034209fdf76c6d9c1508fcabe8e98eab8e97 (commit)
      from  01fcb90a5cfae1933dd18268f086ba150244d0d4 (commit)

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

- Log -----------------------------------------------------------------
commit fd3ac4e44355bf7ebfd9e2719e67c1b888b87070
Merge: 01fcb90a5cfae1933dd18268f086ba150244d0d4 f3ec9b4195a8b4b4de2c513841f469553d9f3b38
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Mar 3 22:45:08 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/python-frame.c |   40 ++++++++++++++++++++++++++++------------
 gdb/python/python.c       |   17 +++++++++++------
 gdb/varobj.c              |   17 ++++++++++++++++-
 3 files changed, 55 insertions(+), 19 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 7305199..1729717 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -612,26 +612,42 @@ gdbpy_initialize_frames (void)
 \f
 
 static PyMethodDef frame_object_methods[] = {
-  { "equals", frapy_equal_p, METH_VARARGS, "Compare frames." },
+  { "equals", frapy_equal_p, METH_VARARGS,
+    "equals (frame) -> Boolean.\n\
+Compare this frame to the given frame." },
   { "is_valid", frapy_is_valid, METH_NOARGS,
-    "Return true if this frame is valid, false if not." },
+    "is_valid () -> Boolean.\n\
+Return true if this frame is valid, false if not." },
   { "name", frapy_name, METH_NOARGS,
-    "Return the function name of the frame." },
-  { "type", frapy_type, METH_NOARGS, "Return the type of the frame." },
+    "name () -> String.\n\
+Return the function name of the frame, or None if it can't be determined." },
+  { "type", frapy_type, METH_NOARGS,
+    "type () -> Integer.\n\
+Return the type of the frame." },
   { "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
-    "Return the reason why it's not possible to find frames older than this." },
-  { "pc", frapy_pc, METH_NOARGS, "Return the frame's resume address." },
-  { "block", frapy_block, METH_NOARGS, "Return the frame's code block." },
+    "unwind_stop_reason () -> Integer.\n\
+Return the reason why it's not possible to find frames older than this." },
+  { "pc", frapy_pc, METH_NOARGS,
+    "pc () -> Long.\n\
+Return the frame's resume address." },
+  { "block", frapy_block, METH_NOARGS,
+    "block () -> gdb.Block.\n\
+Return the frame's code block." },
   { "addr_in_block", frapy_addr_in_block, METH_NOARGS,
-    "Return an address which falls within the frame's code block." },
+    "addr_in_block () -> Long.\n\
+Return an address which falls within the frame's code block." },
   { "older", frapy_older, METH_NOARGS,
-    "Return the frame immediately older (outer) to this frame." },
+    "older () -> gdb.Frame.\n\
+Return the frame immediately older (outer) to this frame." },
   { "newer", frapy_newer, METH_NOARGS,
-    "Return the frame immetidaely newer (inner) to this frame." },
+    "newer () -> gdb.Frame.\n\
+Return the frame immetidaely newer (inner) to this frame." },
   { "find_sal", frapy_find_sal, METH_NOARGS,
-    "Return the frame's symtab and line." },
+    "find_sal () -> gdb.Symtab_and_line.\n\
+Return the frame's symtab and line." },
   { "read_var_value", frapy_read_var_value, METH_VARARGS,
-    "Return the value of the variable in this frame." },
+    "read_var_value (variable) -> gdb.Value.\n\
+Return the value of the variable in this frame." },
   {NULL}  /* Sentinel */
 };
 
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 18578f0..554b2bc 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1862,13 +1862,17 @@ static PyMethodDef GdbMethods[] =
     "Return a sequence of all loaded objfiles." },
 
   { "frames", gdbpy_frames, METH_NOARGS,
-    "Return a tuple of all frame objects." },
+    "frames () -> (gdb.Frame, ...).\n\
+Return a tuple of all frame objects." },
   { "newest_frame", gdbpy_newest_frame, METH_NOARGS,
-    "Return the newest frame object." },
+    "newest_frame () -> gdb.Frame.\n\
+Return the newest frame object." },
   { "selected_frame", gdbpy_selected_frame, METH_NOARGS,
-    "Return the selected frame object." },
-  { "frame_stop_reason_string", gdbpy_frame_stop_reason_string,
-    METH_VARARGS, "Return a string explaining unwind stop reason." },
+    "selected_frame () -> gdb.Frame.\n\
+Return the selected frame object." },
+  { "frame_stop_reason_string", gdbpy_frame_stop_reason_string, METH_VARARGS,
+    "stop_reason_string (Integer) -> String.\n\
+Return a string explaining unwind stop reason." },
 
   { "lookup_symbol", (PyCFunction) gdbpy_lookup_symbol,
     METH_VARARGS | METH_KEYWORDS,
@@ -1877,7 +1881,8 @@ Return a tuple with the symbol corresponding to the given name (or None) and\n\
 a boolean indicating if name is a field of the current implied argument\n\
 `this' (when the current language is object-oriented)." },
   { "solib_address", gdbpy_solib_address, METH_VARARGS,
-    "Return shared library holding a given address, or None." },
+    "solib_address (Long) -> String.\n\
+Return the name of the shared library holding a given address, or None." },
 
   { "find_pc_function", gdbpy_find_pc_function, METH_VARARGS,
     "Return the function containing the given pc value, or None." },
diff --git a/gdb/varobj.c b/gdb/varobj.c
index d18f6e7..1237c96 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -229,6 +229,8 @@ static void free_variable (struct varobj *var);
 
 static struct cleanup *make_cleanup_free_variable (struct varobj *var);
 
+static struct cleanup *make_cleanup_uninstall_variable (struct varobj *var);
+
 static struct type *get_type (struct varobj *var);
 
 static struct type *get_value_type (struct varobj *var);
@@ -605,6 +607,7 @@ varobj_create (char *objname,
 	  do_cleanups (old_chain);
 	  return NULL;
 	}
+      make_cleanup_uninstall_variable (var);
     }
 
   install_default_visualizer (var);
@@ -1451,7 +1454,7 @@ install_default_visualizer (struct varobj *var)
   install_visualizer (var, pretty_printer);
   do_cleanups (cleanup);
 #else
-  error ("Python support required");
+  /* No error is right as this function is inserted just as a hook.  */
 #endif
 }
 
@@ -1996,6 +1999,18 @@ make_cleanup_free_variable (struct varobj *var)
   return make_cleanup (do_free_variable_cleanup, var);
 }
 
+static void
+do_uninstall_variable_cleanup (void *var)
+{
+  uninstall_variable (var);
+}
+
+static struct cleanup *
+make_cleanup_uninstall_variable (struct varobj *var)
+{
+  return make_cleanup (do_uninstall_variable_cleanup, var);
+}
+
 /* This returns the type of the variable. It also skips past typedefs
    to return the real type of the variable.
 


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-02 22:55 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-02 22:55 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  8cc3753a9aad85bf53bef54c04334c60d16cb251 (commit)
       via  0e14f16bcca6dcff35ca4c23f71dcfc0a221acbc (commit)
      from  cec79ce49870fcc1a6ff3307a398c57629def724 (commit)

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

- Log -----------------------------------------------------------------
commit 8cc3753a9aad85bf53bef54c04334c60d16cb251
Merge: cec79ce49870fcc1a6ff3307a398c57629def724 0e14f16bcca6dcff35ca4c23f71dcfc0a221acbc
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Mar 2 23:55:22 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/python/python-membuf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

First 500 lines of diff:
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index 04bf3b4..57836f9 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -126,7 +126,7 @@ mbpy_str (PyObject *self)
   membuf_object *membuf_obj = (membuf_object *) self;
 
   return PyString_FromFormat ("memory buffer for address %p, %u bytes long",
-			      (void *) membuf_obj->addr,
+			      (void *) (uintptr_t) membuf_obj->addr,
 			      (unsigned int) membuf_obj->length);
 }
 


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-03-01 14:38 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-03-01 14:38 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  181911192955f46beb536919ea096b83b8ec5d75 (commit)
       via  ebd9eefcf0e56102c40cfd104eb1c290526b3f51 (commit)
      from  488cc88b330c806d003251b40d89800d2a7c6d84 (commit)

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

- Log -----------------------------------------------------------------
commit 181911192955f46beb536919ea096b83b8ec5d75
Merge: 488cc88b330c806d003251b40d89800d2a7c6d84 ebd9eefcf0e56102c40cfd104eb1c290526b3f51
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Mar 1 15:13:30 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer
    
    Conflicts:
    	gdb/configure
    
    There removals:
    GDB_DATADIR_PATH
    GDB_DATADIR_RELOCATABLE: Remove.
    configure --with-gdb-datadir, gdb_datadir, gdb.datadir
    
    were not imported as gdb-data-dir is still in use by [catch-syscall].

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

Summary of changes:
 gdb/Makefile.in     |   23 +++++++++++++++++------
 gdb/config.in       |    3 +++
 gdb/configure       |   21 +++++++++++++++++++--
 gdb/configure.ac    |    9 ++++++++-
 gdb/python/python.c |   17 +++++++----------
 5 files changed, 54 insertions(+), 19 deletions(-)

First 500 lines of diff:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 716884d..951ade8 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -177,6 +177,8 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
 # Did the user give us a --with-gdb-datadir option?
 GDB_DATADIR_PATH = @GDB_DATADIR_PATH@
 
+GDB_PYTHONDIR_PATH = @GDB_PYTHONDIR_PATH@
+
 # Helper code from gnulib.
 LIBGNU = gnulib/libgnu.a
 INCGNU = -I$(srcdir)/gnulib -Ignulib
@@ -1978,22 +1980,31 @@ PY_FILES = gdb/FrameIterator.py gdb/command/alias.py \
     gdb/command/pahole.py gdb/command/__init__.py \
     gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \
     gdb/libstdcxx/v6/printers.py gdb/libstdcxx/v6/__init__.py \
-    gdb/libstdcxx/__init__.py gdb/function/caller_is.py	\
+    gdb/libstdcxx/__init__.py gdb/function/caller_is.py \
     gdb/function/in_scope.py gdb/function/__init__.py gdb/backtrace.py \
     gdb/__init__.py
 
 # Install the Python library.  Python library files go under
-# $(GDB_DATADIR_PATH)/python.
+# $(GDB_PYTHONDIR_PATH)/python.
 install-python:
 	files='$(PY_FILES)'; for file in $$files; do \
 	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
-	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR_PATH)/python/$$dir; \
-	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_DATADIR_PATH)/python/$$file; \
+	  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir; \
+	  $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
 	done
 
-# Brute force.
+# Other packages may have their files installed in $(GDB_PYTHONDIR_PATH).
 uninstall-python:
-	rm -rf $(DESTDIR)/$(GDB_DATADIR_PATH)/python
+	rm -rf $(DESTDIR)/$(GDB_PYTHONDIR_PATH)/python
+	files='$(PY_FILES)'; for file in $$files; do \
+	  dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  rm -f $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \
+	  while test "x$$file" != "x$$dir"; do \
+	    rmdir 2>/dev/null "$(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir"; \
+	    file="$$dir"; \
+	    dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \
+	  done \
+	done
 
 #
 # Dependency tracking.  Most of this is conditional on GNU Make being
diff --git a/gdb/config.in b/gdb/config.in
index 3ef5bbd..1cfb12b 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -66,6 +66,9 @@
 /* Define to the default OS ABI for this configuration. */
 #undef GDB_OSABI_DEFAULT
 
+/* Base directory for GDB Python modules. */
+#undef GDB_PYTHONDIR_PATH
+
 /* Define to 1 if you have `alloca', as a function or macro. */
 #undef HAVE_ALLOCA
 
diff --git a/gdb/configure b/gdb/configure
index 9eb9a8d..aa1dd84 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite"
 ac_subdirs_all="$ac_subdirs_all gdbtk"
 ac_subdirs_all="$ac_subdirs_all multi-ice"
 ac_subdirs_all="$ac_subdirs_all gdbserver"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT GDB_PYTHONDIR_PATH PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS'
 ac_subst_files='host_makefile_frag'
 ac_pwd=`pwd`
 
@@ -11424,6 +11424,7 @@ echo $ECHO_N "checking whether to use python... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: $with_python" >&5
 echo "${ECHO_T}$with_python" >&6
 
+GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   { echo "$as_me:$LINENO: WARNING: python support disabled; some features may be unavailable." >&5
 echo "$as_me: WARNING: python support disabled; some features may be unavailable." >&2;}
@@ -11655,7 +11656,20 @@ _ACEOF
 
     fi
   fi
-  if test ${have_libpython} = no; then
+  if test ${have_libpython} != no; then
+    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
+
+  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+  ac_define_dir=`eval echo $GDB_PYTHONDIR_PATH`
+  ac_define_dir=`eval echo $ac_define_dir`
+
+cat >>confdefs.h <<_ACEOF
+#define GDB_PYTHONDIR_PATH "$ac_define_dir"
+_ACEOF
+
+
+  else
     case "${with_python}" in
     yes)
       { { echo "$as_me:$LINENO: error: python is missing or unusable" >&5
@@ -11677,6 +11691,8 @@ echo "$as_me: error: no usable python found at ${with_python}" >&2;}
   fi
 fi
 
+
+PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -22006,6 +22022,7 @@ s,@READLINE_CFLAGS@,$READLINE_CFLAGS,;t t
 s,@HAVE_LIBEXPAT@,$HAVE_LIBEXPAT,;t t
 s,@LIBEXPAT@,$LIBEXPAT,;t t
 s,@LTLIBEXPAT@,$LTLIBEXPAT,;t t
+s,@GDB_PYTHONDIR_PATH@,$GDB_PYTHONDIR_PATH,;t t
 s,@PYTHON_CFLAGS@,$PYTHON_CFLAGS,;t t
 s,@ALLOCA@,$ALLOCA,;t t
 s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 5892c59..857a7cd 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -617,6 +617,7 @@ AC_ARG_WITH(python,
 AC_MSG_CHECKING([whether to use python])
 AC_MSG_RESULT([$with_python])
 
+GDB_PYTHONDIR_PATH=
 if test "${with_python}" = no; then
   AC_MSG_WARN([python support disabled; some features may be unavailable.])
   have_libpython=no
@@ -659,7 +660,11 @@ else
       AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
     fi
   fi
-  if test ${have_libpython} = no; then
+  if test ${have_libpython} != no; then
+    GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`"
+    AC_DEFINE_DIR(GDB_PYTHONDIR_PATH, GDB_PYTHONDIR_PATH, 
+		  [Base directory for GDB Python modules.])
+  else
     case "${with_python}" in
     yes)
       AC_MSG_ERROR([python is missing or unusable])
@@ -675,7 +680,9 @@ else
     LIBS=$save_LIBS
   fi
 fi
+AC_SUBST(GDB_PYTHONDIR_PATH)
 
+PYTHON_CFLAGS=
 if test "${have_libpython}" = yes; then
   AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
   CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
diff --git a/gdb/python/python.c b/gdb/python/python.c
index a38ea92..18578f0 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1768,8 +1768,6 @@ Enables or disables auto-loading of Python code when an object is opened."),
   PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version);
   PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name);
   PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name);
-  if (gdb_datadir)
-    PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir);
 
   gdbpy_initialize_values ();
   gdbpy_initialize_breakpoints ();
@@ -1821,14 +1819,13 @@ class GdbOutputFile:\n\
 \n\
 sys.stderr = GdbOutputFile()\n\
 sys.stdout = GdbOutputFile()\n\
-if hasattr (gdb, 'datadir'):\n\
-  gdb.pythonlibdir = gdb.datadir + '/python'\n\
-  sys.path.insert(0, gdb.pythonlibdir)\n\
-  gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\
-  from os.path import exists\n\
-  ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\
-  if exists (ipy):\n\
-    execfile (ipy)\n\
+# FIXME: gdb.pythonlibdir is deprecated as it is just the standard libdir.\n\
+gdb.pythonlibdir = '" GDB_PYTHONDIR_PATH "'\n\
+gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\
+from os.path import exists\n\
+ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\
+if exists (ipy):\n\
+  execfile (ipy)\n\
 ");
 
   /* Release the GIL while gdb runs.  */


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-02-28 19:26 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-02-28 19:26 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  4070e63dc60ffe868c9b90f3c97ee57cd7ec0287 (commit)
       via  8cfb53175964b36c34f54147a3ea057c9a7fd728 (commit)
       via  9f2e8a3ed0db5ebf8e1e25e691b9826010e5c005 (commit)
       via  3d2d45e9b846b6754a8215a85e3ac72c3c0b73bf (commit)
       via  ebadcf6e954061122d1c6d0a1e79de5cf23b85b8 (commit)
       via  0686961df93c7c2d16b6ae25d78de382037a2f8c (commit)
       via  acd14fd258b498d2faa5dc34751c43da5c8e476f (commit)
       via  960557011f37ee49ac8109c9090e1f8ac5df41a9 (commit)
       via  73864473aa5f3f47d681c6a1d95e04c2ecff2180 (commit)
       via  745c2e91d30f0ee78c2a9e2779b807f382be51d1 (commit)
       via  8d7cda5302bef3e53337906e3ac3f5dffaa372ca (commit)
       via  2206b86f85f03bf20dbe642703bc02ad58a35e61 (commit)
       via  6dd3e965ad875563547f5d36ae74e3940050c706 (commit)
       via  d19d9fde47e23944526327e3c7942b93c4ac4277 (commit)
      from  fe2f5da6755411c681cb4c5adb6d8b9b91e316a3 (commit)

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

- Log -----------------------------------------------------------------
commit 4070e63dc60ffe868c9b90f3c97ee57cd7ec0287
Merge: 9f2e8a3ed0db5ebf8e1e25e691b9826010e5c005 8cfb53175964b36c34f54147a3ea057c9a7fd728
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sat Feb 28 20:25:59 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

commit 9f2e8a3ed0db5ebf8e1e25e691b9826010e5c005
Merge: 3d2d45e9b846b6754a8215a85e3ac72c3c0b73bf 0686961df93c7c2d16b6ae25d78de382037a2f8c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sat Feb 28 20:18:53 2009 +0100

    Merge commit 'origin/archer-jankratochvil-vla' into archer

commit 3d2d45e9b846b6754a8215a85e3ac72c3c0b73bf
Merge: fe2f5da6755411c681cb4c5adb6d8b9b91e316a3 ebadcf6e954061122d1c6d0a1e79de5cf23b85b8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sat Feb 28 20:18:40 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/doc/gdb.texinfo                     |   16 +++-
 gdb/gdbtypes.c                          |   34 +++-----
 gdb/python/python-cmd.c                 |   12 ++-
 gdb/python/python-frame.c               |  136 +++++++++++++++++++++++++------
 gdb/python/python-internal.h            |    2 +-
 gdb/python/python-symbol.c              |   18 +++--
 gdb/python/python-value.c               |   16 +++--
 gdb/python/python.c                     |   37 +++++---
 gdb/testsuite/gdb.python/find.exp       |   43 +++++++---
 gdb/testsuite/gdb.python/python-cmd.exp |   26 ++++++
 10 files changed, 241 insertions(+), 99 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index d0e68d5..c506fb7 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18244,6 +18244,14 @@ auto-loading is disabled.
 @cindex python api
 @cindex programming in python
 
+You can get quick online help for @value{GDBN}'s Python API by issuing
+the command @w{@kbd{python help (gdb)}}.
+
+Functions and methods which have two or more optional arguments allow
+them to be specified using keyword syntax.  This allows passing some
+optional arguments while skipping others.  Example:
+@w{@code{gdb.some_function ('foo', bar = 1, baz = 2)}}.
+
 @cindex python stdout
 @cindex python pagination
 At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
@@ -18563,7 +18571,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the
 value pointed to by @code{foo}.
 @end defmethod
 
-@defmethod Value string @r{[}encoding @r{[}errors@r{]}@r{]}
+@defmethod Value string @r{[}encoding@r{]} @r{[}errors@r{]}
 If this @code{gdb.Value} represents a string, then this method
 converts the contents to a Python string.  Otherwise, this method will
 throw an exception.
@@ -19063,7 +19071,7 @@ You can implement new @value{GDBN} CLI commands in Python.  A CLI
 command is implemented using an instance of the @code{gdb.Command}
 class, most commonly using a subclass.
 
-@defmethod Command __init__ name @var{command-class} @r{[}@var{completer-class} @var{prefix}@r{]}
+@defmethod Command __init__ name @var{command_class} @r{[}@var{completer_class}@r{]} @r{[}@var{prefix}@r{]}
 The object initializer for @code{Command} registers the new command
 with @value{GDBN}.  This initializer is normally invoked from the
 subclass' own @code{__init__} method.
@@ -19075,11 +19083,11 @@ an exception is raised.
 
 There is no support for multi-line commands.
 
-@var{command-class} should be one of the @samp{COMMAND_} constants
+@var{command_class} should be one of the @samp{COMMAND_} constants
 defined below.  This argument tells @value{GDBN} how to categorize the
 new command in the help system.
 
-@var{completer-class} is an optional argument.  If given, it should be
+@var{completer_class} is an optional argument.  If given, it should be
 one of the @samp{COMPLETE_} constants defined below.  This argument
 tells @value{GDBN} how to perform completion for this command.  If not
 given, @value{GDBN} will attempt to complete using the object's
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index e6190cf..b3217fb 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3504,16 +3504,14 @@ type_incref (struct type *type)
 }
 
 /* A traverse callback for type_refc_table which removes any entry
-   whose reference count pointer is REFC.  REFC may be NULL to delete all the
-   unused entries - use such cleanup only in the GDB idle state as GDB code
-   does not necessarily reference county TYPEs during its processing.  */
+   whose reference count is zero (unused entry).  */
 
 static int
-type_refc_remove (void **slot, void *refc)
+type_refc_remove (void **slot, void *unused)
 {
   struct type_refc_entry *entry = *slot;
 
-  if (entry->refc == refc || (refc == NULL && *entry->refc == 0))
+  if (*entry->refc == 0)
     {
       delete_type (entry->type);
 
@@ -3524,8 +3522,10 @@ type_refc_remove (void **slot, void *refc)
   return 1;
 }
 
-/* Decrement the reference count for TYPE.  If TYPE has no more
-   references, delete it.  */
+/* Decrement the reference count for TYPE.  Even if TYPE has no more
+   references still do not delete it as callers may hold pointers to types
+   dynamically generated by check_typedef where type_incref is never called.
+   Always rely on the free_all_types garbage collector.  */
 
 void
 type_decref (struct type *type)
@@ -3538,24 +3538,14 @@ type_decref (struct type *type)
   entry.type = type;
   found = htab_find (type_refc_table, &entry);
   gdb_assert (found);
+  gdb_assert (found->refc > 0);
   --*(found->refc);
-  if (*(found->refc) == 0)
-    {
-      void *refc = found->refc;
-
-      /* Clear all table entries referring to this count.  CHECK: Should not be
-         the deletion delayed till free_all_types?  */
-      delete_type_begin ();
-      htab_traverse (type_refc_table, type_refc_remove, refc);
-      delete_type_finish ();
-
-      /* Delete the reference count itself.  */
-      xfree (refc);
-    }
 }
 
-/* Free all the types that have been allocated (except for those released).
-   Called after each command, successful or not.  */
+/* Free all the types that have been allocated and that are not used according
+   to type_refc_entry->refc.  Called after each command, successful or not.
+   Use this cleanup only in the GDB idle state as GDB code does not necessarily
+   use type_incref / type_decref during temporary use of types.  */
 
 void
 free_all_types (void)
diff --git a/gdb/python/python-cmd.c b/gdb/python/python-cmd.c
index 90cc780..e6e3ac0 100644
--- a/gdb/python/python-cmd.c
+++ b/gdb/python/python-cmd.c
@@ -337,16 +337,16 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
 
 /* Object initializer; sets up gdb-side structures for command.
 
-   Use: __init__(NAME, CMDCLASS, [COMPLETERCLASS, [PREFIX]]).
+   Use: __init__(NAME, COMMAND_CLASS, [COMPLETER_CLASS, [PREFIX]]).
 
    NAME is the name of the command.  It may consist of multiple words,
    in which case the final word is the name of the new command, and
    earlier words must be prefix commands.
 
-   CMDCLASS is the kind of command.  It should be one of the COMMAND_*
+   COMMAND_CLASS is the kind of command.  It should be one of the COMMAND_*
    constants defined in the gdb module.
 
-   COMPLETERCLASS is the kind of completer.  If not given, the
+   COMPLETER_CLASS is the kind of completer.  If not given, the
    "complete" method will be used.  Otherwise, it should be one of the
    COMPLETE_* constants defined in the gdb module.
 
@@ -357,7 +357,7 @@ gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list,
    
 */
 static int
-cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
+cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 {
   cmdpy_object *obj = (cmdpy_object *) self;
   char *name;
@@ -367,6 +367,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
   volatile struct gdb_exception except;
   struct cmd_list_element **cmd_list;
   char *cmd_name, *pfx_name;
+  static char *keywords[] = { "name", "command_class", "completer_class",
+			      "prefix", NULL };
   PyObject *is_prefix = NULL;
   int cmp;
 
@@ -379,7 +381,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kwds)
       return -1;
     }
 
-  if (! PyArg_ParseTuple (args, "si|iO", &name, &cmdtype,
+  if (! PyArg_ParseTupleAndKeywords (args, kw, "si|iO", keywords, &name, &cmdtype,
 			  &completetype, &is_prefix))
     return -1;
 
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index c2224cf..ef1c178 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -1,6 +1,6 @@
 /* Python interface to stack frames
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -54,6 +54,9 @@ typedef struct {
 
 static PyTypeObject frame_object_type;
 
+/* Returns the frame_info object corresponding to the given Python Frame
+   object.  If the frame doesn't exist anymore (the frame id doesn't
+   correspond to any frame in the inferior), returns NULL.  */
 
 static struct frame_info *
 frame_object_to_frame_info (frame_object *frame_obj)
@@ -70,6 +73,9 @@ frame_object_to_frame_info (frame_object *frame_obj)
   return frame;
 }
 
+/* Called by the Python interpreter to obtain string representation
+   of the object.  */
+
 static PyObject *
 frapy_str (PyObject *self)
 {
@@ -87,6 +93,10 @@ frapy_str (PyObject *self)
   return result;
 }
 
+/* Implementation of gdb.Frame.is_valid (self) -> Boolean.
+   Returns True if the frame corresponding to the frame_id of this
+   object still exists in the inferior.  */
+
 static PyObject *
 frapy_is_valid (PyObject *self, PyObject *args)
 {
@@ -99,6 +109,8 @@ frapy_is_valid (PyObject *self, PyObject *args)
   Py_RETURN_TRUE;
 }
 
+/* Implementation of gdb.Frame.equals (self, other) -> Boolean. */
+
 static PyObject *
 frapy_equal_p (PyObject *self, PyObject *args)
 {
@@ -122,6 +134,9 @@ frapy_equal_p (PyObject *self, PyObject *args)
   Py_RETURN_FALSE;
 }
 
+/* Implementation of gdb.Frame.name (self) -> String.
+   Returns the name of the function corresponding to this frame.  */
+
 static PyObject *
 frapy_name (PyObject *self, PyObject *args)
 {
@@ -150,6 +165,9 @@ frapy_name (PyObject *self, PyObject *args)
   return result;
 }
 
+/* Implementation of gdb.Frame.type (self) -> Integer.
+   Returns the frame type, namely one of the gdb.*_FRAME constants.  */
+
 static PyObject *
 frapy_type (PyObject *self, PyObject *args)
 {
@@ -168,6 +186,9 @@ frapy_type (PyObject *self, PyObject *args)
   return PyInt_FromLong (type);
 }
 
+/* Implementation of gdb.Frame.unwind_stop_reason (self) -> Integer.
+   Returns one of the gdb.FRAME_UNWIND_* constants.  */
+
 static PyObject *
 frapy_unwind_stop_reason (PyObject *self, PyObject *args)
 {
@@ -186,6 +207,9 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args)
   return PyInt_FromLong (stop_reason);
 }
 
+/* Implementation of gdb.Frame.pc (self) -> Long.
+   Returns the frame's resume address.  */
+
 static PyObject *
 frapy_pc (PyObject *self, PyObject *args)
 {
@@ -204,6 +228,9 @@ frapy_pc (PyObject *self, PyObject *args)
   return PyLong_FromUnsignedLongLong (pc);
 }
 
+/* Implementation of gdb.Frame.block (self) -> gdb.Block.
+   Returns the frame's code block.  */
+
 static PyObject *
 frapy_block (PyObject *self, PyObject *args)
 {
@@ -225,6 +252,10 @@ frapy_block (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+
+/* Implementation of gdb.Frame.addr_in_block (self) -> Long.
+   Returns an address which falls within the frame's code block.  */
+
 static PyObject *
 frapy_addr_in_block (PyObject *self, PyObject *args)
 {
@@ -243,6 +274,9 @@ frapy_addr_in_block (PyObject *self, PyObject *args)
   return PyLong_FromUnsignedLongLong (pc);
 }
 
+/* Convert a frame_info struct to a Python Frame object.
+   Sets a Python exception and returns NULL on error.  */
+
 static frame_object *
 frame_info_to_frame_object (struct frame_info *frame)
 {
@@ -276,6 +310,10 @@ frame_info_to_frame_object (struct frame_info *frame)
   return frame_obj;
 }
 
+/* Implementation of gdb.Frame.older (self) -> gdb.Frame.
+   Returns the frame immediately older (outer) to this frame, or None if
+   there isn't one.  */
+
 static PyObject *
 frapy_older (PyObject *self, PyObject *args)
 {
@@ -301,6 +339,10 @@ frapy_older (PyObject *self, PyObject *args)
   return prev_obj;
 }
 
+/* Implementation of gdb.Frame.newer (self) -> gdb.Frame.
+   Returns the frame immediately newer (inner) to this frame, or None if
+   there isn't one.  */
+
 static PyObject *
 frapy_newer (PyObject *self, PyObject *args)
 {
@@ -326,6 +368,9 @@ frapy_newer (PyObject *self, PyObject *args)
   return next_obj;
 }
 
+/* Implementation of gdb.Frame.find_sal (self) -> gdb.Symtab_and_line.
+   Returns the frame's symtab and line.  */
+
 static PyObject *
 frapy_find_sal (PyObject *self, PyObject *args)
 {
@@ -346,6 +391,11 @@ frapy_find_sal (PyObject *self, PyObject *args)
   return sal_obj;
 }
 
+/* Implementation of gdb.Frame.read_var_value (self, variable) -> gdb.Value.
+   Returns the value of the given variable in this frame.  The argument can be
+   either a gdb.Symbol or a string.  Returns None if GDB can't find the
+   specified variable.  */
+
 static PyObject *
 frapy_read_var_value (PyObject *self, PyObject *args)
 {
@@ -355,13 +405,33 @@ frapy_read_var_value (PyObject *self, PyObject *args)
   struct value *val = NULL;
   volatile struct gdb_exception except;
 
-  if (!PyArg_ParseTuple (args, "O!", &symbol_object_type, &sym_obj))
+  if (!PyArg_ParseTuple (args, "O", &sym_obj))
     return NULL;
 
-  var = symbol_object_to_symbol (sym_obj);
-  if (! var)
+  if (PyObject_TypeCheck (sym_obj, &symbol_object_type))
+    var = symbol_object_to_symbol (sym_obj);
+  else if (gdbpy_is_string (sym_obj))
     {
-      PyErr_SetString (PyExc_RuntimeError, "second argument must be symbol");
+      char *var_name;
+      struct block *block;
+      volatile struct gdb_exception except;
+
+      TRY_CATCH (except, RETURN_MASK_ALL)
+	{
+	  struct block *block;
+
+	  FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+
+	  block = block_for_pc (get_frame_address_in_block (frame));
+	  var = lookup_symbol (python_string_to_target_string (sym_obj), block,
+			       VAR_DOMAIN, NULL);
+	}
+      GDB_PY_HANDLE_EXCEPTION (except);
+    }
+  else
+    {
+      PyErr_SetString (PyExc_TypeError,
+		       _("argument must be a symbol or string"));
       return NULL;
     }
 
@@ -379,6 +449,9 @@ frapy_read_var_value (PyObject *self, PyObject *args)
   Py_RETURN_NONE;
 }
 
+/* Implementation of gdb.frames () -> (gdb.Frame, ...).
+   Returns a tuple of all frame objects.  */
+
 PyObject *
 gdbpy_frames (PyObject *self, PyObject *args)
 {
@@ -429,6 +502,9 @@ gdbpy_frames (PyObject *self, PyObject *args)
   return tuple;
 }
 
+/* Implementation of gdb.newest_frame () -> gdb.Frame.
+   Returns the newest frame object.  */
+
 PyObject *
 gdbpy_newest_frame (PyObject *self, PyObject *args)
 {
@@ -446,6 +522,9 @@ gdbpy_newest_frame (PyObject *self, PyObject *args)
   return (PyObject *) frame_obj;
 }
 
+/* Implementation of gdb.selected_frame () -> gdb.Frame.
+   Returns the selected frame object.  */
+
 PyObject *
 gdbpy_selected_frame (PyObject *self, PyObject *args)
 {
@@ -463,6 +542,9 @@ gdbpy_selected_frame (PyObject *self, PyObject *args)
   return (PyObject *) frame_obj;
 }
 
+/* Implementation of gdb.stop_reason_string (Integer) -> String.
+   Return a string explaining the unwind stop reason.  */
+
 PyObject *
 gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
 {
@@ -482,6 +564,8 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
   return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
 }
 
+/* Sets up the Frame API in the gdb module.  */
+
 void
 gdbpy_initialize_frames (void)
 {
@@ -523,7 +607,7 @@ static PyMethodDef frame_object_methods[] = {
     "Return the function name of the frame." },
   { "type", frapy_type, METH_NOARGS, "Return the type of the frame." },
   { "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
-    "Return the function name of the frame." },
+    "Return the reason why it's not possible to find frames older than this." },
   { "pc", frapy_pc, METH_NOARGS, "Return the frame's resume address." },
   { "block", frapy_block, METH_NOARGS, "Return the frame's code block." },
   { "addr_in_block", frapy_addr_in_block, METH_NOARGS,
@@ -541,26 +625,26 @@ static PyMethodDef frame_object_methods[] = {
 
 static PyTypeObject frame_object_type = {
   PyObject_HEAD_INIT (NULL)
-  0,				  /*ob_size*/
-  "gdb.Frame",			  /*tp_name*/
-  sizeof (frame_object),	  /*tp_basicsize*/
-  0,				  /*tp_itemsize*/
-  0,				  /*tp_dealloc*/
-  0,				  /*tp_print*/
-  0,				  /*tp_getattr*/
-  0,				  /*tp_setattr*/
-  0,				  /*tp_compare*/
-  0,				  /*tp_repr*/
-  0,				  /*tp_as_number*/
-  0,				  /*tp_as_sequence*/
-  0,				  /*tp_as_mapping*/
-  0,				  /*tp_hash */
-  0,				  /*tp_call*/
-  frapy_str,			  /*tp_str*/
-  0,				  /*tp_getattro*/
-  0,				  /*tp_setattro*/
-  0,				  /*tp_as_buffer*/
-  Py_TPFLAGS_DEFAULT,		  /*tp_flags*/
+  0,				  /* ob_size */
+  "gdb.Frame",			  /* tp_name */
+  sizeof (frame_object),	  /* tp_basicsize */
+  0,				  /* tp_itemsize */
+  0,				  /* tp_dealloc */
+  0,				  /* tp_print */
+  0,				  /* tp_getattr */
+  0,				  /* tp_setattr */
+  0,				  /* tp_compare */
+  0,				  /* tp_repr */
+  0,				  /* tp_as_number */
+  0,				  /* tp_as_sequence */
+  0,				  /* tp_as_mapping */
+  0,				  /* tp_hash  */
+  0,				  /* tp_call */
+  frapy_str,			  /* tp_str */
+  0,				  /* tp_getattro */
+  0,				  /* tp_setattro */
+  0,				  /* tp_as_buffer */
+  Py_TPFLAGS_DEFAULT,		  /* tp_flags */
   "GDB frame object",		  /* tp_doc */
   0,				  /* tp_traverse */
   0,				  /* tp_clear */
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 12422af..4aae0aa 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -78,7 +78,7 @@ PyObject *gdbpy_breakpoints (PyObject *, PyObject *);
 PyObject *gdbpy_frames (PyObject *, PyObject *);
 PyObject *gdbpy_newest_frame (PyObject *, PyObject *);
 PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *);
-PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args);
+PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw);
 PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args);
 PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args);
 PyObject *gdbpy_read_memory (PyObject *self, PyObject *args);
diff --git a/gdb/python/python-symbol.c b/gdb/python/python-symbol.c
index 223e6d3..c7fda5c 100644
--- a/gdb/python/python-symbol.c
+++ b/gdb/python/python-symbol.c
@@ -166,21 +166,23 @@ symbol_object_to_symbol (PyObject *obj)
   return ((symbol_object *) obj)->symbol;
 }
 


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


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

* [SCM]  archer: Merge commit 'origin/archer-jankratochvil-python' into archer
@ 2009-02-26 23:02 jkratoch
  0 siblings, 0 replies; 21+ messages in thread
From: jkratoch @ 2009-02-26 23:02 UTC (permalink / raw)
  To: archer-commits

The branch, archer has been updated
       via  fe2f5da6755411c681cb4c5adb6d8b9b91e316a3 (commit)
       via  8919c803a68e50c045db5b8f5f88d33c40449139 (commit)
       via  cf7156e5eb72d57a6b886dfe862705fc210f6f67 (commit)
       via  b5235efef9aa1d619d8a5defc5aa1219dff76d3d (commit)
       via  9f534e722211caffa7caef5cd11c5da2ac24f6c4 (commit)
       via  6b43f0eaec652104bcbf802d7a86869d956ce4e4 (commit)
       via  f17c887e8b4aa77c8a49885a0f8bf2dab0dba228 (commit)
      from  7fe6d46b16cab13a5243e8bb8952c666eacce40a (commit)

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

- Log -----------------------------------------------------------------
commit fe2f5da6755411c681cb4c5adb6d8b9b91e316a3
Merge: 7fe6d46b16cab13a5243e8bb8952c666eacce40a 8919c803a68e50c045db5b8f5f88d33c40449139
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Feb 27 00:01:52 2009 +0100

    Merge commit 'origin/archer-jankratochvil-python' into archer

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

Summary of changes:
 gdb/doc/gdb.texinfo                            |   69 +++++---
 gdb/python/lib/gdb/libstdcxx/v6/printers.py    |  114 ++++++++----
 gdb/python/python-internal.h                   |    6 +-
 gdb/python/python-membuf.c                     |    2 +-
 gdb/python/python-objfile.c                    |   12 +-
 gdb/python/python-type.c                       |   13 ++-
 gdb/python/python-utils.c                      |   16 ++-
 gdb/python/python.c                            |  234 +++++++++++-------------
 gdb/testsuite/gdb.python/python-prettyprint.py |   76 ++++++--
 gdb/varobj.c                                   |  108 ++++++-----
 10 files changed, 379 insertions(+), 271 deletions(-)

First 500 lines of diff:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1af44bc..d0e68d5 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18680,6 +18680,11 @@ target's @code{char} type will be an 8-bit byte.  However, on some
 unusual platforms, this type may have a different size.
 @end defmethod
 
+@defmethod Type strip_typedefs
+Return a new @code{gdb.Type} that represents the real type,
+after removing all layers of typedefs.
+@end defmethod
+
 @defmethod Type tag
 Return the tag name for this type.  The tag name is the name after
 @code{struct}, @code{union}, or @code{enum} in C; not all languages
@@ -18940,30 +18945,27 @@ convertible to @code{gdb.Value}, an exception is raised.
 
 @subsubsection Selecting Pretty-Printers
 
-The Python dictionary @code{gdb.pretty_printers} maps regular
-expressions (strings) onto constructors.  Each @code{gdb.Objfile} also
-contains a @code{pretty_printers} attribute.  A constructor, in this
-context, is a function which takes a single @code{gdb.Value} argument
-and returns a a pretty-printer conforming to the interface definition
-above.
+The Python list @code{gdb.pretty_printers} contains an array of
+functions that have been registered via addition as a pretty-printer.
+Each function will be called with a @code{gdb.Value} to be
+pretty-printed.  Each @code{gdb.Objfile} also contains a
+@code{pretty_printers} attribute.  A function on one of these lists
+takes a single @code{gdb.Value} argument and returns a pretty-printer
+object conforming to the interface definition above.  If this function
+cannot create a pretty-printer for the value, it should return
+@code{None}.
 
-When printing a value, @value{GDBN} first computes the value's
-canonical type by following typedefs, following a reference type to
-its referenced type, and removing qualifiers, such as @code{const} or
-@code{volatile}.
-
-Then, @value{GDBN} tests each regular expression against this type name.
 @value{GDBN} first checks the @code{pretty_printers} attribute of each
-@code{gdb.Objfile}; after these have been exhausted it tries the
-global @code{gdb.pretty_printers}.
-
-If a regular expression matches, then the corresponding pretty-printer
-is invoked with a @code{gdb.Value} representing the value to be
-printed.
+@code{gdb.Objfile} and iteratively calls each function in the list for
+that @code{gdb.Objfile} until it receives a pretty-printer object.
+After these @code{gdb.Objfile} have been exhausted, it tries the
+global @code{gdb.pretty-printers} list, again calling each function
+until an object is returned.
 
 The order in which the objfiles are searched is not specified.
-Similarly, the order in which the regular expressions in a given
-dictionary are tried is not specified.
+Functions are always invoked from the head of the
+@code{gdb.pretty-printers} list, and iterated over sequentially until
+the end of the list, or a printer object is returned.
 
 Here is an example showing how a @code{std::string} printer might be
 written:
@@ -18972,13 +18974,34 @@ written:
 class StdStringPrinter:
     "Print a std::string"
 
-    def __init__(self, val):
+    def __init__ (self, val):
         self.val = val
 
-    def to_string(self):
+    def to_string (self):
         return self.val['_M_dataplus']['_M_p']
 @end smallexample
 
+And here is an example showing how a lookup function for
+the printer example above might be written. 
+
+@smallexample
+def str_lookup_function (val):
+
+    lookup_tag = val.type ().tag ()
+    regex = re.compile ("^std::basic_string<char,.*>$")
+    if lookup_tag == None:
+        return None
+    if regex.match (lookup_tag):
+        return StdStringPrinter (val)
+    
+    return None
+@end smallexample
+
+The example lookup function extracts the value's type, and attempts to
+match it to a type that it can pretty-print.  If it is a type the
+printer can pretty-print, it will return a printer object.  If not, it
+returns: @code{None}.
+
 We recommend that you put your core pretty-printers into a versioned
 python package, and then restrict your auto-loaded code to idempotent
 behavior -- for example, just @code{import}s of your printer modules,
@@ -18991,7 +19014,7 @@ For example, in addition to the above, this code might appear in
 
 @smallexample
 def register_printers (objfile):
-    objfile.pretty_printers['^std::basic_string<char.*>$'] = StdStringPrinter
+    objfile.pretty_printers.add (str_lookup_function)
 @end smallexample
 
 And then the corresponding contents of the auto-load file would be:
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index 508a22d..7a77ad4 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -1,6 +1,6 @@
 # Pretty-printers for libstc++.
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# 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
@@ -17,6 +17,7 @@
 
 import gdb
 import itertools
+import re
 
 class StdPointerPrinter:
     "Print a smart pointer of some kind"
@@ -337,7 +338,16 @@ class StdBitsetPrinter:
     def children (self):
         words = self.val['_M_w']
         wtype = words.type()
-        tsize = wtype.target().sizeof()
+
+        # The _M_w member can be either an unsigned long, or an
+        # array.  This depends on the template specialization used.
+        # If it is a single long, convert to a single element list.
+        if wtype.code () == gdb.TYPE_CODE_ARRAY:
+            tsize = wtype.target ().sizeof ()
+        else:
+            words = [words]
+            tsize = wtype.sizeof () 
+
         nwords = wtype.sizeof() / tsize
         result = []
         byte = 0
@@ -548,56 +558,90 @@ class Tr1UnorderedMapPrinter:
     def display_hint (self):
         return 'map'
 
-def register_libstdcxx_printers(obj):
+def register_libstdcxx_printers (obj):
     "Register libstdc++ pretty-printers with objfile Obj."
 
     if obj == None:
         obj = gdb
 
+    obj.pretty_printers.append (lookup_function)
+
+def lookup_function (val):
+    "Look-up and return a pretty-printer that can print val."
+
+    # Get the type.
+    type = val.type ();
+
+    # If it points to a reference, get the reference.
+    if type.code () == gdb.TYPE_CODE_REF:
+        type = type.target ()
+
+    # Get the unqualified type, stripped of typedefs.
+    type = type.unqualified ().strip_typedefs ()
+
+    # Get the type name.    
+    typename = type.tag ()
+    if typename == None:
+        return None
+
+    # Iterate over local dictionary of types to determine
+    # if a printer is registered for that type.  Return an
+    # instantiation of the printer if found.
+    for function in pretty_printers_dict:
+        if function.search (typename):
+            return pretty_printers_dict[function] (val)
+        
+    # Cannot find a pretty printer.  Return None.
+    return None
+
+def build_libstdcxx_dictionary ():
     # libstdc++ objects requiring pretty-printing.
     # In order from:
     # http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html
-    obj.pretty_printers['^std::basic_string<char,.*>$'] = lambda val: StdStringPrinter(None, val)
-    obj.pretty_printers['^std::basic_string<wchar_t,.*>$'] = lambda val: StdStringPrinter(target_wide_charset, val)
-    obj.pretty_printers['^std::basic_string<char16_t,.*>$'] = lambda val: StdStringPrinter('UTF-16', val)
-    obj.pretty_printers['^std::basic_string<char32_t,.*>$'] = lambda val: StdStringPrinter('UTF-32', val)
-    obj.pretty_printers['^std::bitset<.*>$'] = StdBitsetPrinter
-    obj.pretty_printers['^std::deque<.*>$'] = StdDequePrinter
-    obj.pretty_printers['^std::list<.*>$'] = StdListPrinter
-    obj.pretty_printers['^std::map<.*>$'] = lambda val: StdMapPrinter("std::map", val)
-    obj.pretty_printers['^std::multimap<.*>$'] = lambda val: StdMapPrinter("std::multimap", val)
-    obj.pretty_printers['^std::multiset<.*>$'] = lambda val: StdSetPrinter("std::multiset", val)
-    obj.pretty_printers['^std::priority_queue<.*>$'] = lambda val: StdStackOrQueuePrinter("std::priority_queue", val)
-    obj.pretty_printers['^std::queue<.*>$'] = lambda val: StdStackOrQueuePrinter("std::queue", val)
-    obj.pretty_printers['^std::set<.*>$'] = lambda val: StdSetPrinter("std::set", val)
-    obj.pretty_printers['^std::stack<.*>$'] = lambda val: StdStackOrQueuePrinter("std::stack", val)
-    obj.pretty_printers['^std::vector<.*>$'] = StdVectorPrinter
+    pretty_printers_dict[re.compile('^std::basic_string<char,.*>$')] = lambda val: StdStringPrinter(None, val)
+    pretty_printers_dict[re.compile('^std::basic_string<wchar_t,.*>$')] = lambda val: StdStringPrinter(target_wide_charset, val)
+    pretty_printers_dict[re.compile('^std::basic_string<char16_t,.*>$')] = lambda val: StdStringPrinter('UTF-16', val)
+    pretty_printers_dict[re.compile('^std::basic_string<char32_t,.*>$')] = lambda val: StdStringPrinter('UTF-32', val)
+    pretty_printers_dict[re.compile('^std::bitset<.*>$')] = StdBitsetPrinter
+    pretty_printers_dict[re.compile('^std::deque<.*>$')] = StdDequePrinter
+    pretty_printers_dict[re.compile('^std::list<.*>$')] = StdListPrinter
+    pretty_printers_dict[re.compile('^std::map<.*>$')] = lambda val: StdMapPrinter("std::map", val)
+    pretty_printers_dict[re.compile('^std::multimap<.*>$')] = lambda val: StdMapPrinter("std::multimap", val)
+    pretty_printers_dict[re.compile('^std::multiset<.*>$')] = lambda val: StdSetPrinter("std::multiset", val)
+    pretty_printers_dict[re.compile('^std::priority_queue<.*>$')] = lambda val: StdStackOrQueuePrinter("std::priority_queue", val)
+    pretty_printers_dict[re.compile('^std::queue<.*>$')] = lambda val: StdStackOrQueuePrinter("std::queue", val)
+    pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
+    pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
+    pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
     # vector<bool>
 
     # C++0x stuff.
     # array - the default seems reasonable
     # smart_ptr?  seems to only be in boost right now
-    obj.pretty_printers['^std::tr1::shared_ptr<.*>$'] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
-    obj.pretty_printers['^std::tr1::weak_ptr<.*>$'] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
-    obj.pretty_printers['^std::tr1::unique_ptr<.*>$'] = UniquePointerPrinter
-    obj.pretty_printers['^std::tr1::unordered_map<.*>$'] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
-    obj.pretty_printers['^std::tr1::unordered_set<.*>$'] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
-    obj.pretty_printers['^std::tr1::unordered_multimap<.*>$'] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
-    obj.pretty_printers['^std::tr1::unordered_multiset<.*>$'] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+    pretty_printers_dict[re.compile('^std::tr1::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
+    pretty_printers_dict[re.compile('^std::tr1::unique_ptr<.*>$')] = UniquePointerPrinter
+    pretty_printers_dict[re.compile('^std::tr1::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
+    pretty_printers_dict[re.compile('^std::tr1::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
 
     # Extensions.
-    obj.pretty_printers['^__gnu_cxx::slist<.*>$'] = StdSlistPrinter
+    pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter
 
     if True:
         # These shouldn't be necessary, if GDB "print *i" worked.
         # But it often doesn't, so here they are.
-        obj.pretty_printers['^std::_List_iterator<.*>$'] = lambda val: StdListIteratorPrinter(val)
-        obj.pretty_printers['^std::_List_const_iterator<.*>$'] = lambda val: StdListIteratorPrinter(val)
-        obj.pretty_printers['^std::_Rb_tree_iterator<.*>$'] = lambda val: StdRbtreeIteratorPrinter(val)
-        obj.pretty_printers['^std::_Rb_tree_const_iterator<.*>$'] = lambda val: StdRbtreeIteratorPrinter(val)
-        obj.pretty_printers['^std::_Deque_iterator<.*>$'] = lambda val: StdDequeIteratorPrinter(val)
-        obj.pretty_printers['^std::_Deque_const_iterator<.*>$'] = lambda val: StdDequeIteratorPrinter(val)
-        obj.pretty_printers['^__gnu_cxx::__normal_iterator<.*>$'] = lambda val: StdVectorIteratorPrinter(val)
-        obj.pretty_printers['^__gnu_cxx::_Slist_iterator<.*>$'] = lambda val: StdSlistIteratorPrinter(val)
-
+        pretty_printers_dict[re.compile('^std::_List_iterator<.*>$')] = lambda val: StdListIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_List_const_iterator<.*>$')] = lambda val: StdListIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Rb_tree_iterator<.*>$')] = lambda val: StdRbtreeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Rb_tree_const_iterator<.*>$')] = lambda val: StdRbtreeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Deque_iterator<.*>$')] = lambda val: StdDequeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^std::_Deque_const_iterator<.*>$')] = lambda val: StdDequeIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^__gnu_cxx::__normal_iterator<.*>$')] = lambda val: StdVectorIteratorPrinter(val)
+        pretty_printers_dict[re.compile('^__gnu_cxx::_Slist_iterator<.*>$')] = lambda val: StdSlistIteratorPrinter(val)
+
+pretty_printers_dict = {}
+
+build_libstdcxx_dictionary ()
 register_libstdcxx_printers (gdb.current_objfile())
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 0608330..12422af 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -161,10 +161,10 @@ int gdbpy_is_value_object (PyObject *obj);
 
 /* Note that these are declared here, and not in python.h with the
    other pretty-printer functions, because they refer to PyObject.  */
-char *apply_varobj_pretty_printer (PyObject *print_obj, struct value *value,
+char *apply_varobj_pretty_printer (PyObject *print_obj,
 				   struct value **replacement);
-PyObject *gdbpy_get_varobj_pretty_printer (struct type *type);
-PyObject *gdbpy_instantiate_printer (PyObject *cons, struct value *value);
+PyObject *gdbpy_get_varobj_pretty_printer (struct value *value);
+PyObject *gdbpy_instantiate_printer (PyObject *cons, PyObject *value);
 char *gdbpy_get_display_hint (PyObject *printer);
 
 extern PyObject *gdbpy_children_cst;
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index d8a8183..04bf3b4 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -165,7 +165,7 @@ get_seg_count (PyObject *self, Py_ssize_t *lenp)
 Py_ssize_t
 get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
 {
-  void *ptr;
+  void *ptr = NULL;
   Py_ssize_t ret;
 
   ret = get_read_buffer (self, segment, &ptr);
diff --git a/gdb/python/python-objfile.c b/gdb/python/python-objfile.c
index a225409..e97d3a2 100644
--- a/gdb/python/python-objfile.c
+++ b/gdb/python/python-objfile.c
@@ -1,6 +1,6 @@
 /* Python interface to objfiles.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -29,7 +29,7 @@ typedef struct
   /* The corresponding objfile.  */
   struct objfile *objfile;
 
-  /* The pretty-printer dictionary.  */
+  /* The pretty-printer list of functions.  */
   PyObject *printers;
 } objfile_object;
 
@@ -66,7 +66,7 @@ objfpy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
     {
       self->objfile = NULL;
 
-      self->printers = PyDict_New ();
+      self->printers = PyList_New (0);
       if (!self->printers)
 	{
 	  Py_DECREF (self);
@@ -95,10 +95,10 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
       return -1;
     }
 
-  if (! PyDict_Check (value))
+  if (! PyList_Check (value))
     {
       PyErr_SetString (PyExc_TypeError,
-		       "the pretty_printers attribute must be a dictionary");
+		       "the pretty_printers attribute must be a list");
       return -1;
     }
 
@@ -139,7 +139,7 @@ objfile_to_objfile_object (struct objfile *objfile)
 
 	  object->objfile = objfile;
 
-	  object->printers = PyDict_New ();
+	  object->printers = PyList_New (0);
 	  if (!object->printers)
 	    {
 	      Py_DECREF (object);
diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 7396bad..c39ff27 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -1,6 +1,6 @@
 /* Python interface to types.
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -234,6 +234,15 @@ typy_tag (PyObject *self, PyObject *args)
   return PyString_FromString (TYPE_TAG_NAME (type));
 }
 
+/* Return the type, stripped of typedefs. */
+static PyObject *
+typy_strip_typedefs (PyObject *self, PyObject *args)
+{
+  struct type *type = ((type_object *) self)->type;
+
+  return type_to_type_object (check_typedef (type));
+}
+
 /* Return a Type object which represents a pointer to SELF.  */
 static PyObject *
 typy_pointer (PyObject *self, PyObject *args)
@@ -712,6 +721,8 @@ Each field is a dictionary." },
     "Return the size of this type, in bytes" },
   { "tag", typy_tag, METH_NOARGS,
     "Return the tag name for this type, or None." },
+  { "strip_typedefs", typy_strip_typedefs, METH_NOARGS,
+    "Return a type stripped of typedefs"},
   { "target", typy_target, METH_NOARGS,
     "Return the target type of this type" },
   { "template_argument", typy_template_argument, METH_VARARGS,
diff --git a/gdb/python/python-utils.c b/gdb/python/python-utils.c
index c6c305f..f9c9486 100644
--- a/gdb/python/python-utils.c
+++ b/gdb/python/python-utils.c
@@ -82,7 +82,11 @@ python_string_to_unicode (PyObject *obj)
   /* If obj is already a unicode string, just return it.
      I wish life was always that simple...  */
   if (PyUnicode_Check (obj))
-    unicode_str = obj;
+    {
+      unicode_str = obj;
+      Py_INCREF (obj);
+    }
+  
   else if (PyString_Check (obj))
     unicode_str = PyUnicode_FromEncodedObject (obj, host_charset (), NULL);
   else
@@ -137,12 +141,15 @@ char *
 python_string_to_target_string (PyObject *obj)
 {
   PyObject *str;
+  char *result;
 
   str = python_string_to_unicode (obj);
   if (str == NULL)
     return NULL;
 
-  return unicode_to_target_string (str);
+  result = unicode_to_target_string (str);
+  Py_DECREF (str);
+  return result;
 }
 
 /* Converts a python string (8-bit or unicode) to a target string in
@@ -153,12 +160,15 @@ char *
 python_string_to_host_string (PyObject *obj)
 {
   PyObject *str;
+  char *result;
 
   str = python_string_to_unicode (obj);
   if (str == NULL)
     return NULL;
 
-  return unicode_to_encoded_string (str, host_charset ());
+  result = unicode_to_encoded_string (str, host_charset ()); 
+  Py_DECREF (str);
+  return result;
 }
 
 /* Converts a target string of LENGTH bytes in the target's charset to a
diff --git a/gdb/python/python.c b/gdb/python/python.c
index d968619..a5785c1 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1056,75 +1056,48 @@ gdbpy_objfiles (PyObject *unused1, PyObject *unused2)
 
 \f
 
-/* Return a string representing TYPE.  */
-static char *
-get_type (struct type *type)
-{
-  struct cleanup *old_chain;
-  struct ui_file *stb;
-  char *thetype;
-  long length;
-
-  stb = mem_fileopen ();
-  old_chain = make_cleanup_ui_file_delete (stb);
-
-  CHECK_TYPEDEF (type);
-
-  type_print (type, "", stb, -1);
-
-  thetype = ui_file_xstrdup (stb, &length);
-  do_cleanups (old_chain);
-  return thetype;
-}
-
 /* Helper function for find_pretty_printer which iterates over a
-   dictionary and tries to find a match.  */
+   list, calls each function and inspects output.  */
 static PyObject *
-search_pp_dictionary (PyObject *dict, char *type_name)
+search_pp_list (PyObject *list, PyObject *value)
 {
-  Py_ssize_t iter;
-  PyObject *key, *func, *found = NULL;
-
-  /* See if the type matches a pretty-printer regexp.  */
-  iter = 0;
-  while (! found && PyDict_Next (dict, &iter, &key, &func))
+  Py_ssize_t pp_list_size, list_index;
+  PyObject *function, *printer = NULL;
+  
+  pp_list_size = PyList_Size (list);
+  for (list_index = 0; list_index < pp_list_size; list_index++)
     {
-      char *rx_str;
+      function = PyList_GetItem (list, list_index);
+      if (! function)
+	return NULL;
 
-      if (! PyString_Check (key))
-	continue;
-      rx_str = PyString_AsString (key);
-      if (re_comp (rx_str) == NULL && re_exec (type_name) == 1)


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


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

end of thread, other threads:[~2009-03-30 19:06 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27  0:35 [SCM] archer: Merge commit 'origin/archer-jankratochvil-python' into archer jkratoch
  -- strict thread matches above, loose matches on Subject: below --
2009-03-30 19:06 jkratoch
2009-03-29 22:42 jkratoch
2009-03-25 19:00 jkratoch
2009-03-24 17:33 jkratoch
2009-03-12 20:25 jkratoch
2009-03-09 17:05 jkratoch
2009-03-06 21:16 jkratoch
2009-03-06 16:59 jkratoch
2009-03-06 14:26 jkratoch
2009-03-05 21:53 jkratoch
2009-03-05 21:15 jkratoch
2009-03-04 23:54 jkratoch
2009-03-04 22:34 jkratoch
2009-03-04 15:04 jkratoch
2009-03-03 21:47 jkratoch
2009-03-03 21:45 jkratoch
2009-03-02 22:55 jkratoch
2009-03-01 14:38 jkratoch
2009-02-28 19:26 jkratoch
2009-02-26 23:02 jkratoch

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).