2016-02-09 Keith Seitz <keiths@redhat.com>
+ PR python/19506
+ * python/py-breakpoint.c (bppy_init): Use
+ string_to_event_location_basic instead of new_linespec_location.
+
+2016-02-09 Keith Seitz <keiths@redhat.com>
+
* location.c (string_to_explicit_location): Note that "-p" is
reserved for probe locations and return NULL for any input
that starts with that.
TRY
{
- char *copy = xstrdup (spec);
+ char *copy = xstrdup (skip_spaces_const (spec));
struct cleanup *cleanup = make_cleanup (xfree, copy);
switch (type)
{
struct event_location *location;
- location = new_linespec_location (©);
+ location
+ = string_to_event_location_basic (©, current_language);
make_cleanup_delete_event_location (location);
create_breakpoint (python_gdbarch,
location, NULL, -1, NULL,
+2016-02-09 Keith Seitz <keiths@redhat.com>
+
+ PR python/19506
+ * gdb.python/py-breakpoint.exp (test_bkpt_address): New procedure.
+ (toplevel): Call test_bkpt_address.
+
2016-02-09 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Use AC_CONFIG_FILES instead of passing arguments
}
}
+# Test address locations.
+
+proc test_bkpt_address {} {
+ global gdb_prompt decimal srcfile
+
+ # Delete all breakpoints
+ delete_breakpoints
+
+ gdb_test "python gdb.Breakpoint(\"*main\")" \
+ ".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\."
+
+ gdb_py_test_silent_cmd \
+ "python main_loc = gdb.parse_and_eval(\"main\").address" \
+ "eval address of main" 0
+
+ # Python 2 vs 3 ... Check `int' first. If that fails, try `long'.
+ gdb_test_multiple "python main_addr = int(main_loc)" "int value of main" {
+ -re "Traceback.*$gdb_prompt $" {
+ gdb_test_no_output "python main_addr = long(main_loc)" \
+ "long value of main"
+ }
+ -re "$gdb_prompt $" {
+ pass "int value of main"
+ }
+ }
+
+ # Include whitespace in the linespec to double-check proper
+ # grokking of argument to gdb.Breakpoint.
+ gdb_test "python gdb.Breakpoint(\" *{}\".format(str(main_addr)))" \
+ ".*Breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\."
+}
+
test_bkpt_basic
test_bkpt_deletion
test_bkpt_cond_and_cmds
test_bkpt_internal
test_bkpt_eval_funcs
test_bkpt_temporary
+test_bkpt_address