From cc80f267162ba7f1cab2fcf605270a3510cf010b Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 11 Jun 2012 19:16:24 +0000 Subject: [PATCH] gdb/ Fix regression by the "ambiguous linespec" series. * breakpoint.c (parse_breakpoint_sals): New variable cursal. Use get_last_displayed_symtab and get_last_displayed_line and depending on CURSAL. gdb/testsuite/ Fix regression by the "ambiguous linespec" series. * gdb.base/break.exp (list marker1, break lineno, delete $bpnum): New tests. --- gdb/ChangeLog | 7 +++++++ gdb/breakpoint.c | 15 +++++++++++---- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.base/break.exp | 7 +++++++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ad6abdb407a..1a50740a4d3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2012-06-11 Jan Kratochvil + + Fix regression by the "ambiguous linespec" series. + * breakpoint.c (parse_breakpoint_sals): New variable cursal. Use + get_last_displayed_symtab and get_last_displayed_line and depending + on CURSAL. + 2012-06-11 Tom Tromey * dwarf2read.c (dw2_get_primary_filename_reader): New function. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 12db39b22c4..9c4348fda4e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8802,19 +8802,26 @@ parse_breakpoint_sals (char **address, } else { + struct symtab_and_line cursal = get_current_source_symtab_and_line (); + /* Force almost all breakpoints to be in terms of the current_source_symtab (which is decode_line_1's default). This should produce the results we want almost all of the - time while leaving default_breakpoint_* alone. */ - if (last_displayed_sal_is_valid ()) + time while leaving default_breakpoint_* alone. + + ObjC: However, don't match an Objective-C method name which + may have a '+' or '-' succeeded by a '['. */ + if (last_displayed_sal_is_valid () + && (!cursal.symtab + || ((strchr ("+-", (*address)[0]) != NULL) + && ((*address)[1] != '[')))) decode_line_full (address, DECODE_LINE_FUNFIRSTLINE, get_last_displayed_symtab (), get_last_displayed_line (), canonical, NULL, NULL); else decode_line_full (address, DECODE_LINE_FUNFIRSTLINE, - (struct symtab *) NULL, 0, - canonical, NULL, NULL); + cursal.symtab, cursal.line, canonical, NULL, NULL); } } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 40aa47d3834..dfc7753b811 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-06-11 Jan Kratochvil + + Fix regression by the "ambiguous linespec" series. + * gdb.base/break.exp (list marker1, break lineno, delete $bpnum): New + tests. + 2012-06-11 Jan Kratochvil * lib/future.exp: Set $use_gdb_compile even if only find_go_linker is diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index a2033644a95..14e93451d2d 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -371,6 +371,13 @@ gdb_expect { } } +# Test the 'list' commands sets current file for the 'break LINENO' command. +set bp_marker1 [gdb_get_line_number "set breakpoint 16 here" ${srcfile1}] +gdb_test "list marker1" ".*" +gdb_test "break $bp_marker1" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*${srcfile1}, line ${bp_marker1}\\." \ + "break lineno" +gdb_test_no_output {delete $bpnum} + # # run until the breakpoint at a line number # -- 2.30.2