From b89641bab55496e52094282fabe146289c57b6d1 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 13 Dec 2017 11:37:09 -0500 Subject: python: Add qualified parameter to gdb.Breakpoint This patch adds the possibility to pass a qualified=True|False parameter when creating a breakpoint in Python. It is equivalent to using -qualified in a linespec. The parameter actually accepts any Python value, and converts it to boolean using Python's standard rules for that (https://docs.python.org/3/library/stdtypes.html#truth). Unlike the -source/-line/-function/-label parameters, it is possible to use -qualified with a "normal" (non-explicit) linespec. Therefore, it is possible (unlike these other parameters) to use this new parameter along with the spec parameter. I updated the py-breakpoint.exp test. To be able to test multiple locations using a namespace, I had to switch the test case to compile as C++. If we really wanted to, we could run it as both C and C++, but omit the C++-specific parts when running it as C. gdb/ChangeLog: * location.h (string_to_event_location): Add match_type parameter. * location.c (string_to_event_location): Likewise. * python/py-breakpoint.c (bppy_init): Handle qualified parameter. gdb/doc/ChangeLog: * python.texi (Manipulating breakpoints using Python): Document qualified parameter to gdb.Breakpoint. gdb/testsuite/ChangeLog: * gdb.python/py-breakpoint.c (foo_ns::multiply): New function. * gdb.python/py-breakpoint.exp: Compile the test case as c++, call test_bkpt_qualified. (test_bkpt_qualified): New proc. --- gdb/location.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gdb/location.h') diff --git a/gdb/location.h b/gdb/location.h index fcfa8fb..d5d879d 100644 --- a/gdb/location.h +++ b/gdb/location.h @@ -220,11 +220,14 @@ extern event_location_up This function is intended to be used by CLI commands and will parse explicit locations in a CLI-centric way. Other interfaces should use string_to_event_location_basic if they want to maintain support for - legacy specifications of probe, address, and linespec locations. */ + legacy specifications of probe, address, and linespec locations. -extern event_location_up - string_to_event_location (const char **argp, - const struct language_defn *langauge); + MATCH_TYPE should be either WILD or FULL. If -q/--qualified is specified + in the input string, it will take precedence over this parameter. */ + +extern event_location_up string_to_event_location + (const char **argp, const struct language_defn *langauge, + symbol_name_match_type match_type = symbol_name_match_type::WILD); /* Like string_to_event_location, but does not attempt to parse explicit locations. MATCH_TYPE indicates how function names should -- cgit v1.1