Commit Graph

7 Commits

Author SHA1 Message Date
Joel Brobecker 7f5331a885 gdb-gdb.py.in: Fix error when printing range type
I noticed that trying to print the contents of a struct main_type
would fail when the type was a TYPE_CODE_RANGE:

    (gdb) p *type.main_type
    $1 = Python Exception <class 'gdb.error'> There is no member named low_undefined.:

And indeed, Python is right, fields "low_undefined" has been removed
from struct range_bounds back in ... 2014! It was done when we introduced
dynamic bounds handling. This patch fixes gdb-gdb.py.in according to
the new structure.

gdb/ChangeLog:

	* gdb-gdb.py.in (StructMainTypePrettyPrinter.bound_img): New method.
	(StructMainTypePrettyPrinter.bounds_img): Use new "bound_img"
	method to compute the bounds of range types. Also print "[evaluated]"
	if the bounds' values come from a dynamic evaluation.
2019-03-26 18:30:21 -04:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
Simon Marchi e76f78a052 Format gdb-gdb.py.in with autopep8
Format using "autopep8 -i".

gdb/ChangeLog:

	* gdb-gdb.py.in: Format using autopep8.
2018-06-27 15:31:05 -04:00
Simon Marchi 9a14af7b1a Add pretty-printer for CORE_ADDR
Add a pretty-printer that prints CORE_ADDR values in hex.

gdb/ChangeLog:

	* gdb-gdb.py.in (CoreAddrPrettyPrinter): New class.
	(type_lookup_function): Recognize CORE_ADDR values.
2018-06-27 15:21:47 -04:00
Simon Marchi 189366cd86 gdb-gdb.py.in: Don't print value's tag_name
This has been removed recently.

gdb/ChangeLog:

	* gdb-gdb.py.in (StructMainTypePrettyPrinter) <to_string>: Don't
	print tag_name.
2018-06-27 14:32:08 -04:00
Simon Marchi 68ad5fb9aa gdb-gdb.py.in: Fix ordering of TypeFlags objects with Python 3
Python 3 doesn't use __cmp__ to order objects, it uses __lt__.  Because
of this, we get this exception when trying to pretty-print "type"
objects:

I tested it with Python 2.7 as well.

gdb/ChangeLog:

	* gdb-gdb.py.in (TypeFlag) <__cmp__>: Remove.
	<__lt__>: Add.
2018-06-27 14:32:05 -04:00
Simon Marchi 141ec9f67f Copy gdb-gdb.py to build dir
I have thought for a long time how nice it would be to have cool pretty
printers for GDB's internal types.  Well, turns out there are few
already in gdb-gdb.py!  Unfortunately, if you build GDB outside of the
source directory, that file never gets loaded.  top-gdb will look for a
file called

  ../path/to/build/gdb/gdb-gdb.py

but that file is in the source directory at

  ../path/to/src/gdb/gdb-gdb.py

This patch makes it so we copy it to the build directory, just like we
do for gdb-gdb.gdb.  With this, I can at least see the file getting
automatically loaded:

(top-gdb) info pretty-printer
global pretty-printers:
  builtin
    mpx_bound128
  objfile /home/emaisin/build/binutils-gdb/gdb/gdb pretty-printers:
  type_lookup_function

I noticed that running "make" didn't re-generate gdb-gdb.py from
gdb-gdb.py.in.  That's because it's copied when running the configure
script and that's it.  I added a rule in the Makefile for that (and for
gdb-gdb.gdb too) and added them as a dependency to the "all" target.

gdb/ChangeLog:

	* gdb-gdb.py: Move to...
	* gdb-gdb.py.in: ... here.
	* configure.ac (AC_CONFIG_FILES): Add gdb-gdb.py.
	* Makefile.in (all): Add gdb-gdb.gdb and gdb-gdb.py as
	dependencies.
	(distclean): Remove gdb-gdb.py when cleaning.
	(gdb-gdb.py, gdb-gdb.gdb): New rules.
	* configure: Re-generate.
2018-06-27 14:32:02 -04:00