binutils-gdb/gdb/testsuite/gdb.base/annota1.exp

482 lines
18 KiB
Plaintext
Raw Normal View History

# Copyright 1999-2018 Free Software Foundation, Inc.
1999-05-05 23:45:13 +02:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
1999-05-05 23:45:13 +02:00
# (at your option) any later version.
#
1999-05-05 23:45:13 +02:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
1999-05-05 23:45:13 +02:00
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-05-05 23:45:13 +02:00
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
# This testcase cannot use runto_main because of the different prompt
# we get when using annotation level 2.
#
if ![target_can_use_run_cmd] {
return 0
}
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
1999-05-05 23:45:13 +02:00
#
# test running programs
#
standard_testfile .c
1999-05-05 23:45:13 +02:00
2006-03-07 Paul Brook <paul@codesourcery.com> * gdb.arch/altivec-abi.exp: Use nowarnings instead of additional_flags=-w. * gdb.arch/altivec-regs.exp: Ditto. * gdb.arch/e500-abi.exp: Ditto. * gdb.arch/e500-regs.exp: Ditto. * gdb.base/all-bin.exp: Ditto. * gdb.base/annota1.exp: Ditto. * gdb.base/annota3.exp: Ditto. * gdb.base/args.exp: Ditto. * gdb.base/arithmet.exp: Ditto. * gdb.base/assign.exp: Ditto. * gdb.base/async.exp: Ditto. * gdb.base/bang.exp: Ditto. * gdb.base/break.exp: Ditto. * gdb.base/call-rt-st.exp: Ditto. * gdb.base/completion.exp: Ditto. * gdb.base/cond-expr.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/consecutive.exp: Ditto. * gdb.base/define.exp: Ditto. * gdb.base/display.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/environ.exp: Ditto. * gdb.base/eval-skip.exp: Ditto. * gdb.base/info-proc.exp: Ditto. * gdb.base/jump.exp: Ditto. * gdb.base/logical.exp: Ditto. * gdb.base/long_long.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/miscexprs.exp: Ditto. * gdb.base/pc-fp.exp: Ditto. * gdb.base/pointers.exp: Ditto. * gdb.base/relational.exp: Ditto. * gdb.base/reread.exp: Ditto. * gdb.base/sect-cmd.exp: Ditto. * gdb.base/sep.exp: Ditto. * gdb.base/sepdebug.exp: Ditto. * gdb.base/until.exp: Ditto. * gdb.base/whatis-exp.exp: Ditto. * gdb.cp/annota2.exp: Ditto. * gdb.cp/annota3.exp: Ditto. * gdb.trace/actions.exp: Ditto. * gdb.trace/backtrace.exp: Ditto. * gdb.trace/circ.exp: Ditto. * gdb.trace/collection.exp: Ditto. * gdb.trace/deltrace.exp: Ditto. * gdb.trace/infotrace.exp: Ditto. * gdb.trace/limits.exp: Ditto. * gdb.trace/packetlen.exp: Ditto. * gdb.trace/passc-dyn.exp: Ditto. * gdb.trace/passcount.exp: Ditto. * gdb.trace/report.exp: Ditto. * gdb.trace/save-trace.exp: Ditto. * gdb.trace/tfind.exp: Ditto. * gdb.trace/tracecmd.exp: Ditto. * gdb.trace/while-dyn.exp: Ditto. * gdb.trace/while-stepping.exp: Ditto. * lib/gdb.exp: Ditto. (gdb_compile): Handle nowarning option.
2006-03-07 16:23:33 +01:00
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
Fixup testcases outputting own name as a test name and standardize failed compilation messages Changes in v3: - Adjusted some testcases where the message "failed to compile" was not unique. Changes in v2: - Addressed comments from reviewers. - Fixed spurious whitespaces. - Changed compilation failure messages that included source/binary paths to ones that are short and deterministic. --- Another bit of cleanup to the testsuite. We have a number of tests that are not honoring the rule of not outputting their own name as a test name. I fixed up all the offenders i could find with the following regular expression: "(xfail|kfail|kpass|fail|pass|unsupported|untested) ([A-Za-z0-9]+|\\\$(.)*testfile(.)*)\.exp$" gdb/testsuite/ChangeLog: 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names and standardize compilation error messages throughout the following files: * gdb.ada/start.exp * gdb.arch/alpha-step.exp * gdb.arch/e500-prologue.exp * gdb.arch/ftrace-insn-reloc.exp * gdb.arch/gdb1291.exp * gdb.arch/gdb1431.exp * gdb.arch/gdb1558.exp * gdb.arch/i386-dr3-watch.exp * gdb.arch/i386-sse-stack-align.exp * gdb.arch/ia64-breakpoint-shadow.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-aix-prologue.exp * gdb.arch/thumb-bx-pc.exp * gdb.base/annota1.exp * gdb.base/annota3.exp * gdb.base/arrayidx.exp * gdb.base/assign.exp * gdb.base/attach.exp * gdb.base/auxv.exp * gdb.base/bang.exp * gdb.base/bfp-test.exp * gdb.base/bigcore.exp * gdb.base/bitfields2.exp * gdb.base/break-fun-addr.exp * gdb.base/break-probes.exp * gdb.base/call-rt-st.exp * gdb.base/callexit.exp * gdb.base/catch-fork-kill.exp * gdb.base/charset.exp * gdb.base/checkpoint.exp * gdb.base/comprdebug.exp * gdb.base/constvars.exp * gdb.base/coredump-filter.exp * gdb.base/cursal.exp * gdb.base/cvexpr.exp * gdb.base/detach.exp * gdb.base/display.exp * gdb.base/dmsym.exp * gdb.base/dprintf-pending.exp * gdb.base/dso2dso.exp * gdb.base/dtrace-probe.exp * gdb.base/dump.exp * gdb.base/enum_cond.exp * gdb.base/exe-lock.exp * gdb.base/exec-invalid-sysroot.exp * gdb.base/execl-update-breakpoints.exp * gdb.base/exprs.exp * gdb.base/fileio.exp * gdb.base/find.exp * gdb.base/finish.exp * gdb.base/fixsection.exp * gdb.base/foll-vfork.exp * gdb.base/frame-args.exp * gdb.base/gcore.exp * gdb.base/gdb1250.exp * gdb.base/global-var-nested-by-dso.exp * gdb.base/gnu-ifunc.exp * gdb.base/hashline1.exp * gdb.base/hashline2.exp * gdb.base/hashline3.exp * gdb.base/hbreak-in-shr-unsupported.exp * gdb.base/huge.exp * gdb.base/infcall-input.exp * gdb.base/info-fun.exp * gdb.base/info-shared.exp * gdb.base/jit-simple.exp * gdb.base/jit-so.exp * gdb.base/jit.exp * gdb.base/jump.exp * gdb.base/label.exp * gdb.base/lineinc.exp * gdb.base/logical.exp * gdb.base/longjmp.exp * gdb.base/macscp.exp * gdb.base/miscexprs.exp * gdb.base/new-ui-echo.exp * gdb.base/new-ui-pending-input.exp * gdb.base/new-ui.exp * gdb.base/nodebug.exp * gdb.base/nofield.exp * gdb.base/offsets.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/pointers.exp * gdb.base/pr11022.exp * gdb.base/printcmds.exp * gdb.base/prologue.exp * gdb.base/ptr-typedef.exp * gdb.base/realname-expand.exp * gdb.base/relativedebug.exp * gdb.base/relocate.exp * gdb.base/remote.exp * gdb.base/reread.exp * gdb.base/return2.exp * gdb.base/savedregs.exp * gdb.base/sep.exp * gdb.base/sepdebug.exp * gdb.base/sepsymtab.exp * gdb.base/set-inferior-tty.exp * gdb.base/setshow.exp * gdb.base/shlib-call.exp * gdb.base/sigaltstack.exp * gdb.base/siginfo-addr.exp * gdb.base/signals.exp * gdb.base/signull.exp * gdb.base/sigrepeat.exp * gdb.base/so-impl-ld.exp * gdb.base/solib-display.exp * gdb.base/solib-overlap.exp * gdb.base/solib-search.exp * gdb.base/solib-symbol.exp * gdb.base/structs.exp * gdb.base/structs2.exp * gdb.base/symtab-search-order.exp * gdb.base/twice.exp * gdb.base/unload.exp * gdb.base/varargs.exp * gdb.base/watchpoint-solib.exp * gdb.base/watchpoint.exp * gdb.base/whatis.exp * gdb.base/wrong_frame_bt_full.exp * gdb.btrace/dlopen.exp * gdb.cell/ea-standalone.exp * gdb.cell/ea-test.exp * gdb.cp/dispcxx.exp * gdb.cp/gdb2384.exp * gdb.cp/method2.exp * gdb.cp/nextoverthrow.exp * gdb.cp/pr10728.exp * gdb.disasm/am33.exp * gdb.disasm/h8300s.exp * gdb.disasm/mn10300.exp * gdb.disasm/sh3.exp * gdb.dwarf2/dw2-dir-file-name.exp * gdb.fortran/complex.exp * gdb.fortran/library-module.exp * gdb.guile/scm-pretty-print.exp * gdb.guile/scm-symbol.exp * gdb.guile/scm-type.exp * gdb.guile/scm-value.exp * gdb.linespec/linespec.exp * gdb.mi/gdb701.exp * gdb.mi/gdb792.exp * gdb.mi/mi-breakpoint-changed.exp * gdb.mi/mi-dprintf-pending.exp * gdb.mi/mi-dprintf.exp * gdb.mi/mi-exit-code.exp * gdb.mi/mi-pending.exp * gdb.mi/mi-solib.exp * gdb.mi/new-ui-mi-sync.exp * gdb.mi/pr11022.exp * gdb.mi/user-selected-context-sync.exp * gdb.opt/solib-intra-step.exp * gdb.python/py-events.exp * gdb.python/py-finish-breakpoint.exp * gdb.python/py-mi.exp * gdb.python/py-prettyprint.exp * gdb.python/py-shared.exp * gdb.python/py-symbol.exp * gdb.python/py-template.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/solib-reverse.exp * gdb.server/solib-list.exp * gdb.stabs/weird.exp * gdb.threads/reconnect-signal.exp * gdb.threads/stepi-random-signal.exp * gdb.trace/actions.exp * gdb.trace/ax.exp * gdb.trace/backtrace.exp * gdb.trace/change-loc.exp * gdb.trace/deltrace.exp * gdb.trace/ftrace-lock.exp * gdb.trace/ftrace.exp * gdb.trace/infotrace.exp * gdb.trace/mi-tracepoint-changed.exp * gdb.trace/packetlen.exp * gdb.trace/passcount.exp * gdb.trace/pending.exp * gdb.trace/range-stepping.exp * gdb.trace/report.exp * gdb.trace/stap-trace.exp * gdb.trace/tfind.exp * gdb.trace/trace-break.exp * gdb.trace/trace-condition.exp * gdb.trace/trace-enable-disable.exp * gdb.trace/trace-mt.exp * gdb.trace/tracecmd.exp * gdb.trace/tspeed.exp * gdb.trace/tsv.exp * lib/perftest.exp
2016-12-01 21:47:50 +01:00
untested "failed to compile"
* gdb.arch/altivec-abi.exp: Replace gdb_suppress_entire_file with untested followed by return combination. * gdb.arch/altivec-regs.exp: Likewise. * gdb.arch/e500-abi.exp: Likewise. * gdb.arch/e500-regs.exp: Likewise. * gdb.arch/gdb1291.exp: Likewise. * gdb.arch/gdb1431.exp: Likewise. * gdb.arch/gdb1558.exp: Likewise. * gdb.arch/i386-prologue.exp: Likewise. * gdb.arch/i386-unwind.exp: Likewise. * gdb.asm/asm-source.exp: Likewise. * gdb.base/a2-run.exp: Likewise. * gdb.base/advance.exp: Likewise. * gdb.base/all-bin.exp: Likewise. * gdb.base/annota1.exp: Likewise. * gdb.base/annota3.exp: Likewise. * gdb.base/args.exp: Likewise. * gdb.base/arithmet.exp: Likewise. * gdb.base/assign.exp: Likewise. * gdb.base/async.exp: Likewise. * gdb.base/attach.exp: Likewise. * gdb.base/bang.exp: Likewise. * gdb.base/bigcore.exp: Likewise. * gdb.base/bitfields.exp: Likewise. * gdb.base/bitfields2.exp: Likewise. * gdb.base/break.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/call-strs.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/checkpoint.exp: Likewise. * gdb.base/chng-syms.exp: Likewise. * gdb.base/code-expr.exp: Likewise. * gdb.base/commands.exp: Likewise. * gdb.base/completion.exp: Likewise. * gdb.base/cond-expr.exp: Likewise. * gdb.base/condbreak.exp: Likewise. * gdb.base/consecutive.exp: Likewise. * gdb.base/constvars.exp: Likewise. * gdb.base/corefile.exp: Likewise. * gdb.base/cvexpr.exp: Likewise. * gdb.base/dbx.exp: Likewise. * gdb.base/define.exp: Likewise. * gdb.base/detach.exp: Likewise. * gdb.base/display.exp: Likewise. * gdb.base/dump.exp: Likewise. * gdb.base/ena-dis-br.exp: Likewise. * gdb.base/ending-run.exp: Likewise. * gdb.base/environ.exp: Likewise. * gdb.base/eval-skip.exp: Likewise. * gdb.base/exprs.exp: Likewise. * gdb.base/fileio.exp: Likewise. * gdb.base/finish.exp: Likewise. * gdb.base/float.exp: Likewise. * gdb.base/foll-exec.exp: Likewise. * gdb.base/foll-fork.exp: Likewise. * gdb.base/foll-vfork.exp: Likewise. * gdb.base/freebpcmd.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/gcore.exp: Likewise. * gdb.base/gdb1090.exp: Likewise. * gdb.base/gdb1250.exp: Likewise. * gdb.base/huge.exp: Likewise. * gdb.base/info-proc.exp: Likewise. * gdb.base/interrupt.exp: Likewise. * gdb.base/jump.exp: Likewise. * gdb.base/langs.exp: Likewise. * gdb.base/lineinc.exp: Likewise. * gdb.base/list.exp: Likewise. * gdb.base/logical.exp: Likewise. * gdb.base/long_long.exp: Likewise. * gdb.base/macscp.exp: Likewise. * gdb.base/maint.exp: Likewise. * gdb.base/mips_pro.exp: Likewise. * gdb.base/miscexprs.exp: Likewise. * gdb.base/multi-forks.exp: Likewise. * gdb.base/opaque.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/pc-fp.exp: Likewise. * gdb.base/pointers.exp: Likewise. * gdb.base/printcmds.exp: Likewise. * gdb.base/psymtab.exp: Likewise. * gdb.base/ptype.exp: Likewise. * gdb.base/recurse.exp: Likewise. * gdb.base/relational.exp: Likewise. * gdb.base/relocate.exp: Likewise. * gdb.base/remote.exp: Likewise. * gdb.base/reread.exp: Likewise. * gdb.base/restore.exp: Likewise. * gdb.base/return.exp: Likewise. * gdb.base/return2.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sect-cmd.exp: Likewise. * gdb.base/sep.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/setshow.exp: Likewise. * gdb.base/setvar.exp: Likewise. * gdb.base/sigall.exp: Likewise. * gdb.base/sigbpt.exp: Likewise. * gdb.base/signals.exp: Likewise. * gdb.base/signull.exp: Likewise. * gdb.base/sizeof.exp: Likewise. * gdb.base/solib.exp: Likewise. * gdb.base/step-line.exp: Likewise. * gdb.base/step-test.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/structs2.exp: Likewise. * gdb.base/term.exp: Likewise. * gdb.base/twice.exp: Likewise. * gdb.base/until.exp: Likewise. * gdb.base/varargs.exp: Likewise. * gdb.base/volatile.exp: Likewise. * gdb.base/watchpoint.exp: Likewise. * gdb.base/whatis-exp.exp: Likewise. * gdb.base/whatis.exp: Likewise. * gdb.cp/ambiguous.exp: Likewise. * gdb.cp/annota2.exp: Likewise. * gdb.cp/annota3.exp: Likewise. * gdb.cp/bool.exp: Likewise. * gdb.cp/breakpoint.exp: Likewise. * gdb.cp/casts.exp: Likewise. * gdb.cp/class2.exp: Likewise. * gdb.cp/classes.exp: Likewise. * gdb.cp/cplusfuncs.exp: Likewise. * gdb.cp/ctti.exp: Likewise. * gdb.cp/derivation.exp: Likewise. * gdb.cp/exception.exp: Likewise. * gdb.cp/gdb1355.exp: Likewise. * gdb.cp/hang.exp: Likewise. * gdb.cp/inherit.exp: Likewise. * gdb.cp/local.exp: Likewise. * gdb.cp/m-data.exp: Likewise. * gdb.cp/m-static.exp: Likewise. * gdb.cp/member-ptr.exp: Likewise. * gdb.cp/method.exp: Likewise. * gdb.cp/misc.exp: Likewise. * gdb.cp/namespace.exp: Likewise. * gdb.cp/overload.exp: Likewise. * gdb.cp/ovldbreak.exp: Likewise. * gdb.cp/pr-1023.exp: Likewise. * gdb.cp/pr-1210.exp: Likewise. * gdb.cp/pr-574.exp: Likewise. * gdb.cp/printmethod.exp: Likewise. * gdb.cp/psmang.exp: Likewise. * gdb.cp/ref-params.exp: Likewise. * gdb.cp/ref-types.exp: Likewise. * gdb.cp/rtti.exp: Likewise. * gdb.cp/templates.exp: Likewise. * gdb.cp/try_catch.exp: Likewise. * gdb.cp/userdef.exp: Likewise. * gdb.cp/virtfunc.exp: Likewise. * gdb.disasm/am33.exp: Likewise. * gdb.disasm/h8300s.exp: Likewise. * gdb.disasm/mn10300.exp: Likewise. * gdb.disasm/sh3.exp: Likewise. * gdb.disasm/t01_mov.exp: Likewise. * gdb.disasm/t02_mova.exp: Likewise. * gdb.disasm/t03_add.exp: Likewise. * gdb.disasm/t04_sub.exp: Likewise. * gdb.disasm/t05_cmp.exp: Likewise. * gdb.disasm/t06_ari2.exp: Likewise. * gdb.disasm/t07_ari3.exp: Likewise. * gdb.disasm/t08_or.exp: Likewise. * gdb.disasm/t09_xor.exp: Likewise. * gdb.disasm/t10_and.exp: Likewise. * gdb.disasm/t11_logs.exp: Likewise. * gdb.disasm/t12_bit.exp: Likewise. * gdb.disasm/t13_otr.exp: Likewise. * gdb.hp/gdb.aCC/optimize.exp: Likewise. * gdb.hp/gdb.aCC/watch-cmd.exp: Likewise. * gdb.hp/gdb.base-hp/callfwmall.exp: Likewise. * gdb.hp/gdb.base-hp/dollar.exp: Likewise. * gdb.hp/gdb.base-hp/hwwatchbus.exp: Likewise. * gdb.hp/gdb.base-hp/pxdb.exp: Likewise. * gdb.hp/gdb.base-hp/reg-pa64.exp: Likewise. * gdb.hp/gdb.base-hp/reg.exp: Likewise. * gdb.hp/gdb.base-hp/sized-enum.exp: Likewise. * gdb.hp/gdb.compat/xdb1.exp: Likewise. * gdb.hp/gdb.compat/xdb3.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg01.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg02.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg03.exp: Likewise. * gdb.hp/gdb.objdbg/objdbg04.exp: Likewise. * gdb.mi/gdb701.exp: Likewise. * gdb.mi/gdb792.exp: Likewise. * gdb.mi/mi-basics.exp: Likewise. * gdb.mi/mi-break.exp: Likewise. * gdb.mi/mi-cli.exp: Likewise. * gdb.mi/mi-console.exp: Likewise. * gdb.mi/mi-disassemble.exp: Likewise. * gdb.mi/mi-eval.exp: Likewise. * gdb.mi/mi-file.exp: Likewise. * gdb.mi/mi-read-memory.exp: Likewise. * gdb.mi/mi-regs.exp: Likewise. * gdb.mi/mi-return.exp: Likewise. * gdb.mi/mi-simplerun.exp: Likewise. * gdb.mi/mi-stack.exp: Likewise. * gdb.mi/mi-stepi.exp: Likewise. * gdb.mi/mi-syn-frame.exp: Likewise. * gdb.mi/mi-until.exp: Likewise. * gdb.mi/mi-var-block.exp: Likewise. * gdb.mi/mi-var-child.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi-var-display.exp: Likewise. * gdb.mi/mi-watch.exp: Likewise. * gdb.mi/mi2-basics.exp: Likewise. * gdb.mi/mi2-break.exp: Likewise. * gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-console.exp: Likewise. * gdb.mi/mi2-disassemble.exp: Likewise. * gdb.mi/mi2-eval.exp: Likewise. * gdb.mi/mi2-file.exp: Likewise. * gdb.mi/mi2-read-memory.exp: Likewise. * gdb.mi/mi2-regs.exp: Likewise. * gdb.mi/mi2-return.exp: Likewise. * gdb.mi/mi2-simplerun.exp: Likewise. * gdb.mi/mi2-stack.exp: Likewise. * gdb.mi/mi2-stepi.exp: Likewise. * gdb.mi/mi2-syn-frame.exp: Likewise. * gdb.mi/mi2-until.exp: Likewise. * gdb.mi/mi2-var-block.exp: Likewise. * gdb.mi/mi2-var-child.exp: Likewise. * gdb.mi/mi2-var-cmd.exp: Likewise. * gdb.mi/mi2-var-display.exp: Likewise. * gdb.mi/mi2-watch.exp: Likewise. * gdb.stabs/exclfwd.exp: Likewise. * gdb.stabs/weird.exp: Likewise. * gdb.threads/gcore-thread.exp: Likewise. * gdb.trace/actions.exp: Likewise. * gdb.trace/backtrace.exp: Likewise. * gdb.trace/circ.exp: Likewise. * gdb.trace/collection.exp: Likewise. * gdb.trace/deltrace.exp: Likewise. * gdb.trace/infotrace.exp: Likewise. * gdb.trace/limits.exp: Likewise. * gdb.trace/packetlen.exp: Likewise. * gdb.trace/passc-dyn.exp: Likewise. * gdb.trace/passcount.exp: Likewise. * gdb.trace/report.exp: Likewise. * gdb.trace/save-trace.exp: Likewise. * gdb.trace/tfind.exp: Likewise. * gdb.trace/tracecmd.exp: Likewise. * gdb.trace/while-dyn.exp: Likewise. * gdb.trace/while-stepping.exp: Likewise.
2006-08-10 07:27:22 +02:00
return -1
1999-05-05 23:45:13 +02:00
}
clean_restart ${binfile}
1999-05-05 23:45:13 +02:00
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
1999-05-05 23:45:13 +02:00
#
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
2016-04-22 16:35:07 +02:00
# break in main
1999-05-05 23:45:13 +02:00
#
set main_line [gdb_get_line_number "break main"]
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
2016-04-22 16:35:07 +02:00
gdb_test "break ${srcfile}:${main_line}" \
"Breakpoint.*at.* file .*$srcfile, line $main_line\\." \
1999-05-05 23:45:13 +02:00
"breakpoint main"
#
# NOTE: this prompt is OK only when the annotation level is > 1
# NOTE: When this prompt is in use the gdb_test procedure cannot be used because
# it assumes that the last char after the gdb_prompt is a white space. This is not
# true with this annotated prompt. So we must use send_gdb and gdb_expect.
#
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
#
# Escape all the characters in the path that need it. For instance
# the directory name could contain '+'.
#
set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
1999-05-05 23:45:13 +02:00
#
# set the annotation level to 2
#
# of course, this will test:
# annotate-pre-prompt
# annotate-prompt
# annotate-post-prompt (in the next block)
#
send_gdb "set annotate 2\n"
gdb_expect {
-re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
-re ".*$gdb_prompt$" { fail "annotation set at level 2" }
timeout { fail "annotation set at level 2 (timeout)" }
}
#
# info break will test:
# annotate-breakpoints-headers
# annotate-field
# annotate-breakpoints-table
# annotate-record
# annotate-breakpoints-table-end
#
gdb_test_multiple "info break" "breakpoint info" {
-re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" {
pass "breakpoint info"
}
-re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" {
setup_xfail "*-*-*" 1270
fail "breakpoint info"
}
1999-05-05 23:45:13 +02:00
}
#
# run to a break point will test:
# annotate-frames-invalid
# annotate-breakpoints-invalid (a.k.a. breakpoints-changed)
# annotate-starting
# annotate-breakpoint
# annotate-frame-begin
# annotate-frame-function-name
# annotate-frame-args
# annotate-frame-source-begin
# annotate-frame-source-file
# annotate-frame-source-file-end
# annotate-frame-source-line
# annotate-frame-source-end
# annotate-source
# annotate-frame-end
# annotate-stopped
#
1999-05-25 20:09:09 +02:00
#exp_internal 1
set binexp [string_to_regexp $binfile]
gdb_test_multiple "run" "run until main breakpoint" {
-re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\.\)?\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" {
pass "run until main breakpoint"
}
}
1999-05-25 20:09:09 +02:00
#exp_internal 0
#exit 0
1999-05-05 23:45:13 +02:00
#
# Let's do a next, to get to a point where the array is initialized
# We don't care about the annotated output for this operation, it is the same as
# the one produced by run above
#
gdb_test_multiple "next" "go after array init line" {
-re "source .*annota1.c.*$gdb_prompt$" {
pass "go after array init line"
}
1999-05-05 23:45:13 +02:00
}
#
# printing the array will test:
# annotate-value-history-begin
# annotate-value-history-value
# annotate-array-section-begin
# annotate-elt
# FIXME: annotate-elt-rep and annotate-elt-rep-end not tested
# annotate-array-section-end
# annotate-value-history-end
# FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output
# command would cause them to be used)
#
gdb_test_multiple "print my_array" "print array" {
-re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n.\r\n\032\032array-section-begin 0 -\r\n1\r\n\032\032elt\r\n, 2\r\n\032\032elt\r\n, 3\r\n\032\032elt\r\n\r\n\032\032array-section-end\r\n.\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" {
pass "print array"
}
1999-05-05 23:45:13 +02:00
}
#
# this should generate an error message, so to test:
# annotate-error-begin
# FIXME: annotate-error not tested
#
#exp_internal 1
gdb_test_multiple "print non_existent_value" "print non_existent_value" {
-re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" {
pass "print non_existent_value"
}
1999-05-05 23:45:13 +02:00
}
#
# break at signal handler. So that, once we are in the sig handler, if we do a bt
# we can test annotate-signal-handler-caller
#
gdb_test_multiple "break handle_USR1" "break handle_USR1" {
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
pass "break handle_USR1"
}
1999-05-05 23:45:13 +02:00
}
#
# break at printf. When we are stopped at printf, we can test
#
gdb_test_multiple "break printf" "break printf" {
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex.*\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
pass "break printf"
}
-re "\r\n\032\032post-prompt\r\nwarning: Breakpoint address adjusted from $hex to $hex.\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" {
pass "break printf"
}
1999-05-05 23:45:13 +02:00
}
#
# get to printf
#
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n${breakpoints_invalid}"
set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n"
set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$"
gdb_test_multiple "continue" "continue to printf" {
-re "${pat_begin}($pat_adjust)?$pat_end" {
pass "continue to printf"
}
-re ".*$gdb_prompt$" { fail "continue to printf" }
1999-05-05 23:45:13 +02:00
}
#
# test:
# annotate-frame-where
# annotate-frame-address
# annotate-frame-address-end
#
set pat_begin "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n"
set pat_end "\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$"
gdb_test_multiple "backtrace" "backtrace from shlibrary" {
-re "$pat_begin$escapedsrcfile$pat_end" {
pass "backtrace from shlibrary"
}
-re "$pat_begin.*$srcfile$pat_end" {
setup_xfail "*-*-*" 1270
fail "backtrace from shlibrary"
}
1999-05-05 23:45:13 +02:00
}
#
# test printing a frame with some arguments:
# annotate-arg-begin
# annotate-arg-name-end
# annotate-arg-value
# annotate-arg-end
#
if [target_info exists gdb,nosignals] {
unsupported "send SIGUSR1"
unsupported "backtrace @ signal handler"
} else {
gdb_test_multiple "signal SIGUSR1" "send SIGUSR1" {
-re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
pass "send SIGUSR1"
}
-re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
setup_xfail "*-*-*" 1270
fail "send SIGUSR1"
}
}
1999-05-05 23:45:13 +02:00
#
# test:
# annotate-signal-handler-caller
#
gdb_test_multiple "backtrace" "backtrace @ signal handler" {
-re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" {
pass "backtrace @ signal handler"
}
}
1999-05-05 23:45:13 +02:00
}
#
# delete all the breakpoints
#
gdb_test_multiple "delete 1" "delete bp 1" {
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
pass "delete bp 1"
}
1999-05-05 23:45:13 +02:00
}
gdb_test_multiple "delete 2" "delete bp 2" {
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
pass "delete bp 2"
}
1999-05-05 23:45:13 +02:00
}
gdb_test_multiple "delete 3" "delete bp 3" {
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" {
pass "delete bp 3"
}
1999-05-05 23:45:13 +02:00
}
#
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
2016-04-22 16:35:07 +02:00
# break in main, after value is initialized. This is in preparation
1999-05-05 23:45:13 +02:00
# to test the annotate output for the display command.
#
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
2016-04-22 16:35:07 +02:00
set test "break in main"
gdb_test_multiple "break ${srcfile}:${main_line}" $test {
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "post-prompt.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
2016-04-22 16:35:07 +02:00
pass $test
}
All annotate_breakpoints_changed calls are along-side observer_notify_breakpoints_changed calls. All, except the init_raw_breakpoint one. But that one is actually wrong. The breakpoint is being constructed at that point, and hasn't been placed on the breakpoint chain yet. It would be better placed in install_breakpoint, and I actually started out that way. But once the annotate_breakpoints_changed are parallel to the observer calls, we can fully move annotations to observers too. One issue is that this changes the order of annotations a bit. Before, we'd emit the annotation, and after call "mention()" on the breakpoint (which prints the breakpoint number, etc.). But, we call the observers _after_ mention is called, so the annotation output will change a little: void install_breakpoint (int internal, struct breakpoint *b, int update_gll) { add_to_breakpoint_chain (b); set_breakpoint_number (internal, b); if (is_tracepoint (b)) set_tracepoint_count (breakpoint_count); if (!internal) mention (b); observer_notify_breakpoint_created (b); if (update_gll) update_global_location_list (1); } I believe this order doesn't really matter (the frontend needs to wait for the prompt anyway), so I just adjust the expected output in the tests. Emacs in annotations mode doesn't seem to complain. Couple that with the previous patch that suppressed duplicated annotations, and, the fact that some annotations calls were actually missing (were we do have observer calls), more changes to the tests are needed anyway. Tested on x86_64 Fedora 17. gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (annotate_breakpoints_changed): Rename to ... (annotate_breakpoints_invalid): ... this. Make static. (breakpoint_changed): Adjust. (_initialize_annotate): Always install the observers. Install a "breakpoint_created" observer. * annotate.h (annotate_breakpoints_changed): Delete declaration. * breakpoint.c (set_breakpoint_condition) (breakpoint_set_commands, do_map_commands_command) (init_raw_breakpoint, clear_command, set_ignore_count) (enable_breakpoint_disp): No longer call annotate_breakpoints_changed. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (breakpoints_invalid): New variable. Adjust tests to breakpoints-invalid changes. * gdb.cp/annota2.exp (breakpoints_invalid, frames_invalid): New variables. Adjust tests to breakpoints-invalid changes.
2013-01-22 21:19:40 +01:00
-re "post-prompt.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*\032\032breakpoints-invalid.*$gdb_prompt$" {
setup_xfail "*-*-*" 1270
Fix fail in gdb.base/annota1.exp and gdb.base/annota3.exp Hi, I am seeing the fail below on aarch64-linux with gcc 4.9.2, break main Breakpoint 1 at 0x4006e8: file binutils-gdb/gdb/testsuite/gdb.base/annota1.c, line 14.^M (gdb) FAIL: gdb.base/annota1.exp: breakpoint main the test expects the breakpoint is set on line 15. Let us look at the main function, 12 int 13 main (void) 14 { 15 int my_array[3] = { 1, 2, 3 }; /* break main */ 16 17 value = 7; 18 19 #ifdef SIGUSR1 20 signal (SIGUSR1, handle_USR1); 21 #endif (gdb) disassemble main Dump of assembler code for function main: 0x00000000004006e0 <+0>: stp x29, x30, [sp,#-48]! 0x00000000004006e4 <+4>: mov x29, sp 0x00000000004006e8 <+8>: adrp x0, 0x411000 <signal@got.plt> 0x00000000004006ec <+12>: add x0, x0, #0x40 the breakpoint is set on the right address after skipping prologue, but 0x00000000004006e8 is mapped to the line 14, as shown below, (gdb) maintenance info line-table objfile: /home/yao.qi/source/build-aarch64/gdb/testsuite/outputs/gdb.base/annota1/annota1 ((struct objfile *) 0x2b0e1850) compunit_symtab: ((struct compunit_symtab *) 0x2b0ded50) symtab: /home/yao.qi/source/binutils-gdb/gdb/testsuite/gdb.base/annota1.c ((struct symtab *) 0x2b0dedd0) linetable: ((struct linetable *) 0x2b12c8b0): INDEX LINE ADDRESS 0 7 0x00000000004006d0 1 8 0x00000000004006d8 2 14 0x00000000004006e0 3 14 0x00000000004006e8 4 15 0x00000000004006fc so GDB does nothing wrong. Program hits breakpoint on either line 14 or line 15 is right to me. With anther gcc (4.9.3), the line-table looks correct, and no test fail. Instead of setting breakpoint on main and assuming the line is what we get from the source, we can set breakpoint on that line. On the other hand, the test prints the values of the array and check, so we need to set breakpoint on the line setting the values of array and "next", rather than setting the breakpoint on main. gdb/testsuite: 2016-04-22 Yao Qi <yao.qi@linaro.org> * gdb.base/annota1.exp: Set breakpoint on line $main_line. * gdb.base/annota3.exp: Likewise.
2016-04-22 16:35:07 +02:00
fail $test
}
1999-05-05 23:45:13 +02:00
}
#
# display the value; test:
# annotate-display-begin
# annotate-display-number-end
# annotate-display-format
# annotate-display-expression
# annotate-display-expression-end
# annotate-display-end
# FIXME: annotate-display-value not tested
#
gdb_test_multiple "display value" "set up display" {
-re "post-prompt\r\n\r\n\032\032display-begin\r\n1\r\n\032\032display-number-end\r\n: \r\n\032\032display-format\r\n\r\n\032\032display-expression\r\nvalue\r\n\032\032display-expression-end\r\n = \r\n\032\032display-expression\r\n7\r\n\r\n\032\032display-end\r\n$gdb_prompt$" {
pass "set up display"
}
1999-05-05 23:45:13 +02:00
}
# should ask query. Test annotate-query.
# we don't care about anything else here, only the query.
send_gdb "run\n"
gdb_expect {
-re "pre-query.*already.*\\(y or n\\).*query\r\n" {
send_gdb "y\n"
gdb_expect {
-re ".*post-query.*$gdb_prompt$" \
{ pass "re-run" }
-re ".*$gdb_prompt$" { fail "re-run" }
timeout { fail "re-run (timeout)" }
}
}
-re ".*$gdb_prompt$" { fail "re-run" }
timeout { fail "re-run (timeout)" }
}
1999-11-02 05:44:47 +01:00
#
# Test that breakpoints-invalid is issued once and only once for
# breakpoint ignore count changes, after annotation stopped.
#
set value_inc_line [gdb_get_line_number "increment value"]
gdb_test_multiple "break $value_inc_line" "break at value++" {
-re "Breakpoint 5 at $hex: file .*$srcfile, line $value_inc_line.*$gdb_prompt$" {
pass "break at value++"
1999-11-02 05:44:47 +01:00
}
}
gdb_test_multiple "ignore 5 4" "ignore 5 4" {
1999-11-02 05:44:47 +01:00
-re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" {
pass "ignore 5 4"
}
}
gdb_test_multiple "continue" "annotate ignore count change" {
There's code in annotate.c and breakpoint.c that is supposed to suppress multiple breakpoints-invalid annotations when the ignore count of a breakpoint changes, up until the target actually stops. But, the code is bogus: void annotate_breakpoints_changed (void) { if (annotation_level == 2) { target_terminal_ours (); printf_unfiltered (("\n\032\032breakpoints-invalid\n")); if (ignore_count_changed) ignore_count_changed = 0; /* Avoid multiple break annotations. */ } } The "ignore_count_changed" flag isn't actually guarding the output of the annotation at all. It would have been better written something like: void annotate_breakpoints_changed (void) { if (annotation_level == 2 && !ignore_count_changed) { target_terminal_ours (); printf_unfiltered (("\n\032\032breakpoints-invalid\n")); ignore_count_changed = 0; /* Avoid multiple break annotations. */ } } but, it wasn't. AFAICS, that goes all the way back to the original patch'es submission and check in, at <http://sourceware.org/ml/gdb-patches/1999-q4/msg00106.html>. I looked a tar of HP's wdb from 1999, and even though that contains local changes in the annotate code, this suppression seems borked there too to me. The original patch added a test to supposedly exercise this suppression, but, it actually doesn't. It merely tests that "breakpoints-invalid" is output after "stopped", but doesn't check whether the duplicates supression actually works (IOW, check that only _one_ annotation is seen). I was going to simply delete the tests too, but a following patch will eliminate the duplicates in a different way (which I needed for a different reason), so instead, I'm making the tests actually fail if a duplicate annotation is seen. Worry not, the test doesn't actually fail! The reason is that breakpoint.c does: else if (b->ignore_count > 0) { b->ignore_count--; annotate_ignore_count_change (); bs->stop = 0; /* Increase the hit count even though we don't stop. */ ++(b->hit_count); observer_notify_breakpoint_modified (b); } where the annotate_ignore_count_change call is meant to inform the "breakpoint_modified" annotation observer to ignore the notification. All sounds good. But, the trouble is that nowadays annotate.c only installs the observers if GDB is started with annotations enabled with a command line option (gdb --annotate=2): void _initialize_annotate (void) { if (annotation_level == 2) { observer_attach_breakpoint_deleted (breakpoint_changed); observer_attach_breakpoint_modified (breakpoint_changed); } } and annota1.exp, to enable annotations, starts GDB normally, and afterwards does "set annotate 2", so the observers aren't installed when annota1.exp is run, and therefore changing the ignore count isn't triggering any annotation at all... gdb/ 2013-01-22 Pedro Alves <palves@redhat.com> * annotate.c (ignore_count_changed): Delete. (annotate_breakpoints_changed): Don't clear ignore_count_changed. (annotate_ignore_count_change): Delete. (annotate_stopped): Don't emit a delayed breakpoints-changed annotation. * annotate.h (annotate_ignore_count_change): Delete. * breakpoint.c (bpstat_check_breakpoint_conditions): Don't call annotate_ignore_count_change. gdb/testsuite/ 2013-01-22 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (annotate ignore count change): Add expected output for failure case.
2013-01-22 21:08:30 +01:00
-re ".*breakpoints-invalid.*breakpoints-invalid.*$gdb_prompt$" {
fail "annotate ignore count change"
}
-re ".*$srcfile:$value_inc_line:.*\032\032stopped\r\n$gdb_prompt$" {
1999-11-02 05:44:47 +01:00
pass "annotate ignore count change"
}
}
# check that ignore command is working, or the above can provide
# misleading assurance ...
gdb_test_multiple "next" "next to exit loop" {
-re "source .*annota1.c.*$gdb_prompt$" {
}
1999-11-02 05:44:47 +01:00
}
set after_loop_line [gdb_get_line_number "after loop"]
gdb_test_multiple "next" "breakpoint ignore count" {
-re ".*$srcfile:$after_loop_line:.*$gdb_prompt$" {
1999-11-02 05:44:47 +01:00
pass "breakpoint ignore count"
}
}
1999-05-05 23:45:13 +02:00
# Get the inferior's PID for later.
set test "get inferior pid"
set pid -1
gdb_test_multiple "info inferior 1" "$test" {
-re "process (\[0-9\]*).*$gdb_prompt$" {
set pid $expect_out(1,string)
pass "$test"
}
}
1999-05-05 23:45:13 +02:00
#
# Send a signal that is not handled; test:
# annotate-signalled
# annotate-signal-name
# annotate-signal-name-end
# annotate-signal-string
# annotate-signal-string-end
# FIXME: annotate-signal not tested (requires that the inferior be
# stopped by a "random" signal)
if [target_info exists gdb,nosignals] {
unsupported "signal sent"
} else {
gdb_test_multiple "signal SIGTRAP" "signal sent" {
-re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
pass "signal sent"
}
}
1999-05-05 23:45:13 +02:00
}
# Check for production of a core file and remove it!
1999-05-05 23:45:13 +02:00
set test "cleanup core file"
if { [remote_file host exists core] } {
remote_file host delete core
pass "$test (removed)"
} elseif { $pid != -1 && [remote_file host exists core.$pid] } {
remote_file host delete core.$pid
pass "$test (removed)"
1999-05-05 23:45:13 +02:00
} else {
pass "$test (not dumped)"
1999-05-05 23:45:13 +02:00
}
2008-05-20 23:11:04 +02:00
proc thread_test {} {
watch_thread_num.exp and targets with fairer event reporting This patch fixes the watch_thread_num.exp test to work when the target is better at making event handling be fair among threads. I wrote patches that make GDB native and GDBserver event handling fairer between threads. That is, if threads A and B both simultaneously trigger some debug event, GDB will pick either A or B at random, rather than always handling the event of A first. There's code for that in the Linux backends (gdb and gdbserver) already, but it can be improved, and only works in all-stop mode. With those fixes in place, I found that the watch_thread_num.exp would often time out. The problem is that the test only works _because_ event handling isn't as fair as intended. With the fairness fixes, the test falls victim of PR10116 (gdb drops watchpoints on multi-threaded apps) quite often. To expand on the PR10116 reference, consider that stop events are serialized to GDB core, through target_wait. Say a thread-specific watchpoint as set on thread A. When the "right" thread and some other "wrong" thread both trigger a watchpoint simultaneously, the target may report the "wrong" thread's hit to GDB first (thread B). When handling that event, GDB notices the watchpoint is for another thread, and so shouldn't cause a user-visible stop. On resume, GDB saves the now current value of the watched expression. Afterwards, the "right" thread (thread A) reports its watchpoint trigger. But the watched value hasn't changed since GDB last saved it, and so GDB doesn't report the watchpoint hit to the user. The way the test is written, the watchpoint is associated with the first thread that happens to report an event. It happens that GDB is processing events much more often for one of the threads, which usually will be that same first thread. Hacking the test with "set debug infrun 1", we see exactly that: $ grep "infrun.*\[Thread.*," testsuite/gdb.log | sort | uniq -c | sort -nr 70 infrun: 8798 [Thread 8798], 37 infrun: 8798 [Thread 8802], 36 infrun: 8798 [Thread 8804], 36 infrun: 8798 [Thread 8803], 35 infrun: 8798 [Thread 8805], 34 infrun: 8798 [Thread 8806], The first column shows the number of times the target reported an event for that thread, from: infrun: target_wait (-1, status) = infrun: 8798 [Thread 8798], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP This masks out the PR10116 issue. However, if the target is better at giving equal priority to all threads, the PR10116 issue happens often, so it may take quite a while for the right thread to be the first to report its watchpoint event just after the memory being watched really changed, resulting in test time outs. Here's the number of events handled for each thread on a gdbserver run with the event fairness patches: $ grep "infrun.*\[Thread.*," gdb.log | sort | uniq -c 2961 infrun: 13591 [Thread 13591], 2956 infrun: 13591 [Thread 13595], 2941 infrun: 13591 [Thread 13596], 2932 infrun: 13591 [Thread 13597], 2905 infrun: 13591 [Thread 13598], 2891 infrun: 13591 [Thread 13599], Note how the number of events is much higher. The test routinely takes over 10 seconds to finish on my machine rather than under a second as with unpatched gdbserver, when it succeeds, but often it'll fail with timeouts too. So to make the test robust, this patch switches the tests to using "awatch" instead of "watch", as access watchpoints don't care about the watchpoint's "old value". With this, the test always finishes quickly, and we can even bump the number of threads concurrently writting to the shared variable, to have better assurance we're really testing the case of the "wrong" thread triggering a watchpoint. Here's the number of events I see for each thread on a run on my machine, with a gdbserver patched with the event fairness series: $ grep "infrun.*\[Thread.*," testsuite/gdb.log | sort | uniq -c 5 infrun: 5298 [Thread 5302], 4 infrun: 5298 [Thread 5303], 4 infrun: 5298 [Thread 5304], 4 infrun: 5298 [Thread 5305], 4 infrun: 5298 [Thread 5306], 4 infrun: 5298 [Thread 5307], 4 infrun: 5298 [Thread 5308], 4 infrun: 5298 [Thread 5309], 4 infrun: 5298 [Thread 5310], 4 infrun: 5298 [Thread 5311], 4 infrun: 5298 [Thread 5312], 4 infrun: 5298 [Thread 5313], 4 infrun: 5298 [Thread 5314], 4 infrun: 5298 [Thread 5315], 4 infrun: 5298 [Thread 5316], gdb/testsuite/ 2015-01-09 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (thread_test): Use srcfile and binfile from the global scope. Set a breakpoint after all threads are started rather than stepping over two source lines. Expect the prompt. * gdb.base/watch_thread_num.c (threads_started_barrier): New global. (NUM): Now 15. (main): Use threads_started_barrier to wait for all threads to start. Main thread no longer calls thread_function. Exit after 180 seconds. (loop): New function. (thread_function): Wait on threads_started_barrier barrier. Call 'loop' at each iteration. * gdb.base/watch_thread_num.exp: Continue to breakpoint after all threads have started, instead of hardcoding number of "next" steps. Use an access watchpoint instead of a write watchpoint.
2014-12-29 20:41:05 +01:00
global subdir srcdir testfile srcfile binfile
2008-05-20 23:11:04 +02:00
global gdb_prompt old_gdb_prompt
set srcfile watch_thread_num.c
set binfile [standard_output_file ${testfile}-watch_thread_num]
2008-05-20 23:11:04 +02:00
set gdb_prompt $old_gdb_prompt
* lib/gdb.exp (skip_altivec_tests, skip_vsx_tests) (build_executable): Update. (get_compiler_info): Remove 'binfile' argument. * gdb.ada/arrayidx.exp: Update. * gdb.ada/null_array.exp: Update. * gdb.arch/altivec-abi.exp: Update. * gdb.arch/altivec-regs.exp: Update. * gdb.arch/amd64-byte.exp: Update. * gdb.arch/amd64-dword.exp: Update. * gdb.arch/amd64-word.exp: Update. * gdb.arch/i386-avx.exp: Update. * gdb.arch/i386-byte.exp: Update. * gdb.arch/i386-sse.exp: Update. * gdb.arch/i386-word.exp: Update. * gdb.arch/ppc-dfp.exp: Update. * gdb.arch/ppc-fp.exp: Update. * gdb.arch/vsx-regs.exp: Update. * gdb.base/all-bin.exp: Update. * gdb.base/annota1.exp: Update. * gdb.base/async.exp: Update. * gdb.base/attach.exp: Update. * gdb.base/break-interp.exp: Update. * gdb.base/call-ar-st.exp: Update. * gdb.base/call-rt-st.exp: Update. * gdb.base/call-sc.exp: Update. * gdb.base/callfuncs.exp: Update. * gdb.base/catch-load.exp: Update. * gdb.base/completion.exp: Update. * gdb.base/complex.exp: Update. * gdb.base/condbreak.exp: Update. * gdb.base/consecutive.exp: Update. * gdb.base/constvars.exp: Update. * gdb.base/corefile.exp: Update. * gdb.base/eval-skip.exp: Update. * gdb.base/expand-psymtabs.exp: Update. * gdb.base/exprs.exp: Update. * gdb.base/fileio.exp: Update. * gdb.base/fixsection.exp: Update. * gdb.base/funcargs.exp: Update. * gdb.base/gdb11530.exp: Update. * gdb.base/gdb1555.exp: Update. * gdb.base/gnu-ifunc.exp: Update. * gdb.base/gnu_vector.exp: Update. * gdb.base/info-macros.exp: Update. * gdb.base/jit-simple.exp: Update. * gdb.base/jit-so.exp: Update. * gdb.base/jit.exp: Update. * gdb.base/langs.exp: Update. * gdb.base/list.exp: Update. * gdb.base/logical.exp: Update. * gdb.base/long_long.exp: Update. * gdb.base/longjmp.exp: Update. * gdb.base/macscp.exp: Update. * gdb.base/mips_pro.exp: Update. * gdb.base/miscexprs.exp: Update. * gdb.base/morestack.exp: Update. * gdb.base/nodebug.exp: Update. * gdb.base/opaque.exp: Update. * gdb.base/pc-fp.exp: Update. * gdb.base/pending.exp: Update. * gdb.base/permissions.exp: Update. * gdb.base/pointers.exp: Update. * gdb.base/prelink.exp: Update. * gdb.base/printcmds.exp: Update. * gdb.base/psymtab.exp: Update. * gdb.base/ptype.exp: Update. * gdb.base/relational.exp: Update. * gdb.base/scope.exp: Update. * gdb.base/setvar.exp: Update. * gdb.base/shlib-call.exp: Update. * gdb.base/shreloc.exp: Update. * gdb.base/signals.exp: Update. * gdb.base/sizeof.exp: Update. * gdb.base/so-impl-ld.exp: Update. * gdb.base/so-indr-cl.exp: Update. * gdb.base/solib-disc.exp: Update. * gdb.base/solib-display.exp: Update. * gdb.base/solib-nodir.exp: Update. * gdb.base/solib-overlap.exp: Update. * gdb.base/solib-symbol.exp: Update. * gdb.base/solib-weak.exp: Update. * gdb.base/solib.exp: Update. * gdb.base/store.exp: Update. * gdb.base/structs.exp: Update. * gdb.base/structs2.exp: Update. * gdb.base/type-opaque.exp: Update. * gdb.base/unload.exp: Update. * gdb.base/varargs.exp: Update. * gdb.base/volatile.exp: Update. * gdb.base/watch_thread_num.exp: Update. * gdb.base/watchpoint-solib.exp: Update. * gdb.base/watchpoint.exp: Update. * gdb.base/watchpoints.exp: Update. * gdb.base/whatis.exp: Update. * gdb.cell/arch.exp: Update. * gdb.cell/break.exp: Update. * gdb.cell/bt.exp: Update. * gdb.cell/core.exp: Update. * gdb.cell/data.exp: Update. * gdb.cell/ea-cache.exp: Update. * gdb.cell/f-regs.exp: Update. * gdb.cell/fork.exp: Update. * gdb.cell/gcore.exp: Update. * gdb.cell/mem-access.exp: Update. * gdb.cell/ptype.exp: Update. * gdb.cell/registers.exp: Update. * gdb.cell/sizeof.exp: Update. * gdb.cell/solib-symbol.exp: Update. * gdb.cell/solib.exp: Update. * gdb.cp/ambiguous.exp: Update. * gdb.cp/breakpoint.exp: Update. * gdb.cp/bs15503.exp: Update. * gdb.cp/casts.exp: Update. * gdb.cp/class2.exp: Update. * gdb.cp/cpexprs.exp: Update. * gdb.cp/cplusfuncs.exp: Update. * gdb.cp/ctti.exp: Update. * gdb.cp/dispcxx.exp: Update. * gdb.cp/gdb1355.exp: Update. * gdb.cp/gdb2384.exp: Update. * gdb.cp/gdb2495.exp: Update. * gdb.cp/infcall-dlopen.exp: Update. * gdb.cp/local.exp: Update. * gdb.cp/m-data.exp: Update. * gdb.cp/m-static.exp: Update. * gdb.cp/mb-ctor.exp: Update. * gdb.cp/mb-inline.exp: Update. * gdb.cp/mb-templates.exp: Update. * gdb.cp/member-ptr.exp: Update. * gdb.cp/method.exp: Update. * gdb.cp/namespace.exp: Update. * gdb.cp/nextoverthrow.exp: Update. * gdb.cp/nsdecl.exp: Update. * gdb.cp/nsrecurs.exp: Update. * gdb.cp/nsstress.exp: Update. * gdb.cp/nsusing.exp: Update. * gdb.cp/pr-1023.exp: Update. * gdb.cp/pr-1210.exp: Update. * gdb.cp/pr-574.exp: Update. * gdb.cp/pr9631.exp: Update. * gdb.cp/printmethod.exp: Update. * gdb.cp/psmang.exp: Update. * gdb.cp/re-set-overloaded.exp: Update. * gdb.cp/rtti.exp: Update. * gdb.cp/shadow.exp: Update. * gdb.cp/templates.exp: Update. * gdb.cp/try_catch.exp: Update. * gdb.dwarf2/dw2-ranges.exp: Update. * gdb.dwarf2/pr10770.exp: Update. * gdb.fortran/library-module.exp: Update. * gdb.hp/gdb.aCC/optimize.exp: Update. * gdb.hp/gdb.aCC/watch-cmd.exp: Update. * gdb.hp/gdb.base-hp/callfwmall.exp: Update. * gdb.hp/gdb.base-hp/hwwatchbus.exp: Update. * gdb.hp/gdb.base-hp/pxdb.exp: Update. * gdb.hp/gdb.base-hp/sized-enum.exp: Update. * gdb.hp/gdb.base-hp/so-thresh.exp: Update. * gdb.hp/gdb.compat/xdb1.exp: Update. * gdb.hp/gdb.compat/xdb2.exp: Update. * gdb.hp/gdb.compat/xdb3.exp: Update. * gdb.hp/gdb.defects/bs14602.exp: Update. * gdb.hp/gdb.defects/solib-d.exp: Update. * gdb.hp/gdb.objdbg/objdbg01.exp: Update. * gdb.hp/gdb.objdbg/objdbg02.exp: Update. * gdb.hp/gdb.objdbg/objdbg03.exp: Update. * gdb.hp/gdb.objdbg/objdbg04.exp: Update. * gdb.mi/gdb792.exp: Update. * gdb.mi/mi-pending.exp: Update. * gdb.mi/mi-solib.exp: Update. * gdb.mi/mi-var-cp.exp: Update. * gdb.opt/clobbered-registers-O2.exp: Update. * gdb.opt/inline-bt.exp: Update. * gdb.opt/inline-cmds.exp: Update. * gdb.opt/inline-locals.exp: Update. * gdb.python/py-events.exp: Update. * gdb.python/py-finish-breakpoint.exp: Update. * gdb.python/py-type.exp: Update. * gdb.reverse/solib-precsave.exp: Update. * gdb.reverse/solib-reverse.exp: Update. * gdb.server/solib-list.exp: Update. * gdb.stabs/weird.exp: Update. * gdb.threads/attach-into-signal.exp: Update. * gdb.threads/attach-stopped.exp: Update. * gdb.threads/tls-shared.exp: Update. * gdb.trace/change-loc.exp: Update. * gdb.trace/strace.exp: Update.
2012-06-21 22:46:25 +02:00
if { ![get_compiler_info] && [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
2008-05-20 23:11:04 +02:00
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if { ![runto main] } then {
fail "run to main"
return
}
watch_thread_num.exp and targets with fairer event reporting This patch fixes the watch_thread_num.exp test to work when the target is better at making event handling be fair among threads. I wrote patches that make GDB native and GDBserver event handling fairer between threads. That is, if threads A and B both simultaneously trigger some debug event, GDB will pick either A or B at random, rather than always handling the event of A first. There's code for that in the Linux backends (gdb and gdbserver) already, but it can be improved, and only works in all-stop mode. With those fixes in place, I found that the watch_thread_num.exp would often time out. The problem is that the test only works _because_ event handling isn't as fair as intended. With the fairness fixes, the test falls victim of PR10116 (gdb drops watchpoints on multi-threaded apps) quite often. To expand on the PR10116 reference, consider that stop events are serialized to GDB core, through target_wait. Say a thread-specific watchpoint as set on thread A. When the "right" thread and some other "wrong" thread both trigger a watchpoint simultaneously, the target may report the "wrong" thread's hit to GDB first (thread B). When handling that event, GDB notices the watchpoint is for another thread, and so shouldn't cause a user-visible stop. On resume, GDB saves the now current value of the watched expression. Afterwards, the "right" thread (thread A) reports its watchpoint trigger. But the watched value hasn't changed since GDB last saved it, and so GDB doesn't report the watchpoint hit to the user. The way the test is written, the watchpoint is associated with the first thread that happens to report an event. It happens that GDB is processing events much more often for one of the threads, which usually will be that same first thread. Hacking the test with "set debug infrun 1", we see exactly that: $ grep "infrun.*\[Thread.*," testsuite/gdb.log | sort | uniq -c | sort -nr 70 infrun: 8798 [Thread 8798], 37 infrun: 8798 [Thread 8802], 36 infrun: 8798 [Thread 8804], 36 infrun: 8798 [Thread 8803], 35 infrun: 8798 [Thread 8805], 34 infrun: 8798 [Thread 8806], The first column shows the number of times the target reported an event for that thread, from: infrun: target_wait (-1, status) = infrun: 8798 [Thread 8798], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP This masks out the PR10116 issue. However, if the target is better at giving equal priority to all threads, the PR10116 issue happens often, so it may take quite a while for the right thread to be the first to report its watchpoint event just after the memory being watched really changed, resulting in test time outs. Here's the number of events handled for each thread on a gdbserver run with the event fairness patches: $ grep "infrun.*\[Thread.*," gdb.log | sort | uniq -c 2961 infrun: 13591 [Thread 13591], 2956 infrun: 13591 [Thread 13595], 2941 infrun: 13591 [Thread 13596], 2932 infrun: 13591 [Thread 13597], 2905 infrun: 13591 [Thread 13598], 2891 infrun: 13591 [Thread 13599], Note how the number of events is much higher. The test routinely takes over 10 seconds to finish on my machine rather than under a second as with unpatched gdbserver, when it succeeds, but often it'll fail with timeouts too. So to make the test robust, this patch switches the tests to using "awatch" instead of "watch", as access watchpoints don't care about the watchpoint's "old value". With this, the test always finishes quickly, and we can even bump the number of threads concurrently writting to the shared variable, to have better assurance we're really testing the case of the "wrong" thread triggering a watchpoint. Here's the number of events I see for each thread on a run on my machine, with a gdbserver patched with the event fairness series: $ grep "infrun.*\[Thread.*," testsuite/gdb.log | sort | uniq -c 5 infrun: 5298 [Thread 5302], 4 infrun: 5298 [Thread 5303], 4 infrun: 5298 [Thread 5304], 4 infrun: 5298 [Thread 5305], 4 infrun: 5298 [Thread 5306], 4 infrun: 5298 [Thread 5307], 4 infrun: 5298 [Thread 5308], 4 infrun: 5298 [Thread 5309], 4 infrun: 5298 [Thread 5310], 4 infrun: 5298 [Thread 5311], 4 infrun: 5298 [Thread 5312], 4 infrun: 5298 [Thread 5313], 4 infrun: 5298 [Thread 5314], 4 infrun: 5298 [Thread 5315], 4 infrun: 5298 [Thread 5316], gdb/testsuite/ 2015-01-09 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (thread_test): Use srcfile and binfile from the global scope. Set a breakpoint after all threads are started rather than stepping over two source lines. Expect the prompt. * gdb.base/watch_thread_num.c (threads_started_barrier): New global. (NUM): Now 15. (main): Use threads_started_barrier to wait for all threads to start. Main thread no longer calls thread_function. Exit after 180 seconds. (loop): New function. (thread_function): Wait on threads_started_barrier barrier. Call 'loop' at each iteration. * gdb.base/watch_thread_num.exp: Continue to breakpoint after all threads have started, instead of hardcoding number of "next" steps. Use an access watchpoint instead of a write watchpoint.
2014-12-29 20:41:05 +01:00
set linenum [gdb_get_line_number "all threads started"]
gdb_breakpoint "$linenum"
2008-05-20 23:11:04 +02:00
set gdb_prompt \
"\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
gdb_test_multiple "set annotate 2" "" {
-re "set annotate 2\r\n$gdb_prompt$" {
}
2008-05-20 23:11:04 +02:00
}
watch_thread_num.exp and targets with fairer event reporting This patch fixes the watch_thread_num.exp test to work when the target is better at making event handling be fair among threads. I wrote patches that make GDB native and GDBserver event handling fairer between threads. That is, if threads A and B both simultaneously trigger some debug event, GDB will pick either A or B at random, rather than always handling the event of A first. There's code for that in the Linux backends (gdb and gdbserver) already, but it can be improved, and only works in all-stop mode. With those fixes in place, I found that the watch_thread_num.exp would often time out. The problem is that the test only works _because_ event handling isn't as fair as intended. With the fairness fixes, the test falls victim of PR10116 (gdb drops watchpoints on multi-threaded apps) quite often. To expand on the PR10116 reference, consider that stop events are serialized to GDB core, through target_wait. Say a thread-specific watchpoint as set on thread A. When the "right" thread and some other "wrong" thread both trigger a watchpoint simultaneously, the target may report the "wrong" thread's hit to GDB first (thread B). When handling that event, GDB notices the watchpoint is for another thread, and so shouldn't cause a user-visible stop. On resume, GDB saves the now current value of the watched expression. Afterwards, the "right" thread (thread A) reports its watchpoint trigger. But the watched value hasn't changed since GDB last saved it, and so GDB doesn't report the watchpoint hit to the user. The way the test is written, the watchpoint is associated with the first thread that happens to report an event. It happens that GDB is processing events much more often for one of the threads, which usually will be that same first thread. Hacking the test with "set debug infrun 1", we see exactly that: $ grep "infrun.*\[Thread.*," testsuite/gdb.log | sort | uniq -c | sort -nr 70 infrun: 8798 [Thread 8798], 37 infrun: 8798 [Thread 8802], 36 infrun: 8798 [Thread 8804], 36 infrun: 8798 [Thread 8803], 35 infrun: 8798 [Thread 8805], 34 infrun: 8798 [Thread 8806], The first column shows the number of times the target reported an event for that thread, from: infrun: target_wait (-1, status) = infrun: 8798 [Thread 8798], infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP This masks out the PR10116 issue. However, if the target is better at giving equal priority to all threads, the PR10116 issue happens often, so it may take quite a while for the right thread to be the first to report its watchpoint event just after the memory being watched really changed, resulting in test time outs. Here's the number of events handled for each thread on a gdbserver run with the event fairness patches: $ grep "infrun.*\[Thread.*," gdb.log | sort | uniq -c 2961 infrun: 13591 [Thread 13591], 2956 infrun: 13591 [Thread 13595], 2941 infrun: 13591 [Thread 13596], 2932 infrun: 13591 [Thread 13597], 2905 infrun: 13591 [Thread 13598], 2891 infrun: 13591 [Thread 13599], Note how the number of events is much higher. The test routinely takes over 10 seconds to finish on my machine rather than under a second as with unpatched gdbserver, when it succeeds, but often it'll fail with timeouts too. So to make the test robust, this patch switches the tests to using "awatch" instead of "watch", as access watchpoints don't care about the watchpoint's "old value". With this, the test always finishes quickly, and we can even bump the number of threads concurrently writting to the shared variable, to have better assurance we're really testing the case of the "wrong" thread triggering a watchpoint. Here's the number of events I see for each thread on a run on my machine, with a gdbserver patched with the event fairness series: $ grep "infrun.*\[Thread.*," testsuite/gdb.log | sort | uniq -c 5 infrun: 5298 [Thread 5302], 4 infrun: 5298 [Thread 5303], 4 infrun: 5298 [Thread 5304], 4 infrun: 5298 [Thread 5305], 4 infrun: 5298 [Thread 5306], 4 infrun: 5298 [Thread 5307], 4 infrun: 5298 [Thread 5308], 4 infrun: 5298 [Thread 5309], 4 infrun: 5298 [Thread 5310], 4 infrun: 5298 [Thread 5311], 4 infrun: 5298 [Thread 5312], 4 infrun: 5298 [Thread 5313], 4 infrun: 5298 [Thread 5314], 4 infrun: 5298 [Thread 5315], 4 infrun: 5298 [Thread 5316], gdb/testsuite/ 2015-01-09 Pedro Alves <palves@redhat.com> * gdb.base/annota1.exp (thread_test): Use srcfile and binfile from the global scope. Set a breakpoint after all threads are started rather than stepping over two source lines. Expect the prompt. * gdb.base/watch_thread_num.c (threads_started_barrier): New global. (NUM): Now 15. (main): Use threads_started_barrier to wait for all threads to start. Main thread no longer calls thread_function. Exit after 180 seconds. (loop): New function. (thread_function): Wait on threads_started_barrier barrier. Call 'loop' at each iteration. * gdb.base/watch_thread_num.exp: Continue to breakpoint after all threads have started, instead of hardcoding number of "next" steps. Use an access watchpoint instead of a write watchpoint.
2014-12-29 20:41:05 +01:00
gdb_test_multiple "continue" "new thread" {
-re "\032\032new-thread.*\r\n$gdb_prompt$" {
pass "new thread"
2008-05-20 23:11:04 +02:00
}
}
}
}
proc thread_switch {} {
gdb_test_multiple "thread 1" "thread switch" {
-re ".*\032\032thread-changed" {
pass "thread switch"
}
}
}
2008-05-20 23:11:04 +02:00
thread_test
thread_switch
2008-05-20 23:11:04 +02:00
1999-05-05 23:45:13 +02:00
# restore the original prompt for the rest of the testsuite
set gdb_prompt $old_gdb_prompt