Commit Graph

18 Commits

Author SHA1 Message Date
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Andrew Burgess 09ff83af3c gdb/python: smarter symbol lookup for gdb.lookup_static_symbol
When using gdb.lookup_static_symbol I think that GDB should find
static symbols (global symbol with static linkage) from the current
object file ahead of static symbols from other object files.

This means that if we have two source files f1.c and f2.c, and both
files contains 'static int foo;', then when we are stopped in f1.c a
call to 'gdb.lookup_static_symbol ("foo")' will find f1.c::foo, and if
we are stopped in f2.c we would find 'f2.c::foo'.

Given that gdb.lookup_static_symbol always returns a single symbol,
but there can be multiple static symbols with the same name GDB is
always making a choice about which symbols to return.  I think that it
makes sense for the choice GDB makes in this case to match what a user
would get on the command line if they asked to 'print foo'.

gdb/testsuite/ChangeLog:

	* gdb.python/py-symbol.c: Declare and call function from new
	py-symbol-2.c file.
	* gdb.python/py-symbol.exp: Compile both source files, and add new
	tests for gdb.lookup_static_symbol.
	* gdb.python/py-symbol-2.c: New file.

gdb/doc/ChangeLog:

	* python.texi (Symbols In Python): Extend documentation for
	gdb.lookup_static_symbol.

gdb/ChangeLog:

	* python/py-symbol.c (gdbpy_lookup_static_symbol): Lookup in
	static block of current object file first.  Also fix typo in
	header comment.

Change-Id: Ie55dbeb8806f35577b46015deecde27a0ca2ab64
2019-11-10 21:35:28 +00:00
Christian Biesinger 2906593ffe [PR/24474] Add gdb.lookup_static_symbol to the python API
Similar to lookup_global_symbol, except that it checks the
STATIC_SCOPE.

gdb/ChangeLog:

2019-07-30  Christian Biesinger  <cbiesinger@google.com>

	PR/24474: Add a function to lookup static variables.
	* NEWS: Mention this new function.
	* python/py-symbol.c (gdbpy_lookup_static_symbol): New function.
	* python/python-internal.h (gdbpy_lookup_static_symbol): New function.
	* python/python.c (python_GdbMethods): Add new function.

gdb/doc/ChangeLog:

2019-07-30  Christian Biesinger  <cbiesinger@google.com>

	* python.texi (Symbols In Python): Document new function
	gdb.lookup_static_symbol.

gdb/testsuite/ChangeLog:

2019-07-30  Christian Biesinger  <cbiesinger@google.com>

	* gdb.python/py-symbol.c: Add a static variable and one in an anonymous
	namespace.
	* gdb.python/py-symbol.exp: Test gdb.lookup_static_symbol.
2019-07-30 11:04:37 -05: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
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Pedro Alves 47d4871188 Fix formating in copyright headers.
File list found with:
$ grep "along with this program" * -A 1 -rn \
	| grep "*/" \
	| grep -v "along with this program" \
	| sed 's,-[0-9]\+-.*,,g'

Tested on x86_64 Fedora 17.

gdb/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* darwin-nat.c: Fix formating in copyright header.
	* darwin-nat.h: Likewise.
	* gnu-nat.c: Likewise.
	* machoread.c: Likewise.

gdb/testsuite/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* gdb.ada/info_types.c: Fix formating in copyright header.
	* gdb.base/break-on-linker-gcd-function.cc: Likewise.
	* gdb.base/float.c: Likewise.
	* gdb.base/inferior-died.c: Likewise.
	* gdb.base/interp.c: Likewise.
	* gdb.base/jit-main.c: Likewise.
	* gdb.base/jit-solib.c: Likewise.
	* gdb.base/long_long.c: Likewise.
	* gdb.base/longjmp.c: Likewise.
	* gdb.base/nextoverexit.c: Likewise.
	* gdb.base/pr11022.c: Likewise.
	* gdb.base/prelink-lib.c: Likewise.
	* gdb.base/prelink.c: Likewise.
	* gdb.base/prologue.c: Likewise.
	* gdb.base/restore.c: Likewise.
	* gdb.base/sigchld.c: Likewise.
	* gdb.base/solib-search-lib1.c: Likewise.
	* gdb.base/solib-search-lib2.c: Likewise.
	* gdb.base/solib-search.c: Likewise.
	* gdb.base/solib-search.h: Likewise.
	* gdb.base/whatis.c: Likewise.
	* gdb.cp/abstract-origin.cc: Likewise.
	* gdb.cp/anon-struct.cc: Likewise.
	* gdb.cp/baseenum.cc: Likewise.
	* gdb.cp/bs15503.cc: Likewise.
	* gdb.cp/call-c-1.c: Likewise.
	* gdb.cp/call-c.cc: Likewise.
	* gdb.cp/class2.cc: Likewise.
	* gdb.cp/classes.cc: Likewise.
	* gdb.cp/cttiadd.cc: Likewise.
	* gdb.cp/cttiadd1.cc: Likewise.
	* gdb.cp/cttiadd2.cc: Likewise.
	* gdb.cp/cttiadd3.cc: Likewise.
	* gdb.cp/derivation.cc: Likewise.
	* gdb.cp/derivation2.cc: Likewise.
	* gdb.cp/dispcxx.cc: Likewise.
	* gdb.cp/exception.cc: Likewise.
	* gdb.cp/gdb2384-base.cc: Likewise.
	* gdb.cp/gdb2384-base.h: Likewise.
	* gdb.cp/gdb2384.cc: Likewise.
	* gdb.cp/gdb2495.cc: Likewise.
	* gdb.cp/mb-inline.h: Likewise.
	* gdb.cp/mb-inline1.cc: Likewise.
	* gdb.cp/mb-inline2.cc: Likewise.
	* gdb.cp/member-name.cc: Likewise.
	* gdb.cp/member-ptr.cc: Likewise.
	* gdb.cp/misc.cc: Likewise.
	* gdb.cp/namespace1.cc: Likewise.
	* gdb.cp/nextoverthrow.cc: Likewise.
	* gdb.cp/pr-574.cc: Likewise.
	* gdb.cp/pr9631.cc: Likewise.
	* gdb.cp/printmethod.cc: Likewise.
	* gdb.cp/psmang1.cc: Likewise.
	* gdb.cp/psmang2.cc: Likewise.
	* gdb.cp/psymtab-parameter.cc: Likewise.
	* gdb.cp/ptype-flags.cc: Likewise.
	* gdb.cp/ref-params.cc: Likewise.
	* gdb.cp/ref-types.cc: Likewise.
	* gdb.cp/smartp.cc: Likewise.
	* gdb.cp/try_catch.cc: Likewise.
	* gdb.cp/userdef.cc: Likewise.
	* gdb.cp/using-crash.cc: Likewise.
	* gdb.cp/virtfunc.cc: Likewise.
	* gdb.cp/virtfunc2.cc: Likewise.
	* gdb.dwarf2/callframecfa.S: Likewise.
	* gdb.dwarf2/dw2-ranges.c: Likewise.
	* gdb.dwarf2/dw2-ranges2.c: Likewise.
	* gdb.dwarf2/dw2-ranges3.c: Likewise.
	* gdb.dwarf2/dw2-restore.S: Likewise.
	* gdb.dwarf2/pieces.S: Likewise.
	* gdb.dwarf2/valop.S: Likewise.
	* gdb.java/jnpe.java: Likewise.
	* gdb.mi/mi-stepn.c: Likewise.
	* gdb.mi/mi-var-cp.cc: Likewise.
	* gdb.mi/mi-var-rtti.cc: Likewise.
	* gdb.mi/ns-stale-regcache.c: Likewise.
	* gdb.mi/pr11022.c: Likewise.
	* gdb.mi/solib-lib.c: Likewise.
	* gdb.mi/solib-main.c: Likewise.
	* gdb.python/py-arch.c: Likewise.
	* gdb.python/py-block.c: Likewise.
	* gdb.python/py-breakpoint.c: Likewise.
	* gdb.python/py-events.c: Likewise.
	* gdb.python/py-evthreads.c: Likewise.
	* gdb.python/py-explore.c: Likewise.
	* gdb.python/py-explore.cc: Likewise.
	* gdb.python/py-finish-breakpoint.c: Likewise.
	* gdb.python/py-finish-breakpoint2.cc: Likewise.
	* gdb.python/py-symbol.c: Likewise.
	* gdb.threads/execl.c: Likewise.
	* gdb.threads/execl1.c: Likewise.
2013-06-07 14:39:33 +00:00
Joel Brobecker 8acc9f485b Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:41:43 +00:00
Siva Chandra Reddy ee0bf529c3 2012-06-26 Siva Chandra Reddy <sivachandra@google.com>
New attribute 'last' for gdb.Symtab_and_line.
        * NEWS (Python Scripting): Add entry about the new attribute.
        * python/py-symtab.c (salpy_get_last): New function which
        implements the get method for the 'last' attribute of
        gdb.Symtab_and_line.
        (sal_object_getset): Add entry for the 'last' attribute.

        doc/
        * gdb.texinfo (Symbol Tables In Python): Add description about
        the new 'last' attribute of gdb.Symtab_and line.

        testsuite/
        * gdb.python/py-symtab.exp: Add tests to test the new attribute
        'last' of gdb.Symtab_and_line.
        * gdb.python/py-symbol.c: Move break point comment to enable
        testing of gdb.Symtab_and_line.last.
2012-06-27 00:21:21 +00:00
Siva Chandra Reddy a20ee7a4a9 2012-05-03 Siva Chandra Reddy <sivachandra@google.com>
Add two new methods global_block and static_block to gdb.Symtab
	objects.
	* NEWS (Python scripting): Add entry about the new methods.
	* python/py-symtab.c (stpy_global_block): New function which
	implements the gdb.Symtab.global_block() method.
	(stpy_static_block): New function which implements the
	gdb.Symtab.static_block() method.
	(symtab_object_methods): Add entries for the two new methods.

	* testsuite/gdb.python/py-symbol.exp: Add tests to test the new
	methods gdb.Symtab.global_block() and gdb.Symtab.static_block().
	* tessuite/gdb.python/py-symbol.c: Add new struct to help test
	gdb.Symtab.static_block().

	* doc/gdb.texinfo (Symbol Tables In Python): Add documentation
	about the new methods global_block and static_block on
	gdb.Symtab objects.
2012-05-03 07:07:26 +00:00
Tom Tromey f0823d2ce8 PR python/12027:
* python/python-internal.h (frame_object_type): Declare.
	* python/py-symbol.c (sympy_needs_frame): New function.
	(sympy_value): New function.
	(symbol_object_getset): Add "needs_frame".
	(symbol_object_methods): Add "value".
	* python/py-frame.c (frame_object_type): No longer static.
gdb/doc
	* gdb.texinfo (Symbols In Python): Document Symbol.needs_frame and
	Symbol.value.
gdb/testsuite
	* gdb.python/py-symbol.exp: Test Symbol.needs_frame and
	Symbol.value.
	* gdb.python/py-symbol.c (qq): Set default value.
2012-02-07 19:47:16 +00:00
Tom Tromey 64e7d9dddc PR python/13599:
* python/py-symbol.c (sympy_line): New function.
	(symbol_object_getset): Add "line".
gdb/doc
	* gdb.texinfo (Symbols In Python): Document Symbol.line.
gdb/testsuite
	* gdb.python/py-symbol.c (qq): New global.
	* gdb.python/py-symbol.exp: Add test for frame-less
	lookup_symbol.
	* gdb.python/py-symtab.exp: Fix line number.
2012-02-07 19:42:27 +00:00
Joel Brobecker c5a5708100 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:28:28 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Phil Muldoon f3e9a8177c 2010-02-24 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* python/python.c (_initialize_python): Call
	gdbpy_initialize_symtabs, gdbpy_initialize_symbols and
	gdbpy_initialize_blocks.
	* python/python-internal.h: Declare struct symbol, block and
	symtab_and_line.  Declare block_object_type and
	symbol_object_type
	(gdbpy_lookup_symbol gdbpy_block_for_pc)
	(symtab_and_line_to_sal_object, symtab_to_symtab_object)
	(symbol_to_symbol_object,  block_to_block_object)
	(gdbpy_initialize_symtabs,gdbpy_initialize_symbols)
	(gdbpy_initialize_blocks ): Declare.
	* python/py-frame.c (frapy_block, frapy_function, frapy_find_sal)
	(frapy_select): Add methods.
	(frapy_read_var): Add symbol branch.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-symbol, py-symtab,
	py-block.
	(SUBDIR_PYTHON_SRCS): Likewise.
	(py-symbol.o): New rule.
	(py-symtab.o): Likewise.
	(py-block.o): Likewise.
	* python/py-symbol.c: New file.
	* python/py-symtab.c: Likewise.
	* python/py-block.c: Likewise.


2010-02-24  Phil Muldoon  <pmuldoon@redhat.com>

	* Makefile.in: Add py-block and py-symbol.
	* gdb.python/py-symbol.exp: New File.
	* gdb.python/py-symtab.exp: New File.
	* gdb.python/py-block.exp: New File.
	* gdb.python/py-symbol.c: New File.
	* gdb.python/py-block.c: New File.


2010-02-24  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Frames In Python): Add block, find_sal, function
	and select method descriptions.
	(Python API): Add Blocks In Python, Symbols in Python and Symbol
	Tables in Python to menu.
	(Blocks In Python): New node.
	(Symbols In Python): New node.
	(Symbol Tables in Python): New node.
2010-02-24 21:18:28 +00:00