2014-01-01 03:54:24 +00:00
# Copyright 1992-2014 Free Software Foundation, Inc.
1999-04-16 01:35:26 +00: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
2007-08-23 18:14:19 +00:00
# the Free Software Foundation; either version 3 of the License, or
1999-04-16 01:35:26 +00:00
# (at your option) any later version.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00: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.
2007-08-23 18:14:19 +00:00
#
1999-04-16 01:35:26 +00:00
# You should have received a copy of the GNU General Public License
2007-08-23 18:14:19 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-04-16 01:35:26 +00:00
# This file was written by Fred Fish. (fnf@cygnus.com)
test suite update - gdb.base/[h-m]
Convert files gdb.base/[h-m]*.exp to use standard_output_file et al.
* hook-stop-continue.exp, hook-stop-frame.exp, huge.exp,
included.exp, inferior-died.exp, infnan.exp, info-fun.exp,
info-macros.exp, info-os.exp, info-proc.exp, info-target.exp,
infoline.exp, interp.exp, interrupt.exp, jit-simple.exp,
jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp,
lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp,
macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp,
morestack.exp, moribund-step.exp, multi-forks.exp: Use
standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 18:51:31 +00:00
standard_testfile list0.c list1.c
1999-04-16 01:35:26 +00:00
# Need to download the header to the host.
2013-08-23 18:18:01 +00:00
gdb_remote_download host ${srcdir}/${subdir}/list0.h
1999-04-16 01:35:26 +00:00
test suite update - gdb.base/[h-m]
Convert files gdb.base/[h-m]*.exp to use standard_output_file et al.
* hook-stop-continue.exp, hook-stop-frame.exp, huge.exp,
included.exp, inferior-died.exp, infnan.exp, info-fun.exp,
info-macros.exp, info-os.exp, info-proc.exp, info-target.exp,
infoline.exp, interp.exp, interrupt.exp, jit-simple.exp,
jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp,
lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp,
macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp,
morestack.exp, moribund-step.exp, multi-forks.exp: Use
standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 18:51:31 +00:00
if {[prepare_for_testing $testfile.exp $testfile [list $srcfile $srcfile2] \
{debug}]} {
return -1
1999-04-16 01:35:26 +00:00
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
2012-06-21 20:46:25 +00:00
if [get_compiler_info] {
gdb/testsuite/
* config/monitor.exp (gdb_target_cmd): Remove semicolon after
'return'.
(gdb_target_monitor, gdb_load): Likewise.
* config/sid.exp (gdb_load): Likewise.
* config/slite.exp (gdb_load): Likewise.
* config/vx.exp (gdb_start, spawn_vxgdb): Likewise.
* gdb.ada/arrayidx.exp, gdb.ada/null_array.exp: Likewise.
* gdb.arch/mips-octeon-bbit.exp (single_step): Likewise.
(single_step_until): Likewise.
* gdb.arch/powerpc-d128-regs.exp: Likewise.
* gdb.arch/system-gcore.exp: Likewise.
* gdb.base/bigcore.exp (extract_heap): Likewise.
* gdb.base/break-on-linker-gcd-function.exp: Likewise.
* gdb.base/call-ar-st.exp: Likewise.
* gdb.base/call-rt-st.exp: Likewise.
* gdb.base/call-sc.exp, gdb.base/call-strs.exp: Likewise.
* gdb.base/callfuncs.exp, gdb.base/completion.exp: Likewise.
* gdb.base/condbreak.exp, gdb.base/constvars.exp: Likewise.
* gdb.base/corefile.exp: Likewise.
* gdb.base/dbx.exp (gdb_file_cmd): Likewise.
* gdb.base/exprs.exp, gdb.base/fileio.exp: Likewise.
* gdb.base/fixsection.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/gcore-buffer-overflow.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gcore.exp, gdb.base/gdb11530.exp: Likewise.
* gdb.base/gdb11531.exp, gdb.base/gnu-ifunc.exp: Likewise.
* gdb.base/info-os.exp, gdb.base/info-proc.exp: Likewise.
* gdb.base/interp.exp, gdb.base/langs.exp:: Likewise.
* gdb.base/list.exp: Likewise.
(set_listsize): Likewise.
* gdb.base/logical.exp, gdb.base/mips_pro.exp: Likewise.
* gdb.base/miscexprs.exp, gdb.base/nodebug.exp: Likewise.
* gdb.base/opaque.exp, gdb.base/pointers.exp: Likewise.
* gdb.base/psymtab.exp, gdb.base/ptype.exp: Likewise.
* gdb.base/relational.exp, gdb.base/scope.exp: Likewise.
* gdb.base/setvar.exp: Likewise.
(test_set): Likewise.
* gdb.base/signals.exp, gdb.base/sizeof.exp: Likewise.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.base/store.exp, gdb.base/structs.exp: Likewise.
* gdb.base/structs2.exp, gdb.base/volatile.exp: Likewise.
* gdb.base/watchpoint.exp (initialize): Likewise.
(test_simple_watchpoint): Likewise.
(test_disabling_watchpoints): Likewise.
(test_watchpoint_triggered_in_syscall): Likewise.
* gdb.base/whatis.exp, gdb.cp/ambiguous.exp: Likewise.
* gdb.cp/casts.exp, gdb.cp/ctti.exp: Likewise.
* gdb.cp/namespace.exp, gdb.cp/nsdecl.exp: Likewise.
* gdb.cp/psmang.exp, gdb.dwarf2/dw2-ranges.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/pxdb.exp: Likewise.
* gdb.hp/gdb.compat/xdb1.exp: Likewise.
* gdb.hp/gdb.compat/xdb2.exp: Likewise.
* gdb.hp/gdb.compat/xdb3.exp: Likewise.
* gdb.hp/gdb.defects/bs14602.exp: Likewise.
* gdb.hp/gdb.defects/solib-d.exp: Likewise.
* gdb.mi/gdb792.exp: Likewise.
* gdb.mi/mi-inheritance-syntax-error.exp: Likewise.
* gdb.mi/mi-logging.exp, gdb.mi/mi-var-cp.exp : Likewise.
* gdb.mi/mi-var-rtti.exp, gdb.python/py-type.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
(load_core): Likewise.
* gdb.threads/pthreads.exp (all_threads_running): Likewise.
(test_startup, check_control_c): Likewise.
* gdb.threads/sigstep-threads.exp: Likewise.
* gdb.threads/thread_check.exp: Likewise.
* gdb.trace/backtrace.exp, gdb.trace/change-loc.exp: Likewise.
* gdb.trace/circ.exp (run_trace_experiment): Likewise.
(set_a_tracepoint, trace_buffer_normal): Likewise.
(gdb_trace_circular_tests): Likewise.
* gdb.trace/collection.exp: Likewise.
* gdb.trace/disconnected-tracing.exp: Likewise.
* gdb.trace/infotrace.exp: Likewise.
* gdb.trace/mi-traceframe-changed.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp: Likewise.
* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise.
* gdb.trace/packetlen.exp, gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/pending.exp, gdb.trace/report.exp: Likewise.
* gdb.trace/stap-trace.exp: Likewise.
* gdb.trace/status-stop.exp,gdb.trace/strace.exp: Likewise.
* gdb.trace/tfind.exp, gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-buffer-size.exp: Likewise.
* gdb.trace/tspeed.exp, gdb.trace/tsv.exp: Likewise.
* gdb.trace/unavailable.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.
* lib/fortran.exp (set_lang_fortran): Likewise.
* lib/gdb.exp (default_gdb_version, gdb_start_cmd): Likewise.
(gdb_breakpoint, gdb_reinitialize_dir): Likewise.
(default_gdb_start, get_compiler_info): Likewise.
(gdb_compile, gdb_compile_objc, gdb_reload, gdb_init): Likewise.
(get_debug_format, setup_xfail_format): Likewise.
(rerun_to_main, gdb_skip_float_test): Likewise.
(build_id_debug_filename_get, get_remotetimeout): Likewise.
* lib/java.exp (set_lang_java): Likewise.
* lib/mi-support.exp (default_mi_gdb_start): Likewise.
(mi_gdb_reinitialize_dir, mi_gdb_target_cmd): Likewise.
(mi_gdb_file_cmd, mi_gdb_test): Likewise.
(mi_run_cmd_full, mi_expect_interrupt): Likewise.
* lib/objc.exp (set_lang_objc): Likewise.
* lib/pascal.exp (set_lang_pascal): Likewise.
* lib/prompt.exp (default_prompt_gdb_start): Likewise.
* lib/trace-support.exp (gdb_trace_setactions, gdb_tfind_test): Likewise.
(gdb_readexpr, gdb_gettpnum, gdb_find_recursion_test_baseline): Likewise.
2013-03-14 13:34:06 +00:00
return -1
1999-04-16 01:35:26 +00:00
}
2013-03-28 11:56:51 +00:00
# The last line in the file.
set last_line [gdb_get_line_number "last line" "list0.c"]
# Regex matching the last line in the file.
set last_line_re "${last_line}\[ \t\]+} /\\* last line \\*/"
1999-04-16 01:35:26 +00:00
#
# Local utility proc just to set and verify listsize
# Return 1 if success, 0 if fail.
#
2013-06-07 17:31:09 +00:00
set set_listsize_count 0
1999-04-16 01:35:26 +00:00
proc set_listsize { arg } {
global gdb_prompt
2013-06-07 17:31:09 +00:00
global set_listsize_count
1999-04-16 01:35:26 +00:00
2013-06-07 17:31:09 +00:00
incr set_listsize_count
2013-03-28 11:55:40 +00:00
if [gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"] {
gdb/testsuite/
* config/monitor.exp (gdb_target_cmd): Remove semicolon after
'return'.
(gdb_target_monitor, gdb_load): Likewise.
* config/sid.exp (gdb_load): Likewise.
* config/slite.exp (gdb_load): Likewise.
* config/vx.exp (gdb_start, spawn_vxgdb): Likewise.
* gdb.ada/arrayidx.exp, gdb.ada/null_array.exp: Likewise.
* gdb.arch/mips-octeon-bbit.exp (single_step): Likewise.
(single_step_until): Likewise.
* gdb.arch/powerpc-d128-regs.exp: Likewise.
* gdb.arch/system-gcore.exp: Likewise.
* gdb.base/bigcore.exp (extract_heap): Likewise.
* gdb.base/break-on-linker-gcd-function.exp: Likewise.
* gdb.base/call-ar-st.exp: Likewise.
* gdb.base/call-rt-st.exp: Likewise.
* gdb.base/call-sc.exp, gdb.base/call-strs.exp: Likewise.
* gdb.base/callfuncs.exp, gdb.base/completion.exp: Likewise.
* gdb.base/condbreak.exp, gdb.base/constvars.exp: Likewise.
* gdb.base/corefile.exp: Likewise.
* gdb.base/dbx.exp (gdb_file_cmd): Likewise.
* gdb.base/exprs.exp, gdb.base/fileio.exp: Likewise.
* gdb.base/fixsection.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/gcore-buffer-overflow.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gcore.exp, gdb.base/gdb11530.exp: Likewise.
* gdb.base/gdb11531.exp, gdb.base/gnu-ifunc.exp: Likewise.
* gdb.base/info-os.exp, gdb.base/info-proc.exp: Likewise.
* gdb.base/interp.exp, gdb.base/langs.exp:: Likewise.
* gdb.base/list.exp: Likewise.
(set_listsize): Likewise.
* gdb.base/logical.exp, gdb.base/mips_pro.exp: Likewise.
* gdb.base/miscexprs.exp, gdb.base/nodebug.exp: Likewise.
* gdb.base/opaque.exp, gdb.base/pointers.exp: Likewise.
* gdb.base/psymtab.exp, gdb.base/ptype.exp: Likewise.
* gdb.base/relational.exp, gdb.base/scope.exp: Likewise.
* gdb.base/setvar.exp: Likewise.
(test_set): Likewise.
* gdb.base/signals.exp, gdb.base/sizeof.exp: Likewise.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.base/store.exp, gdb.base/structs.exp: Likewise.
* gdb.base/structs2.exp, gdb.base/volatile.exp: Likewise.
* gdb.base/watchpoint.exp (initialize): Likewise.
(test_simple_watchpoint): Likewise.
(test_disabling_watchpoints): Likewise.
(test_watchpoint_triggered_in_syscall): Likewise.
* gdb.base/whatis.exp, gdb.cp/ambiguous.exp: Likewise.
* gdb.cp/casts.exp, gdb.cp/ctti.exp: Likewise.
* gdb.cp/namespace.exp, gdb.cp/nsdecl.exp: Likewise.
* gdb.cp/psmang.exp, gdb.dwarf2/dw2-ranges.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/pxdb.exp: Likewise.
* gdb.hp/gdb.compat/xdb1.exp: Likewise.
* gdb.hp/gdb.compat/xdb2.exp: Likewise.
* gdb.hp/gdb.compat/xdb3.exp: Likewise.
* gdb.hp/gdb.defects/bs14602.exp: Likewise.
* gdb.hp/gdb.defects/solib-d.exp: Likewise.
* gdb.mi/gdb792.exp: Likewise.
* gdb.mi/mi-inheritance-syntax-error.exp: Likewise.
* gdb.mi/mi-logging.exp, gdb.mi/mi-var-cp.exp : Likewise.
* gdb.mi/mi-var-rtti.exp, gdb.python/py-type.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
(load_core): Likewise.
* gdb.threads/pthreads.exp (all_threads_running): Likewise.
(test_startup, check_control_c): Likewise.
* gdb.threads/sigstep-threads.exp: Likewise.
* gdb.threads/thread_check.exp: Likewise.
* gdb.trace/backtrace.exp, gdb.trace/change-loc.exp: Likewise.
* gdb.trace/circ.exp (run_trace_experiment): Likewise.
(set_a_tracepoint, trace_buffer_normal): Likewise.
(gdb_trace_circular_tests): Likewise.
* gdb.trace/collection.exp: Likewise.
* gdb.trace/disconnected-tracing.exp: Likewise.
* gdb.trace/infotrace.exp: Likewise.
* gdb.trace/mi-traceframe-changed.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp: Likewise.
* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise.
* gdb.trace/packetlen.exp, gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/pending.exp, gdb.trace/report.exp: Likewise.
* gdb.trace/stap-trace.exp: Likewise.
* gdb.trace/status-stop.exp,gdb.trace/strace.exp: Likewise.
* gdb.trace/tfind.exp, gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-buffer-size.exp: Likewise.
* gdb.trace/tspeed.exp, gdb.trace/tsv.exp: Likewise.
* gdb.trace/unavailable.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.
* lib/fortran.exp (set_lang_fortran): Likewise.
* lib/gdb.exp (default_gdb_version, gdb_start_cmd): Likewise.
(gdb_breakpoint, gdb_reinitialize_dir): Likewise.
(default_gdb_start, get_compiler_info): Likewise.
(gdb_compile, gdb_compile_objc, gdb_reload, gdb_init): Likewise.
(get_debug_format, setup_xfail_format): Likewise.
(rerun_to_main, gdb_skip_float_test): Likewise.
(build_id_debug_filename_get, get_remotetimeout): Likewise.
* lib/java.exp (set_lang_java): Likewise.
* lib/mi-support.exp (default_mi_gdb_start): Likewise.
(mi_gdb_reinitialize_dir, mi_gdb_target_cmd): Likewise.
(mi_gdb_file_cmd, mi_gdb_test): Likewise.
(mi_run_cmd_full, mi_expect_interrupt): Likewise.
* lib/objc.exp (set_lang_objc): Likewise.
* lib/pascal.exp (set_lang_pascal): Likewise.
* lib/prompt.exp (default_prompt_gdb_start): Likewise.
* lib/trace-support.exp (gdb_trace_setactions, gdb_tfind_test): Likewise.
(gdb_readexpr, gdb_gettpnum, gdb_find_recursion_test_baseline): Likewise.
2013-03-14 13:34:06 +00:00
return 0
1999-04-16 01:35:26 +00:00
}
Fix PR gdb/15294: list with unlimited listsize broken
Currently, "set listsize -1" is supposed to mean "unlimited" source
lines, but, alas, it doesn't actually work:
(gdb) set listsize -1
(gdb) show listsize
Number of source lines gdb will list by default is unlimited.
(gdb) list 1
(gdb) list 1
(gdb) list 1
(gdb) set listsize 10
(gdb) list 1
1 /* Main function for CLI gdb.
2 Copyright (C) 2002-2013 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
Before this patch:
http://sourceware.org/ml/gdb-patches/2012-08/msg00367.html
was applied, the "set listsize" command was a var_integer command, and
"unlimited" was set with 0. Internally, var_integer maps 0 to INT_MAX
case var_integer:
{
...
if (val == 0 && c->var_type == var_integer)
val = INT_MAX;
The change in that patch to zuinteger_unlimited command, meant that -1
is left as -1 in the command's control variable (lines_to_list), and
the code in source.c isn't expecting that -- it only expects positive
numbers.
I previously suggested fixing the code and keeping the new behavior,
but I found that "set listsize 0" is currently used in the wild, and
we do have a bunch of other commands where "0" means unlimited, so I'm
thinking that changing this command alone in isolation is not a good
idea.
So I now strongly prefer reverting back the behavior in 7.6 to the
same behavior the command has had since 2006 (0==unlimited, -1=error).
Before that, set listsize -1 would be accepted as unlimited as well.
After 7.6 is out, in mainline, we can get back to reconsidering
changing this command's behavior, if there's a real need for being
able to suppress output. For now, let's play it safe.
The "list line 1 with unlimited listsize" test in list.exp was
originally written years and years ago expecting 0 to mean "no
output", but GDB never actually worked that way, even when the tests
were written, so the tests had been xfailed then. This patch now
adjusts the test to the new behavior, so that the test actually
passes, and the xfail is removed.
gdb/
2013-03-28 Pedro Alves <palves@redhat.com>
PR gdb/15294
* source.c (_initialize_source): Change back "set listsize" to an
integer command.
gdb/testsuite/
2013-03-28 Pedro Alves <palves@redhat.com>
PR gdb/15294
* gdb.base/list.exp (set_listsize): Adjust to accept $arg == 0 to
mean unlimited instead of $arg < 0.
(test_listsize): Remove "listsize of 0 suppresses output" test.
Test that "set listsize 0" ends up with an unlimited listsize.
gdb/doc/
2013-03-28 Pedro Alves <palves@redhat.com>
PR gdb/15294
* gdb.texinfo (List) <set listsize>: Adjust to document that
listsize 0 means no limit, and remove mention of -1.
2013-03-28 11:57:47 +00:00
if { $arg == 0 } {
2013-06-07 17:31:09 +00:00
set arg "unlimited"
1999-04-16 01:35:26 +00:00
}
if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"] {
gdb/testsuite/
* config/monitor.exp (gdb_target_cmd): Remove semicolon after
'return'.
(gdb_target_monitor, gdb_load): Likewise.
* config/sid.exp (gdb_load): Likewise.
* config/slite.exp (gdb_load): Likewise.
* config/vx.exp (gdb_start, spawn_vxgdb): Likewise.
* gdb.ada/arrayidx.exp, gdb.ada/null_array.exp: Likewise.
* gdb.arch/mips-octeon-bbit.exp (single_step): Likewise.
(single_step_until): Likewise.
* gdb.arch/powerpc-d128-regs.exp: Likewise.
* gdb.arch/system-gcore.exp: Likewise.
* gdb.base/bigcore.exp (extract_heap): Likewise.
* gdb.base/break-on-linker-gcd-function.exp: Likewise.
* gdb.base/call-ar-st.exp: Likewise.
* gdb.base/call-rt-st.exp: Likewise.
* gdb.base/call-sc.exp, gdb.base/call-strs.exp: Likewise.
* gdb.base/callfuncs.exp, gdb.base/completion.exp: Likewise.
* gdb.base/condbreak.exp, gdb.base/constvars.exp: Likewise.
* gdb.base/corefile.exp: Likewise.
* gdb.base/dbx.exp (gdb_file_cmd): Likewise.
* gdb.base/exprs.exp, gdb.base/fileio.exp: Likewise.
* gdb.base/fixsection.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/gcore-buffer-overflow.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gcore.exp, gdb.base/gdb11530.exp: Likewise.
* gdb.base/gdb11531.exp, gdb.base/gnu-ifunc.exp: Likewise.
* gdb.base/info-os.exp, gdb.base/info-proc.exp: Likewise.
* gdb.base/interp.exp, gdb.base/langs.exp:: Likewise.
* gdb.base/list.exp: Likewise.
(set_listsize): Likewise.
* gdb.base/logical.exp, gdb.base/mips_pro.exp: Likewise.
* gdb.base/miscexprs.exp, gdb.base/nodebug.exp: Likewise.
* gdb.base/opaque.exp, gdb.base/pointers.exp: Likewise.
* gdb.base/psymtab.exp, gdb.base/ptype.exp: Likewise.
* gdb.base/relational.exp, gdb.base/scope.exp: Likewise.
* gdb.base/setvar.exp: Likewise.
(test_set): Likewise.
* gdb.base/signals.exp, gdb.base/sizeof.exp: Likewise.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.base/store.exp, gdb.base/structs.exp: Likewise.
* gdb.base/structs2.exp, gdb.base/volatile.exp: Likewise.
* gdb.base/watchpoint.exp (initialize): Likewise.
(test_simple_watchpoint): Likewise.
(test_disabling_watchpoints): Likewise.
(test_watchpoint_triggered_in_syscall): Likewise.
* gdb.base/whatis.exp, gdb.cp/ambiguous.exp: Likewise.
* gdb.cp/casts.exp, gdb.cp/ctti.exp: Likewise.
* gdb.cp/namespace.exp, gdb.cp/nsdecl.exp: Likewise.
* gdb.cp/psmang.exp, gdb.dwarf2/dw2-ranges.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/pxdb.exp: Likewise.
* gdb.hp/gdb.compat/xdb1.exp: Likewise.
* gdb.hp/gdb.compat/xdb2.exp: Likewise.
* gdb.hp/gdb.compat/xdb3.exp: Likewise.
* gdb.hp/gdb.defects/bs14602.exp: Likewise.
* gdb.hp/gdb.defects/solib-d.exp: Likewise.
* gdb.mi/gdb792.exp: Likewise.
* gdb.mi/mi-inheritance-syntax-error.exp: Likewise.
* gdb.mi/mi-logging.exp, gdb.mi/mi-var-cp.exp : Likewise.
* gdb.mi/mi-var-rtti.exp, gdb.python/py-type.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
(load_core): Likewise.
* gdb.threads/pthreads.exp (all_threads_running): Likewise.
(test_startup, check_control_c): Likewise.
* gdb.threads/sigstep-threads.exp: Likewise.
* gdb.threads/thread_check.exp: Likewise.
* gdb.trace/backtrace.exp, gdb.trace/change-loc.exp: Likewise.
* gdb.trace/circ.exp (run_trace_experiment): Likewise.
(set_a_tracepoint, trace_buffer_normal): Likewise.
(gdb_trace_circular_tests): Likewise.
* gdb.trace/collection.exp: Likewise.
* gdb.trace/disconnected-tracing.exp: Likewise.
* gdb.trace/infotrace.exp: Likewise.
* gdb.trace/mi-traceframe-changed.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp: Likewise.
* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise.
* gdb.trace/packetlen.exp, gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/pending.exp, gdb.trace/report.exp: Likewise.
* gdb.trace/stap-trace.exp: Likewise.
* gdb.trace/status-stop.exp,gdb.trace/strace.exp: Likewise.
* gdb.trace/tfind.exp, gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-buffer-size.exp: Likewise.
* gdb.trace/tspeed.exp, gdb.trace/tsv.exp: Likewise.
* gdb.trace/unavailable.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.
* lib/fortran.exp (set_lang_fortran): Likewise.
* lib/gdb.exp (default_gdb_version, gdb_start_cmd): Likewise.
(gdb_breakpoint, gdb_reinitialize_dir): Likewise.
(default_gdb_start, get_compiler_info): Likewise.
(gdb_compile, gdb_compile_objc, gdb_reload, gdb_init): Likewise.
(get_debug_format, setup_xfail_format): Likewise.
(rerun_to_main, gdb_skip_float_test): Likewise.
(build_id_debug_filename_get, get_remotetimeout): Likewise.
* lib/java.exp (set_lang_java): Likewise.
* lib/mi-support.exp (default_mi_gdb_start): Likewise.
(mi_gdb_reinitialize_dir, mi_gdb_target_cmd): Likewise.
(mi_gdb_file_cmd, mi_gdb_test): Likewise.
(mi_run_cmd_full, mi_expect_interrupt): Likewise.
* lib/objc.exp (set_lang_objc): Likewise.
* lib/pascal.exp (set_lang_pascal): Likewise.
* lib/prompt.exp (default_prompt_gdb_start): Likewise.
* lib/trace-support.exp (gdb_trace_setactions, gdb_tfind_test): Likewise.
(gdb_readexpr, gdb_gettpnum, gdb_find_recursion_test_baseline): Likewise.
2013-03-14 13:34:06 +00:00
return 0
1999-04-16 01:35:26 +00:00
}
return 1
}
#
# Test display of listsize lines around a given line number.
#
proc test_listsize {} {
2012-06-15 14:43:00 +00:00
global gdb_prompt
1999-06-28 16:06:02 +00:00
global hp_cc_compiler
global hp_aCC_compiler
2013-03-28 11:56:51 +00:00
global last_line_re
1999-04-16 01:35:26 +00:00
# Show default size
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
# Show the default lines
2012-06-15 14:43:00 +00:00
gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
1999-04-16 01:35:26 +00:00
# Ensure we can limit printouts to one line
1999-06-28 16:06:02 +00:00
if [set_listsize 1] {
1999-04-16 01:35:26 +00:00
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"
}
# Try just two lines
if [ set_listsize 2 ] {
1999-09-09 00:02:17 +00:00
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"
1999-04-16 01:35:26 +00:00
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
1999-06-28 16:06:02 +00:00
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"
1999-04-16 01:35:26 +00:00
}
# Try small listsize > 1 that is an odd number
if [ set_listsize 3 ] {
1999-09-09 00:02:17 +00:00
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"
1999-06-28 16:06:02 +00:00
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
1999-04-16 01:35:26 +00:00
}
# Try small listsize > 2 that is an even number.
if [ set_listsize 4 ] then {
1999-09-09 00:02:17 +00:00
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4"
1999-04-16 01:35:26 +00:00
gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
}
# Try a size larger than the entire file.
if [ set_listsize 100 ] then {
2013-03-28 11:56:51 +00:00
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 1 with listsize 100"
1999-04-16 01:35:26 +00:00
2013-03-28 11:56:51 +00:00
gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 10 with listsize 100"
1999-04-16 01:35:26 +00:00
}
Fix PR gdb/15294: list with unlimited listsize broken
Currently, "set listsize -1" is supposed to mean "unlimited" source
lines, but, alas, it doesn't actually work:
(gdb) set listsize -1
(gdb) show listsize
Number of source lines gdb will list by default is unlimited.
(gdb) list 1
(gdb) list 1
(gdb) list 1
(gdb) set listsize 10
(gdb) list 1
1 /* Main function for CLI gdb.
2 Copyright (C) 2002-2013 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
Before this patch:
http://sourceware.org/ml/gdb-patches/2012-08/msg00367.html
was applied, the "set listsize" command was a var_integer command, and
"unlimited" was set with 0. Internally, var_integer maps 0 to INT_MAX
case var_integer:
{
...
if (val == 0 && c->var_type == var_integer)
val = INT_MAX;
The change in that patch to zuinteger_unlimited command, meant that -1
is left as -1 in the command's control variable (lines_to_list), and
the code in source.c isn't expecting that -- it only expects positive
numbers.
I previously suggested fixing the code and keeping the new behavior,
but I found that "set listsize 0" is currently used in the wild, and
we do have a bunch of other commands where "0" means unlimited, so I'm
thinking that changing this command alone in isolation is not a good
idea.
So I now strongly prefer reverting back the behavior in 7.6 to the
same behavior the command has had since 2006 (0==unlimited, -1=error).
Before that, set listsize -1 would be accepted as unlimited as well.
After 7.6 is out, in mainline, we can get back to reconsidering
changing this command's behavior, if there's a real need for being
able to suppress output. For now, let's play it safe.
The "list line 1 with unlimited listsize" test in list.exp was
originally written years and years ago expecting 0 to mean "no
output", but GDB never actually worked that way, even when the tests
were written, so the tests had been xfailed then. This patch now
adjusts the test to the new behavior, so that the test actually
passes, and the xfail is removed.
gdb/
2013-03-28 Pedro Alves <palves@redhat.com>
PR gdb/15294
* source.c (_initialize_source): Change back "set listsize" to an
integer command.
gdb/testsuite/
2013-03-28 Pedro Alves <palves@redhat.com>
PR gdb/15294
* gdb.base/list.exp (set_listsize): Adjust to accept $arg == 0 to
mean unlimited instead of $arg < 0.
(test_listsize): Remove "listsize of 0 suppresses output" test.
Test that "set listsize 0" ends up with an unlimited listsize.
gdb/doc/
2013-03-28 Pedro Alves <palves@redhat.com>
PR gdb/15294
* gdb.texinfo (List) <set listsize>: Adjust to document that
listsize 0 means no limit, and remove mention of -1.
2013-03-28 11:57:47 +00:00
# Try listsize of 0 which is special, and means unlimited.
1999-04-16 01:35:26 +00:00
set_listsize 0
2013-03-28 11:56:51 +00:00
gdb_test "list 1" "1\[ \t\]+#include .*\r\n${last_line_re}" "list line 1 with unlimited listsize"
1999-04-16 01:35:26 +00:00
}
#
# Test "list filename:number" for C include file
#
proc test_list_include_file {} {
global gdb_prompt
setup_xfail_format "COFF"
1999-09-09 00:02:17 +00:00
gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"
1999-04-16 01:35:26 +00:00
setup_xfail_format "COFF"
1999-06-28 16:06:02 +00:00
gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"
1999-04-16 01:35:26 +00:00
}
#
# Test "list filename:number" for C source file
#
proc test_list_filename_and_number {} {
global gdb_prompt
set testcnt 0
send_gdb "list list0.c:1\n"
gdb_expect {
2011-12-13 17:22:11 +00:00
-re "1\[ \t\]+#include \"list0.h\".*10\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests }
timeout { fail "list list0.c:1 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list list0.c:10\n"
gdb_expect {
-re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" {
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list.c:10" ; gdb_suppress_tests }
timeout { fail "list list.c:10 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list list1.c:1\n"
gdb_expect {
1999-06-28 16:06:02 +00:00
-re "1\[ \t\]+\#include.*4\[ \t\]+.*int oof\[ \t\]*\(.*\);\r\n.*$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list1.c:1" ; gdb_suppress_tests }
timeout { fail "list list1.c:1 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list list1.c:12\n"
gdb_expect {
1999-06-28 16:06:02 +00:00
-re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests }
timeout { fail "list list1.c:12 (timeout)" ; gdb_suppress_tests }
}
pass "list filename:number ($testcnt tests)"
2013-06-07 17:31:09 +00:00
gdb_stop_suppressing_tests
1999-04-16 01:35:26 +00:00
}
#
# Test "list function" for C source file
#
proc test_list_function {} {
global gdb_prompt
# gcc appears to generate incorrect debugging information for code
# in include files, which breaks this test.
# SunPRO cc is the second case below, it's also correct.
2011-12-13 17:22:11 +00:00
gdb_test "list main" "(5\[ \t\]+int x;.*8\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*7\[ \t\]+x = 0;)" "list function in source file 1"
1999-04-16 01:35:26 +00:00
# Ultrix gdb takes the second case below; it's also correct.
# SunPRO cc is the third case.
1999-06-28 16:06:02 +00:00
gdb_test "list bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2"
1999-04-16 01:35:26 +00:00
# Test "list function" for C include file
# Ultrix gdb is the second case, still correct.
# SunPRO cc is the third case.
gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
}
proc test_list_forward {} {
global gdb_prompt
2013-03-28 11:56:51 +00:00
global last_line_re
1999-04-16 01:35:26 +00:00
set testcnt 0
send_gdb "list list0.c:10\n"
gdb_expect {
-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list\n"
gdb_expect {
-re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list\n"
gdb_expect {
-re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list\n"
gdb_expect {
2013-03-28 11:56:51 +00:00
-re "35\[ \t\]+foo \\(.*\\);.*${last_line_re}\r\n$gdb_prompt $" { incr testcnt }
1999-04-16 01:35:26 +00:00
-re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
}
pass "successive list commands to page forward ($testcnt tests)"
2013-06-07 17:31:09 +00:00
gdb_stop_suppressing_tests
1999-04-16 01:35:26 +00:00
}
1999-08-02 23:48:37 +00:00
# Test that repeating the list linenum command doesn't print the same
# lines over again. Note that this test makes sure that the argument
# linenum is dropped, when we repeat the previous command. 'x/5i $pc'
# works the same way.
proc test_repeat_list_command {} {
global gdb_prompt
2013-03-28 11:56:51 +00:00
global last_line_re
1999-08-02 23:48:37 +00:00
set testcnt 0
send_gdb "list list0.c:10\n"
gdb_expect {
-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
}
send_gdb "\n"
gdb_expect {
-re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
}
send_gdb "\n"
gdb_expect {
-re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
}
send_gdb "\n"
gdb_expect {
2013-03-28 11:56:51 +00:00
-re "35\[ \t\]+foo \\(.*\\);.*${last_line_re}\r\n$gdb_prompt $" { incr testcnt }
1999-08-02 23:48:37 +00:00
-re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
}
pass "repeat list commands to page forward using 'return' ($testcnt tests)"
2013-06-07 17:31:09 +00:00
gdb_stop_suppressing_tests
1999-08-02 23:48:37 +00:00
}
1999-04-16 01:35:26 +00:00
proc test_list_backwards {} {
global gdb_prompt
set testcnt 0
send_gdb "list list0.c:33\n"
gdb_expect {
1999-06-28 16:06:02 +00:00
-re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt }
1999-04-16 01:35:26 +00:00
-re ".*$gdb_prompt $" { fail "list list0.c:33" ; gdb_suppress_tests }
timeout { fail "list list0.c:33 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list -\n"
gdb_expect {
-re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
-re ".*$gdb_prompt $" { fail "list 18-27" ; gdb_suppress_tests }
timeout { fail "list 18-27 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list -\n"
gdb_expect {
2011-12-13 17:22:11 +00:00
-re "8\[ \t\]+foo \[(\]+.*\[)\]+;.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
1999-04-16 01:35:26 +00:00
-re ".*$gdb_prompt $" { fail "list 8-17" ; gdb_suppress_tests }
timeout { fail "list 8-17 (timeout)" ; gdb_suppress_tests }
}
send_gdb "list -\n"
gdb_expect {
2011-12-13 17:22:11 +00:00
-re "1\[ \t\]+#include .*7\[ \t\]+x = 0;\r\n$gdb_prompt $" { incr testcnt }
1999-04-16 01:35:26 +00:00
-re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests }
timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests }
}
pass "$testcnt successive \"list -\" commands to page backwards"
2013-06-07 17:31:09 +00:00
gdb_stop_suppressing_tests
1999-04-16 01:35:26 +00:00
}
#
# Test "list first,last"
#
proc test_list_range {} {
global gdb_prompt
2013-03-28 11:56:51 +00:00
global last_line_re
global last_line
1999-04-16 01:35:26 +00:00
1999-06-28 16:06:02 +00:00
gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2"
1999-04-16 01:35:26 +00:00
1999-06-28 16:06:02 +00:00
gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2"
1999-04-16 01:35:26 +00:00
# gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative"
# gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
2013-03-28 11:56:51 +00:00
set past_end [expr ${last_line} + 10]
set much_past_end [expr ${past_end} + 10]
gdb_test "list 30,${past_end}" "30\[ \t\]+foo \(.*\);.*${last_line_re}" "list range; upper bound past EOF"
1999-04-16 01:35:26 +00:00
2013-03-28 11:56:51 +00:00
gdb_test "list ${past_end},${much_past_end}" "Line number ${past_end} out of range; .*list0.c has ${last_line} lines." "list range; both bounds past EOF"
1999-04-16 01:35:26 +00:00
gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files"
}
#
# Test "list filename:function"
#
proc test_list_filename_and_function {} {
global gdb_prompt
2013-03-28 11:56:51 +00:00
global last_line_re
1999-04-16 01:35:26 +00:00
set testcnt 0
# gcc appears to generate incorrect debugging information for code
# in include files, which breaks this test.
# SunPRO cc is the second case below, it's also correct.
send_gdb "list list0.c:main\n"
gdb_expect {
2011-12-13 17:22:11 +00:00
-re "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
pass "list function in source file 1"
}
-re ".*$gdb_prompt $" { fail "list list0.c:main" }
timeout { fail "list list0.c:main (timeout)" }
}
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
send_gdb "list list0.c:unused\n"
gdb_expect {
2013-03-28 11:56:51 +00:00
-re "40\[ \t\]+unused.*${last_line_re}\r\n$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list0.c:unused" }
timeout { fail "list list0.c:unused (timeout)" }
}
clear_xfail "rs6000-*-aix*"
# gcc appears to generate incorrect debugging information for code
# in include files, which breaks this test.
# Ultrix gdb is the second case, one line different but still correct.
# SunPRO cc is the third case.
setup_xfail "rs6000-*-*" 1804
setup_xfail_format "COFF"
send_gdb "list list0.h:foo\n"
gdb_expect {
-re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
incr testcnt
}
-re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
incr testcnt
}
-re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
incr testcnt
}
-re "No source file named list0.h.\r\n$gdb_prompt $" {
fail "list list0.h:foo"
}
-re ".*$gdb_prompt $" { fail "list list0.h:foo" }
timeout { fail "list list0.h:foo (timeout)" }
}
# Ultrix gdb is the second case.
send_gdb "list list1.c:bar\n"
gdb_expect {
1999-06-28 16:06:02 +00:00
-re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
1999-06-28 16:06:02 +00:00
-re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
1999-06-28 16:06:02 +00:00
-re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list1.c:bar" }
timeout { fail "list list1.c:bar (timeout)" }
}
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
send_gdb "list list1.c:unused\n"
gdb_expect {
1999-06-28 16:06:02 +00:00
-re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
1999-06-28 16:06:02 +00:00
-re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" {
1999-04-16 01:35:26 +00:00
incr testcnt
}
-re ".*$gdb_prompt $" { fail "list list1.c:unused" }
timeout { fail "list list1.c:unused (timeout)" }
}
clear_xfail "rs6000-*-aix*"
pass "list filename:function ($testcnt tests)"
2010-02-16 20:51:51 +00:00
# Test with quoting.
gdb_test "list 'list0.c:main'" "int main.*"
1999-04-16 01:35:26 +00:00
# Test some invalid specs
# The following test takes the FIXME result on most systems using
# DWARF. It fails to notice that main() is not in the file requested.
setup_xfail "*-*-*"
# Does this actually work ANYWHERE? I believe not, as this is an `aspect' of
# lookup_symbol(), where, when it is given a specific symtab which does not
# contain the requested symbol, it will subsequently search all of the symtabs
# for the requested symbol.
gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected"
1999-06-28 16:06:02 +00:00
gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
1999-04-16 01:35:26 +00:00
the "ambiguous linespec" series
gdb
2011-12-06 Joel Brobecker <brobecker@acacore.com>
* language.h (struct language_defn): Add new component
la_symbol_name_compare.
* symfile.h (struct quick_symbol_functions): Update the profile
of parameter "name_matcher" for the expand_symtabs_matching
method. Update the documentation accordingly.
* ada-lang.h (ada_name_for_lookup): Add declaration.
* ada-lang.c (ada_name_for_lookup): New function, extracted out
from ada_iterate_over_symbols.
(ada_iterate_over_symbols): Do not encode symbol name anymore.
(ada_expand_partial_symbol_name): Adjust profile.
(ada_language_defn): Add value for la_symbol_name_compare field.
* linespec.c: #include "ada-lang.h".
(iterate_name_matcher): Add language parameter. Replace call
to strcmp_iw by call to language->la_symbol_name_compare.
(decode_variable): Encode COPY if current language is Ada.
* dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile
of name_matcher parameter. Adjust call to name_matcher.
* psymtab.c (expand_symtabs_matching_via_partial): Likewise.
(expand_partial_symbol_names): Update profile of parameter "fun".
* psymtab.h (expand_partial_symbol_names): Update profile of
parameter "fun".
* symtab.c (demangle_for_lookup): Update function documentation.
(search_symbols_name_matches): Add language parameter.
(expand_partial_symbol_name): Likewise.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Add value for
la_symbol_name_compare field.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Ditto.
* jv-lang.c (java_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* opencl-lang.c (opencl_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Ditto.
2011-12-06 Tom Tromey <tromey@redhat.com>
* linespec.c (iterate_over_all_matching_symtabs): Use
LA_ITERATE_OVER_SYMBOLS.
(lookup_prefix_sym, add_matching_symbols_to_info): Likewise.
(find_function_symbols, decode_variable): Remove Ada special
case.
* language.h (struct language_defn) <la_iterate_over_symbols>: New
field.
(LA_ITERATE_OVER_SYMBOLS): New macro.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Update.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* jv-lang.c (java_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* p-lang.c (pascal_language_defn): Update.
* ada-lang.c (ada_iterate_over_symbols): New function.
(ada_language_defn): Update.
2011-12-06 Tom Tromey <tromey@redhat.com>
Joel Brobecker <brobecker@acacore.com>
PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366,
PR objc/8535, PR breakpoints/11657, PR breakpoints/11970,
PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856,
PR shlibs/8929, PR shlibs/7393:
* python/py-type.c (compare_maybe_null_strings): Rename from
compare_strings.
(check_types_equal): Update.
* utils.c (compare_strings): New function.
* tui/tui-winsource.c (tui_update_breakpoint_info): Update for
location changes.
* tracepoint.c (scope_info): Update.
(trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE.
* symtab.h (iterate_over_minimal_symbols)
(iterate_over_some_symtabs, iterate_over_symtabs)
(find_pcs_for_symtab_line, iterate_over_symbols)
(demangle_for_lookup): Declare.
(expand_line_sal): Remove.
* symtab.c (iterate_over_some_symtabs, iterate_over_symtabs)
(lookup_symtab_callback): New functions.
(lookup_symtab): Rewrite.
(demangle_for_lookup): New function, extract from
lookup_symbol_in_language.
(lookup_symbol_in_language): Use it.
(iterate_over_symbols): New function.
(find_line_symtab): Update.
(find_pcs_for_symtab_line): New functions.
(find_line_common): Add 'start' argument.
(decode_line_spec): Update. Change argument to 'flags', change
interpretation.
(append_expanded_sal): Remove.
(append_exact_match_to_sals): Remove.
(expand_line_sal): Remove.
* symfile.h (struct quick_symbol_functions) <lookup_symtab>:
Remove.
<map_symtabs_matching_filename>: New field.
* stack.c (func_command): Only look in the current program space.
Use DECODE_LINE_FUNFIRSTLINE.
* source.c (line_info): Set pspace on sal. Check program space in
the loop. Use DECODE_LINE_LIST_MODE.
(select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE.
* solib-target.c: Remove DEF_VEC_I(CORE_ADDR).
* python/python.c (gdbpy_decode_line): Update.
* psymtab.c (partial_map_expand_apply): New function.
(partial_map_symtabs_matching_filename): Rename from
lookup_partial_symbol. Update arguments.
(lookup_symtab_via_partial_symtab): Remove.
(psym_functions): Update.
* objc-lang.h (parse_selector, parse_method): Don't declare.
(find_imps): Update.
* objc-lang.c (parse_selector, parse_method): Now static.
(find_methods): Change arguments. Fill in a vector of symbol
names.
(uniquify_strings): New function.
(find_imps): Change arguments.
* minsyms.c (iterate_over_minimal_symbols): New function.
* linespec.h (enum decode_line_flags): New.
(struct linespec_sals): New.
(struct linespec_result) <canonical>: Remove.
<pre_expanded, addr_string, sals>: New fields.
(destroy_linespec_result, make_cleanup_destroy_linespec_result)
(decode_line_full): Declare.
(decode_line_1): Update.
* linespec.c (struct address_entry, struct linespec_state, struct
collect_info): New types.
(add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry)
(eq_address_entry, maybe_add_address): New functions.
(total_number_of_methods): Remove.
(iterate_name_matcher, iterate_over_all_matching_symtabs): New
functions.
(find_methods): Change arguments. Don't canonicalize input.
Simplify logic.
(add_matching_methods, add_constructors)
(build_canonical_line_spec): Remove.
(filter_results, convert_results_to_lsals): New functions.
(decode_line_2): Change arguments. Rewrite for new data
structures.
(decode_line_internal): Rename from decode_line_1. Change
arguments. Add cleanups. Update for new data structures.
(linespec_state_constructor, linespec_state_destructor)
(decode_line_full, decode_line_1): New functions.
(decode_indirect): Change arguments. Update.
(locate_first_half): Use skip_spaces.
(decode_objc): Change arguments. Update for new data structures.
Simplify logic.
(decode_compound): Change arguments. Add cleanups. Remove
fallback code, replace with error.
(struct decode_compound_collector): New type.
(collect_one_symbol): New function.
(lookup_prefix_sym): Change arguments. Update.
(compare_symbol_name, add_all_symbol_names_from_pspace)
(find_superclass_methods ): New functions.
(find_method): Rewrite.
(struct symtab_collector): New type.
(add_symtabs_to_list, collect_symtabs_from_filename): New
functions.
(symtabs_from_filename): Change API. Rename from
symtab_from_filename.
(collect_function_symbols): New function.
(find_function_symbols): Change API. Rename from
find_function_symbol. Rewrite.
(decode_all_digits): Change arguments. Rewrite.
(decode_dollar): Change arguments. Use decode_variable.
(decode_label): Change arguments. Rewrite.
(collect_symbols): New function.
(minsym_found): Change arguments. Rewrite.
(check_minsym, search_minsyms_for_name)
(add_matching_symbols_to_info): New function.
(decode_variable): Change arguments. Iterate over all symbols.
(symbol_found): Remove.
(symbol_to_sal): New function.
(init_linespec_result, destroy_linespec_result)
(cleanup_linespec_result, make_cleanup_destroy_linespec_result):
New functions.
(decode_digits_list_mode, decode_digits_ordinary): New functions.
* dwarf2read.c (dw2_map_expand_apply): New function.
(dw2_map_symtabs_matching_filename): Rename from
dw2_lookup_symtab. Change arguments.
(dwarf2_gdb_index_functions): Update.
* dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR).
* defs.h (compare_strings): Declare.
* cli/cli-cmds.c (compare_strings): Move to utils.c.
(edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call
filter_sals.
(compare_symtabs, filter_sals): New functions.
* breakpoint.h (struct bp_location) <line_number, source_file>:
New fields.
(struct breakpoint) <line_number, source_file>: Remove.
<filter>: New field.
* breakpoint.c (print_breakpoint_location, init_raw_breakpoint)
(momentary_breakpoint_from_master, add_location_to_breakpoint):
Update for changes to locations.
(init_breakpoint_sal): Add 'filter' argument. Set 'filter' on
breakpoint.
(create_breakpoint_sal): Add 'filter' argument.
(remove_sal, expand_line_sal_maybe): Remove.
(create_breakpoints_sal): Remove 'sals' argument. Handle
pre-expanded sals and the filter.
(parse_breakpoint_sals): Use decode_line_full.
(check_fast_tracepoint_sals): Use get_sal_arch.
(create_breakpoint): Create a linespec_sals. Update.
(break_range_command): Use decode_line_full. Update.
(until_break_command): Update.
(clear_command): Update match conditions for linespec.c changes.
Use DECODE_LINE_LIST_MODE.
(say_where): Update for changes to locations.
(bp_location_dtor): Free 'source_file'.
(base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'.
(update_static_tracepoint): Update for changes to locations.
(update_breakpoint_locations): Disable ranged breakpoint if too
many locations match. Update.
(addr_string_to_sals): Use decode_line_full. Resolve all sal
PCs.
(breakpoint_re_set_default): Don't call expand_line_sal_maybe.
(decode_line_spec_1): Update. Change argument name to 'flags',
change interpretation.
* block.h (block_containing_function): Declare.
* block.c (block_containing_function): New function.
* skip.c (skip_function_command): Update.
(skip_re_set): Update.
* infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE.
* mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE.
* NEWS: Add entry.
2011-12-06 Tom Tromey <tromey@redhat.com>
* elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow
breakpoint's pspace to be NULL.
* breakpoint.h (struct breakpoint) <pspace>: Update comment.
* breakpoint.c (init_raw_breakpoint): Conditionally set
breakpoint's pspace.
(init_breakpoint_sal): Don't set breakpoint's pspace.
(prepare_re_set_context): Conditionally switch program space.
(addr_string_to_sals): Check executing_startup on location's
program space.
2011-12-06 Tom Tromey <tromey@redhat.com>
* breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove.
* breakpoint.c (should_be_inserted): Explicitly check if program
space is executing startup.
(describe_other_breakpoints): Update.
(disable_breakpoints_before_startup): Change executing_startup
earlier. Remove loop.
(enable_breakpoints_after_startup): Likewise.
(init_breakpoint_sal): Don't use bp_startup_disabled.
(create_breakpoint): Don't use bp_startup_disabled.
(update_global_location_list): Use should_be_inserted.
(bkpt_re_set): Update.
gdb/testsuite
2011-12-06 Joel Brobecker <brobecker@acacore.com>
* gdb.ada/fullname_bp.exp: Add tests for other valid linespecs
involving a fully qualified function name.
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.ada/homonym.exp: Add three breakpoint tests.
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.base/solib-weak.exp (do_test): Remove kfail.
* gdb.trace/tracecmd.exp: Disable pending breakpoints earlier.
* gdb.objc/objcdecode.exp: Update for output changes.
* gdb.linespec/linespec.exp: New file.
* gdb.linespec/lspec.cc: New file.
* gdb.linespec/lspec.h: New file.
* gdb.linespec/body.h: New file.
* gdb.linespec/base/two/thefile.cc: New file.
* gdb.linespec/base/one/thefile.cc: New file.
* gdb.linespec/Makefile.in: New file.
* gdb.cp/templates.exp (test_template_breakpoints): Update for
output changes.
* gdb.cp/re-set-overloaded.exp: Remove kfail.
* gdb.cp/ovldbreak.exp: Update for output changes. "all" test now
makes one breakpoint.
* gdb.cp/method2.exp (test_break): Update for output changes.
* gdb.cp/mb-templates.exp: Update for output changes.
* gdb.cp/mb-inline.exp: Update for output changes.
* gdb.cp/mb-ctor.exp: Update for output changes.
* gdb.cp/ovsrch.exp: Use fully-qualified names.
* gdb.base/solib-symbol.exp: Run to main later. Breakpoint now
has multiple matches.
* gdb.base/sepdebug.exp: Disable pending breakpoints. Update for
error message change.
* gdb.base/list.exp (test_list_filename_and_number): Update for
error message change.
* gdb.base/break.exp: Disable pending breakpoints. Update for
output changes.
* configure.ac: Add gdb.linespec.
* configure: Rebuild.
* Makefile.in (ALL_SUBDIRS): Add gdb.linespec.
gdb/doc
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 18:54:43 +00:00
gdb_test "list list0.h:foobar" "Function \"foobar\" not defined in \"list0.h\"." "list filename:function; nonexistant function"
1999-04-16 01:35:26 +00:00
}
proc test_forward_search {} {
global timeout
2010-06-01 21:29:21 +00:00
gdb_test_no_output "set listsize 4"
1999-04-16 01:35:26 +00:00
# On SunOS4, this gives us lines 19-22. On AIX, it gives us
# lines 20-23. This depends on whether the line number of a function
# is considered to be the openbrace or the first statement--either one
# is acceptable.
1999-06-28 16:06:02 +00:00
gdb_test "list long_line" "24\[ \t\]+long_line .*"
1999-04-16 01:35:26 +00:00
gdb_test "search 4321" " not found"
1999-06-28 16:06:02 +00:00
gdb_test "search 6789" "28\[ \t\]+oof .6789.;"
1999-04-16 01:35:26 +00:00
# Test that GDB won't crash if the line being searched is extremely long.
set oldtimeout $timeout
set timeout [expr "$timeout + 300"]
verbose "Timeout is now $timeout seconds" 2
gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
}
2012-08-06 20:14:11 +00:00
proc test_only_end {} {
gdb_test_no_output "set listsize 2"
gdb_test "list 1" "list 1\r\n1\[ \t\]\[^\r\n\]*\r\n2\[ \t\]\[^\r\n\]*"
gdb_test "list ,5" "list ,5\r\n4\[ \t\]\[^\r\n\]*\r\n5\[ \t\]\[^\r\n\]*"
}
1999-04-16 01:35:26 +00:00
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
2012-06-15 14:43:00 +00:00
gdb_file_cmd ${binfile}
1999-04-16 01:35:26 +00:00
2010-06-01 21:29:21 +00:00
gdb_test_no_output "set width 0"
1999-04-16 01:35:26 +00:00
test_listsize
get_debug_format
if [ set_listsize 10 ] then {
test_list_include_file
test_list_filename_and_number
test_list_function
test_list_forward
test_list_backwards
1999-08-02 23:48:37 +00:00
test_repeat_list_command
1999-04-16 01:35:26 +00:00
test_list_range
test_list_filename_and_function
test_forward_search
2012-08-06 20:14:11 +00:00
test_only_end
1999-04-16 01:35:26 +00:00
}
1999-06-28 16:06:02 +00:00
remote_exec build "rm -f list0.h"