binutils-gdb/gdb/python
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
..
lib/gdb [gdb/target] Fix pretty-printer for MPX bnd registers 2019-10-09 23:52:46 +02:00
py-all-events.def
py-arch.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
py-auto-load.c Change boolean options to bool instead of int 2019-09-18 09:35:12 +09:00
py-block.c Add block['var'] accessor 2019-08-05 13:06:18 -05:00
py-bpevent.c
py-breakpoint.c Change iterate_over_breakpoints to take a function_view 2019-10-15 15:29:55 +02:00
py-cmd.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
py-continueevent.c
py-event-types.def
py-event.c
py-event.h
py-events.h
py-evtregistry.c [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c Change iterate_over_breakpoints to take a function_view 2019-10-15 15:29:55 +02:00
py-frame.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
py-framefilter.c Introduce metadata style 2019-10-01 15:12:40 -06:00
py-function.c
py-gdb-readline.c Constify command_line_input 2019-11-08 06:59:36 -07:00
py-inferior.c Fix use-after-move bug in add_thread_object 2019-07-11 09:15:18 -06:00
py-infevents.c
py-infthread.c Reduce manual reference counting in py-inferior.c 2019-07-10 12:24:22 -06:00
py-instruction.c
py-instruction.h [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
py-lazy-string.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
py-linetable.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
py-newobjfileevent.c
py-objfile.c Remove make_hex_string 2019-09-25 09:37:56 -06:00
py-param.c Change boolean options to bool instead of int 2019-09-18 09:35:12 +09:00
py-prettyprint.c Introduce metadata style 2019-10-01 15:12:40 -06:00
py-progspace.c gdb/python: Return None from Progspace.block_for_pc on error 2019-10-24 15:27:02 +01:00
py-record-btrace.c Don't include gdbarch.h from defs.h 2019-07-10 14:53:53 -06:00
py-record-btrace.h
py-record-full.c
py-record-full.h
py-record.c Rename gdb exception types 2019-04-08 09:05:40 -06:00
py-record.h
py-ref.h Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
py-signalevent.c
py-stopevent.c
py-stopevent.h
py-symbol.c gdb/python: smarter symbol lookup for gdb.lookup_static_symbol 2019-11-10 21:35:28 +00:00
py-symtab.c
py-threadevent.c
py-type.c gdb: Remove vec.{c,h} and update code to not include vec.h 2019-10-15 21:31:55 +01:00
py-unwind.c Rename internal Python functions to start with an underscore 2019-08-15 14:21:57 -05:00
py-utils.c Make exception handling more efficient 2019-04-25 12:59:35 -06:00
py-value.c Remove la_get_string member 2019-11-05 15:36:28 -07:00
py-varobj.c
py-xmethods.c
python-config.py
python-internal.h [PR/24474] Add gdb.lookup_static_symbol to the python API 2019-07-30 11:04:37 -05:00
python.c Change boolean options to bool instead of int 2019-09-18 09:35:12 +09:00
python.h