On Linux native, if dprintfs are inserted when detaching, they are left
in the inferior which causes it to crash from a SIGTRAP. It also happens
with dprintfs on remote targets, when set disconnected-dprintf is off.
The rationale of the line modified by the patch was to leave dprintfs
inserted in order to support disconnected dprintfs. However, not all
dprintfs are persistent. Also, there's no reason other kinds of
breakpoints can't be persistent either. So this replaces the bp_dprintf
check with a check on whether the location is persistent.
bl->target_info.persist will be 1 only if disconnected-dprintf is on and
we are debugging a remote target. On native, it will always be 0,
regardless of the value of disconnected-dprintf. This makes sense, since
disconnected dprintfs are not supported by the native target.
One issue about the test is that it does not pass when using
--target_board=native-extended-gdbserver, partly due to bug 17302 [1].
One quick hack I tried for this was to add a useless "next" between the
call to getpid() and detach, which avoids the bug. There is still one
case where the test fails, and that is with:
- breakpoint always-inserted on
- dprintf-style agent
- disconnected-dprintf on
What happens is that my detach does not actually detach the process,
because some persistent commands (the disconnected dprintf) is present.
However since gdbserver is ran with --once, when gdb disconnects,
gdbserver goes down and takes with it all the processes it spawned and
that are still under its control (which includes my test process).
When the test checks if the test process is still alive, it obvisouly
fails. Investigating about that led me to ask a question on the ML [2]
about the behavior of detach.
Until the remote case is sorted out, the problematic test is marked as
KFAIL.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=17302
[2] https://sourceware.org/ml/gdb/2014-08/msg00115.html
gdb/Changelog:
PR breakpoints/17012
* breakpoint.c (remove_breakpoints_pid): Skip removing
breakpoint if it is marked as persistent.
gdb/testsuite/ChangeLog:
PR breakpoints/17012
* gdb.base/dprintf-detach.c: New file.
* gdb.base/dprintf-detach.exp: New file.
This patch introduces a function in gdbserver-support.exp to find out
whether the current target is GDBserver.
The code was inspired from gdb.trace/qtro.exp, so it replaces the code
there by a call to the new function.
gdb/testsuite/ChangeLog:
* gdb.trace/qtro.exp: Replace gdbserver detection code by...
* lib/gdb.exp (target_is_gdbserver): New
procedure.
This patch is to revert my previous commit, because we shouldn't remove
gdbtk bits from gdb/testsuite/configure.ac while keep gdbtk bits in
gdb/configure.ac.
gdb/testsuite:
2014-12-05 Yao Qi <yao@codesourcery.com>
Revert:
* configure.ac: Remove AC_ARG_ENABLE for gdbtk. Don't invoke
AC_CONFIG_SUBDIRS(gdb.gdbtk).
* configure: Re-generated.
Some gdb.guile tests such as scm-error.exp copies .scm file to
${subdir}/, how ${subdir} doesn't exist in parallel testing
(outputs/${subdir} exists).
$ make -j3 check TESTS='gdb.guile/scm-section-script.exp gdb.guile/scm-error.exp gdb.guile/scm-frame-args.exp'
ERROR: remote_download to host of ../../../../git/gdb/testsuite/gdb.guile/scm-section-script.scm to gdb.guile/t-scm-section-script.scm: cp: cannot create regular file 'gdb.guile/t-scm-section-script.scm': No such file or directory
ERROR: remote_download to host of ../../../../git/gdb/testsuite/gdb.guile/scm-frame-args.scm to gdb.guile/t-scm-frame-args.scm: cp: cannot create regular file
'gdb.guile/t-scm-frame-args.scm': No such file or directory
ERROR: remote_download to host of ../../../../git/gdb/testsuite/gdb.guile/scm-error-1.scm to gdb.guile/t-scm-error-1.scm: cp: cannot create regular file 'gdb.guile/t-scm-error-1.scm': No such file or directory
This patch is to remove the third argument of gdb_remote_download, so
that gdb_remote_download can return the correct location.
Further, these tests only copy .scm files to a different name. From what
I can tell from the comments, looks we do this to avoid clobbering file
in in-tree build. However, if source and dest of copy are the same, the
operation is no-op. So it makes few sense to copy .scm files to a
different names. I tried in-tree build/test with this patch, test
result isn't changed.
gdb/testsuite:
2014-12-05 Yao Qi <yao@codesourcery.com>
* gdb.guile/scm-error.exp: Remove the third argument to
gdb_remote_download.
* gdb.guile/scm-frame-args.exp: Likewise.
* gdb.guile/scm-section-script.exp: Likewise.
This patch is to use standard_testfile in i386-bp_permanent.exp to replace
existing setting to testfile, srcfile and binfile. So it fixes a problem
in i386-bp_permanent.exp in parallel testing.
$ make -j3 check TESTS='gdb.guile/scm-section-script.exp gdb.arch/i386-bp_permanent.exp'
....
gdb compile failed, /usr/bin/ld: cannot open output file x86/gdb/testsuite/gdb.arch/i386-bp_permanent: No such file or directory
collect2: error: ld returned 1 exit status
gdb/testsuite:
2014-12-05 Yao Qi <yao@codesourcery.com>
* gdb.arch/i386-bp_permanent.exp: Use standard_testfile.
Address issues triggered by the MIPS ISA bit handling change, usually in
tests that make artificial DWARF-2 records:
* gdb.cp/expand-psymtabs-cxx.exp -- this test is debugging an object file
and assuming addresses will be 0; with the ISA bit set code addresses
are 1 instead:
(gdb) PASS: gdb.cp/expand-psymtabs-cxx.exp: set language c++
p 'method(long)'
$1 = {void (long)} 0x1 <method(long)>
(gdb) FAIL: gdb.cp/expand-psymtabs-cxx.exp: before expand
p method
$2 = {void (long)} 0x1 <method(long)>
(gdb) FAIL: gdb.cp/expand-psymtabs-cxx.exp: force expand
p 'method(long)'
$3 = {void (long)} 0x1 <method(long)>
(gdb) FAIL: gdb.cp/expand-psymtabs-cxx.exp: after expand
Fix by matching any hex number, there's no value AFAICT for the test
in matching 0 exactly, and I suppose the method's offset within
section can be non-zero for some other reasons on other targets too.
* gdb.cp/nsalias.exp -- this assumes instructions can be aligned
arbitrarily and places code labels at odd addreses, setting the ISA
bit and wreaking havoc:
(gdb) PASS: gdb.cp/nsalias.exp: print outer::inner::innermost::x
list outer::inner::innermost::foo
Function "outer::inner::innermost::foo" not defined.
(gdb) FAIL: gdb.cp/nsalias.exp: list outer::inner::innermost::foo
break *outer::inner::innermost::foo
No symbol "foo" in namespace "outer::inner::innermost".
(gdb) FAIL: gdb.cp/nsalias.exp: setting breakpoint at
*outer::inner::innermost::foo
delete $bpnum
No breakpoint number 6.
(gdb) FAIL: gdb.cp/nsalias.exp: (outer::inner::innermost): delete $bpnum
-- etc., etc... Fix by aligning labels to 4; required by many
processors.
* gdb.dwarf2/dw2-canonicalize-type.exp, gdb.dwarf2/dw2-empty-pc-range.exp,
gdb.dwarf2/pr11465.exp -- these assume an instruction and consequently
a function can take as little as 1 byte, which makes it impossible to
look up a code symbol by an address with the ISA bit set as the
address is already beyond the end of the function:
(gdb) ptype f
No symbol "f" in current context.
(gdb) FAIL: gdb.dwarf2/dw2-canonicalize-type.exp: ptype f
(gdb) PASS: gdb.dwarf2/dw2-empty-pc-range.exp: empty range before CU load
ptype realrange
No symbol "realrange" in current context.
(gdb) FAIL: gdb.dwarf2/dw2-empty-pc-range.exp: valid range after CU load
(gdb) p N::c.C
Cannot take address of method C.
(gdb) FAIL: gdb.dwarf2/pr11465.exp: p N::c.C
-- fix by increasing the size of the function to 4 (perhaps code in
gdb/mips-tdep.c could look up code symbols up to twice, with and
failing that without the ISA bit set, but it seems wrong to me to
implement specific handling for invalid code just to satisfy test
cases that assume too much about the target).
* gdb.dwarf2/dw2-case-insensitive.exp -- an artificial code label is
created, but does not work because data (a `.align' pseudo-op in this
case) follows and as a result the label has no MIPS16 or microMIPS
annotation in the symbol table:
(gdb) PASS: gdb.dwarf2/dw2-case-insensitive.exp: set case-sensitive off
info functions fUnC_lang
All functions matching regular expression "fUnC_lang":
File file1.txt:
foo FUNC_lang(void);
Non-debugging symbols:
0x004006e0 FUNC_lang_start
(gdb) FAIL: gdb.dwarf2/dw2-case-insensitive.exp: regexp case-sensitive off
-- fix by adding a `.insn' pseudo-op on MIPS targets; the pseudo-op
marks data as instructions.
* gdb.dwarf2/dw2-stack-boundary.exp -- the test case enables complaints
and assumes none will be issued beyond ones explicitly arranged by the
test case, however overlapping sections are noticed while minimal
symbols are looked up by `mips_adjust_dwarf2_addr' in DWARF-2 record
processing:
(gdb) set complaints 100
(gdb) PASS: gdb.dwarf2/dw2-stack-boundary.exp: set complaints 100
file ./dw2-stack-boundary
Reading symbols from ./dw2-stack-boundary...location description stack
underflow...location description stack overflow...unexpected overlap
between:
(A) section `.reginfo' from `.../gdb.dwarf2/dw2-stack-boundary' [0x0, 0x18)
(B) section `*COM*' from `.../gdb.dwarf2/dw2-stack-boundary' [0x0, 0x0).
Will ignore section B...unexpected overlap between:
(A) section `.reginfo' from `.../gdb.dwarf2/dw2-stack-boundary' [0x0, 0x18)
(B) section `*UND*' from `.../gdb.dwarf2/dw2-stack-boundary' [0x0, 0x0).
Will ignore section B...unexpected overlap between:
(A) section `.reginfo' from `.../gdb.dwarf2/dw2-stack-boundary' [0x0, 0x18)
(B) section `*ABS*' from `.../gdb.dwarf2/dw2-stack-boundary' [0x0, 0x0).
Will ignore section B...done.
(gdb) FAIL: gdb.dwarf2/dw2-stack-boundary.exp: check partial symtab errors
-- fix by ignoring any extra noise as long as what we look for is
found.
* gdb.cp/expand-psymtabs-cxx.exp: Accept any address of
`method(long)', not just 0x0.
* gdb.cp/nsalias.exp: Align code labels to 4.
* gdb.dwarf2/dw2-canonicalize-type.S (main): Expand to 4-bytes.
* gdb.dwarf2/dw2-empty-pc-range.S (main): Likewise.
* gdb.dwarf2/pr11465.S (_ZN1N1cE): Likewise.
* gdb.dwarf2/dw2-case-insensitive.c (START_INSNS): New macro.
(cu_text_start, FUNC_lang_start): Use `START_INSNS'.
* gdb.dwarf2/dw2-stack-boundary.exp: Accept noise in complaints.
The test case builds two copies of the program, one with the compile
option "ldflags=-Wl,-Ttext=0x1000000" and the other with the address
changed to 0x2000000. However, when linking with ld.bfd, the
resulting executables crash early in ld.so on S390 and i386.
Analysis of the crash: The default linker script establishes a certain
order of loadable sections, and the option "-Ttext" effectively splits
these into an "unaffected" lot (everything before .text) and an
"affected" lot. The affected lot is placed at the given address,
whereas the unaffected lot stays at its default address. The
unaffected lot starts at an aligned address plus Elf header sizes,
which is good if it is the first LOAD segment (like on AMD64). But if
the affected lot comes first instead (like on S390 and i386), the PHDR
doesn't fit there and is placed *outside* any LOAD segments. Then the
PHDR is not mapped when the loader gets control, and the loader runs
into a segmentation fault while trying to access it.
Since we are lucky about the order of segments on AMD64, the test
succeeds there, but the resulting binaries are unusually large -- 2.1M
each, with lots of padding within.
When replacing '-Ttext' by '-Ttext-segment', the linker moves all
segments consistently, the binaries have normal sizes, and the test
case succeeds on all mentioned platforms.
Since old versions of the gold linker don't support '-Ttext-segment',
the patch also adds logic for falling back to '-Ttext'.
gdb/testsuite/ChangeLog:
* gdb.base/execl-update-breakpoints.exp: Specify the link address
with '-Ttext-segment' instead of '-Ttext'. Fall back to '-Ttext'
if the linker doesn't understand this.
The message displayed when using help() changed a bit with time, so this
adjusts the test accordingly.
gdb/testsuite/ChangeLog:
* gdb.python/python.exp: Change expected reply to help().
When I skim configure.ac and Makefile.in in gdb/testsuite, I happen to
see that directory gdb.gdbtk is added to subdirs, however it doesn't
exist. gdb/testsuite/gdb.gdbtk was removed by the patch below,
[rfa] git repo fixup: delete gdb/testsuite/gdb.gdbtk
http://thread.gmane.org/gmane.comp.gdb.patches/61489
and we should cleanup configure.ac accordingly.
gdb/testsuite:
2014-12-01 Yao Qi <yao@codesourcery.com>
* configure.ac: Remove AC_ARG_ENABLE for gdbtk. Don't invoke
AC_CONFIG_SUBDIRS(gdb.gdbtk).
* configure: Re-generated.
gdb/ChangeLog:
* eval.c: Include gdbthread.h.
(evaluate_subexp): Enable thread stack temporaries before
evaluating a complete expression and clean them up after the
evaluation is complete.
* gdbthread.h: Include common/vec.h.
(value_ptr): New typedef.
(VEC (value_ptr)): New vector type.
(value_vec): New typedef.
(struct thread_info): Add new fields stack_temporaries_enabled
and stack_temporaries.
(enable_thread_stack_temporaries)
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary)
(value_in_thread_stack_temporaries): Declare.
* gdbtypes.c (class_or_union_p): New function.
* gdbtypes.h (class_or_union_p): Declare.
* infcall.c (call_function_by_hand): Store return values of class
type as temporaries on stack.
* thread.c (enable_thread_stack_temporaries): New function.
(thread_stack_temporaries_enabled_p, push_thread_stack_temporary)
(get_last_thread_stack_temporary): Likewise.
(value_in_thread_stack_temporaries): Likewise.
* value.c (value_force_lval): New function.
* value.h (value_force_lval): Declare.
gdb/testsuite/ChangeLog:
* gdb.cp/chained-calls.cc: New file.
* gdb.cp/chained-calls.exp: New file.
* gdb.cp/smartp.exp: Remove KFAIL for "p c2->inta".
Python 3's print requires to use parentheses, so this patch adds them
where they were missing.
gdb/testsuite/ChangeLog:
* gdb.ada/py_range.exp: Add parentheses to calls to print.
* gdb.dwarf2/symtab-producer.exp: Same.
* gdb.gdb/python-interrupts.exp: Same.
* gdb.gdb/python-selftest.exp: Same.
* gdb.python/py-linetable.exp: Same.
* gdb.python/py-type.exp: Same.
* gdb.python/py-value-cc.exp: Same.
* gdb.python/py-value.exp: Same.
We enable systemtap probe in glibc recently, and see the following gdb fail,
(gdb) set solib-absolute-prefix /.
...
Stopped due to shared library event:^M
Inferior loaded /./foo/bar/gdb.base/break-probes-solib.so
...
(gdb) FAIL: gdb.base/break-probes.exp: run til our library loads (the program exited)
$binfile_lib is /foo/bar/gdb.base/break-probes-solib.so, but the
sysroot is prefixed in solib.c:solib_find, as comments described:
Global variable GDB_SYSROOT is used as a prefix directory
to search for shared libraries if they have an absolute path.
so the output becomes "/./foo/bar/gdb.base/break-probes-solib.so", which
is still correct. However, the test repeatedly continue the program
and tries to match $binfile_lib, finally, the program exits and the
test fails.
This patch is to adjust the pattern to match $sysroot$binfile_lib
instead of $binfile_lib.
gdb/testsuite:
2014-11-28 Yao Qi <yao@codesourcery.com>
* gdb.base/break-probes.exp: Match library name prefixed with
sysroot.
The following test is found in python/py-linetable.exp:
gdb_test "python print sorted(fset)" \
"\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \
"Test frozen set contains line numbers"
I noticed that it passed when using Python 3, even though it should fail
because of the missing parentheses for the call print.
There needs to be more escaping of the square brackets. Currently, it is
interpreted as "any one character from this big list of characters,
followed by .*". When adding the required amount of backslashes, the
test starts failing as it should.
Moreover, both in Python 2.7 and Python 3.3 the numbers don't have the L
suffix, so now the test fails because of that. Anybody knows why they
were there in the first place? I just tested with Python 2.4 and there
are no Ls.
gdb/testsuite/ChangeLog:
* gdb.python/py-linetable.exp: Escape properly sorted(fset)
test expected output. Add parentheses for the call to print.
Remove L suffix from integers.
Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
MACRO_AT_func can be used in gdb.trace/entry-values.exp to correctly
get function's address in generated debug info. As a result, the test
is more friendly to clang. Currently, there are some fails in
entry-values.exp when the test is compiled by clang. With this patch
applied, all fails go away.
gdb/testsuite:
2014-11-22 Yao Qi <yao@codesourcery.com>
* gdb.trace/entry-values.c: Remove asms.
(foo): Add foo_label.
(bar): Add bar_label.
* gdb.trace/entry-values.exp: Remove code computing foo's
length and bar's length.
(Dwarf::assemble): Invoke function_range for bar and use
MACRO_AT_func for foo.
This patch fixes two fails in dw2-compdir-oldgcc.exp I've seen on arm
target thumb mode.
FAIL: gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc42
FAIL: gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc43
When fill in DW_AT_low_pc, the label should be used rather than the
function, otherwise, the LSB bit of the address in DW_AT_low_pc is
set and the debug info is wrong. This patch is to add two labels for
functions gcc42 and gcc43 respectively, and use them. These two
fails are fixed.
gdb/testsuite:
2014-11-22 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-compdir-oldgcc.S: Define label .Lgcc42_procstart
and .Lgcc43_procstart. Use .Lgcc42_procstart instead of gcc42.
Use .Lgcc43_procstart instead of gcc43.
Consider the following variable declaration:
type Array_Type is array (Integer range <>) of Integer;
Var: Array_Type (0 .. -1);
"ptype var" prints the wrong upper bound for that array:
(gdb) ptype var
type = array (0 .. 4294967295) of integer
The debugging info for the type of variable "Var" is as follow:
<2><cf>: Abbrev Number: 13 (DW_TAG_structure_type)
<d0> DW_AT_name : foo__var___PAD
<3><db>: Abbrev Number: 14 (DW_TAG_member)
<dc> DW_AT_name : F
<e0> DW_AT_type : <0xa5>
This is just an artifact from code generation, which is just
a wrapper that we should ignore. The real type is the type of
field "F" in that PAD type, which is described as:
<2><a5>: Abbrev Number: 10 (DW_TAG_array_type)
<a6> DW_AT_name : foo__TvarS
<3><b6>: Abbrev Number: 11 (DW_TAG_subrange_type)
<b7> DW_AT_type : <0xc1>
<bb> DW_AT_lower_bound : 0
<bc> DW_AT_upper_bound : 0xffffffff
Trouble occurs because DW_AT_upper_bound is encoded using
a DW_FORM_data4, which is ambiguous regarding signedness.
In that case, dwarf2read.c::dwarf2_get_attr_constant_value
reads the value as unsigned, which is not what we want
in this case.
As it happens, we already have code dealing with this situation
in dwarf2read.c::read_subrange_type which checks whether
the subrange's type is signed or not, and if it is, fixes
the bound's value by sign-extending it:
if (high.kind == PROP_CONST
&& !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
high.data.const_val |= negative_mask;
Unfortunately, what happens in our case is that the base type
of the array's subrange type is marked as being unsigned, and
so we never get to apply the sign extension. Following the DWARF
trail, the range's base type is described as another subrange type...
<2><c1>: Abbrev Number: 12 (DW_TAG_subrange_type)
<c7> DW_AT_name : foo__TTvarSP1___XDLU_0__1m
<cb> DW_AT_type : <0x2d>
... whose base type is, (finally), a basic type (signed):
<1><2d>: Abbrev Number: 2 (DW_TAG_base_type)
<2e> DW_AT_byte_size : 4
<2f> DW_AT_encoding : 5 (signed)
<30> DW_AT_name : integer
The reason why GDB thinks that foo__TTvarSP1___XDLU_0__1m
(the base type of the array's range type) is an unsigned type
is found in gdbtypes.c::create_range_type. We consider that
a range type is unsigned iff its lower bound is >= 0:
if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
TYPE_UNSIGNED (result_type) = 1;
That is normally sufficient, as one would expect the upper bound to
always be greater or equal to the lower bound. But Ada actually
allows the declaration of empty range types where the upper bound
is less than the lower bound. In this case, the upper bound is
negative, so we should not be marking the type as unsigned.
This patch fixes the issue by simply checking the upper bound as well
as the lower bound, and clears the range type's unsigned flag when
it is found to be constant and negative.
gdb/ChangeLog:
* gdbtypes.c (create_range_type): Unset RESULT_TYPE's
flag_unsigned if HIGH_BOUND is constant and negative.
gdb/testsuite/ChangeLog:
* gdb.ada/n_arr_bound: New testcase.
Tested on x86_64-linux.
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
Currently "symtabs" in gdb are stored as a single linked list of
struct symtab that contains both symbol symtabs (the blockvectors)
and file symtabs (the linetables).
This has led to confusion, bugs, and performance issues.
This patch is conceptually very simple: split struct symtab into
two pieces: one part containing things common across the entire
compilation unit, and one part containing things specific to each
source file.
Example.
For the case of a program built out of these files:
foo.c
foo1.h
foo2.h
bar.c
foo1.h
bar.h
Today we have a single list of struct symtabs:
objfile -> foo.c -> foo1.h -> foo2.h -> bar.c -> foo1.h -> bar.h -> NULL
where "->" means the "next" pointer in struct symtab.
With this patch, that turns into:
objfile -> foo.c(cu) -> bar.c(cu) -> NULL
| |
v v
foo.c bar.c
| |
v v
foo1.h foo1.h
| |
v v
foo2.h bar.h
| |
v v
NULL NULL
where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects,
and the files foo.c, etc. are struct symtab objects.
So now, for example, when we want to iterate over all blockvectors
we can now just iterate over the compunit_symtab list.
Plus a lot of the data that was either unused or replicated for each
symtab in a compilation unit now lives in struct compunit_symtab.
E.g., the objfile pointer, the producer string, etc.
I thought of moving "language" out of struct symtab but there is
logic to try to compute the language based on previously seen files,
and I think that's best left as is for now.
With my standard monster benchmark with -readnow (which I can't actually
do, but based on my calculations), whereas today the list requires
77MB to store all the struct symtabs, it now only requires 37MB.
A modest space savings given the gigabytes needed for all the debug info,
etc. Still, it's nice. Plus, whereas today we create a copy of dirname
for each source file symtab in a compilation unit, we now only create one
for the compunit.
So this patch is basically just a data structure reorg,
I don't expect significant performance improvements from it.
Notes:
1) A followup patch can do a similar split for struct partial_symtab.
I have left that until after I get the changes I want in to
better utilize .gdb_index (it may affect how we do partial syms).
2) Another followup patch *could* rename struct symtab.
The term "symtab" is ambiguous and has been a source of confusion.
In this patch I'm leaving it alone, calling it the "historical" name
of "filetabs", which is what they are now: just the file-name + line-table.
gdb/ChangeLog:
Split struct symtab into two: struct symtab and compunit_symtab.
* amd64-tdep.c (amd64_skip_xmm_prologue): Fetch producer from compunit.
* block.c (blockvector_for_pc_sect): Change "struct symtab *" argument
to "struct compunit_symtab *". All callers updated.
(set_block_compunit_symtab): Renamed from set_block_symtab. Change
"struct symtab *" argument to "struct compunit_symtab *".
All callers updated.
(get_block_compunit_symtab): Renamed from get_block_symtab. Change
result to "struct compunit_symtab *". All callers updated.
(find_iterator_compunit_symtab): Renamed from find_iterator_symtab.
Change result to "struct compunit_symtab *". All callers updated.
* block.h (struct global_block) <compunit_symtab>: Renamed from symtab.
hange type to "struct compunit_symtab *". All uses updated.
(struct block_iterator) <d.compunit_symtab>: Renamed from "d.symtab".
Change type to "struct compunit_symtab *". All uses updated.
* buildsym.c (struct buildsym_compunit): New struct.
(subfiles, buildsym_compdir, buildsym_objfile, main_subfile): Delete.
(buildsym_compunit): New static global.
(finish_block_internal): Update to fetch objfile from
buildsym_compunit.
(make_blockvector): Delete objfile argument.
(start_subfile): Rewrite to use buildsym_compunit. Don't initialize
debugformat, producer.
(start_buildsym_compunit): New function.
(free_buildsym_compunit): Renamed from free_subfiles_list.
All callers updated.
(patch_subfile_names): Rewrite to use buildsym_compunit.
(get_compunit_symtab): New function.
(get_macro_table): Delete argument comp_dir. All callers updated.
(start_symtab): Change result to "struct compunit_symtab *".
All callers updated. Create the subfile of the main source file.
(watch_main_source_file_lossage): Rewrite to use buildsym_compunit.
(reset_symtab_globals): Update.
(end_symtab_get_static_block): Update to use buildsym_compunit.
(end_symtab_without_blockvector): Rewrite.
(end_symtab_with_blockvector): Change result to
"struct compunit_symtab *". All callers updated.
Update to use buildsym_compunit. Don't set symtab->dirname,
instead set it in the compunit.
Explicitly make sure main symtab is first in its list.
Set debugformat, producer, blockvector, block_line_section, and
macrotable in the compunit.
(end_symtab_from_static_block): Change result to
"struct compunit_symtab *". All callers updated.
(end_symtab, end_expandable_symtab): Ditto.
(set_missing_symtab): Change symtab argument to
"struct compunit_symtab *". All callers updated.
(augment_type_symtab): Ditto.
(record_debugformat): Update to use buildsym_compunit.
(record_producer): Update to use buildsym_compunit.
* buildsym.h (struct subfile) <dirname>: Delete.
<producer, debugformat>: Delete.
<buildsym_compunit>: New member.
(get_compunit_symtab): Declare.
* dwarf2read.c (struct type_unit_group) <compunit_symtab>: Renamed
from primary_symtab. Change type to "struct compunit_symtab *".
All uses updated.
(dwarf2_start_symtab): Change result to "struct compunit_symtab *".
All callers updated.
(dwarf_decode_macros): Delete comp_dir argument. All callers updated.
(struct dwarf2_per_cu_quick_data) <compunit_symtab>: Renamed from
symtab. Change type to "struct compunit_symtab *". All uses updated.
(dw2_instantiate_symtab): Change result to "struct compunit_symtab *".
All callers updated.
(dw2_find_last_source_symtab): Ditto.
(dw2_lookup_symbol): Ditto.
(recursively_find_pc_sect_compunit_symtab): Renamed from
recursively_find_pc_sect_symtab. Change result to
"struct compunit_symtab *". All callers updated.
(dw2_find_pc_sect_compunit_symtab): Renamed from
dw2_find_pc_sect_symtab. Change result to
"struct compunit_symtab *". All callers updated.
(get_compunit_symtab): Renamed from get_symtab. Change result to
"struct compunit_symtab *". All callers updated.
(recursively_compute_inclusions): Change type of immediate_parent
argument to "struct compunit_symtab *". All callers updated.
(compute_compunit_symtab_includes): Renamed from
compute_symtab_includes. All callers updated. Rewrite to compute
includes of compunit_symtabs and not symtabs.
(process_full_comp_unit): Update to work with struct compunit_symtab.
(process_full_type_unit): Ditto.
(dwarf_decode_lines_1): Delete argument comp_dir. All callers updated.
(dwarf_decode_lines): Remove special case handling of main subfile.
(macro_start_file): Delete argument comp_dir. All callers updated.
(dwarf_decode_macro_bytes): Ditto.
* guile/scm-block.c (bkscm_print_block_syms_progress_smob): Update to
use struct compunit_symtab.
* i386-tdep.c (i386_skip_prologue): Fetch producer from compunit.
* jit.c (finalize_symtab): Build compunit_symtab.
* jv-lang.c (get_java_class_symtab): Change result to
"struct compunit_symtab *". All callers updated.
* macroscope.c (sal_macro_scope): Fetch macro table from compunit.
* macrotab.c (struct macro_table) <compunit_symtab>: Renamed from
comp_dir. Change type to "struct compunit_symtab *".
All uses updated.
(new_macro_table): Change comp_dir argument to cust,
"struct compunit_symtab *". All callers updated.
* maint.c (struct cmd_stats) <nr_compunit_symtabs>: Renamed from
nr_primary_symtabs. All uses updated.
(count_symtabs_and_blocks): Update to handle compunits.
(report_command_stats): Update output, "primary symtabs" renamed to
"compunits".
* mdebugread.c (new_symtab): Change result to
"struct compunit_symtab *". All callers updated.
(parse_procedure): Change type of search_symtab argument to
"struct compunit_symtab *". All callers updated.
* objfiles.c (objfile_relocate1): Loop over blockvectors in a
separate loop.
* objfiles.h (struct objfile) <compunit_symtabs>: Renamed from
symtabs. Change type to "struct compunit_symtab *". All uses updated.
(ALL_OBJFILE_FILETABS): Renamed from ALL_OBJFILE_SYMTABS.
All uses updated.
(ALL_OBJFILE_COMPUNITS): Renamed from ALL_OBJFILE_PRIMARY_SYMTABS.
All uses updated.
(ALL_FILETABS): Renamed from ALL_SYMTABS. All uses updated.
(ALL_COMPUNITS): Renamed from ALL_PRIMARY_SYMTABS. All uses updated.
* psympriv.h (struct partial_symtab) <compunit_symtab>: Renamed from
symtab. Change type to "struct compunit_symtab *". All uses updated.
* psymtab.c (psymtab_to_symtab): Change result type to
"struct compunit_symtab *". All callers updated.
(find_pc_sect_compunit_symtab_from_partial): Renamed from
find_pc_sect_symtab_from_partial. Change result type to
"struct compunit_symtab *". All callers updated.
(lookup_symbol_aux_psymtabs): Change result type to
"struct compunit_symtab *". All callers updated.
(find_last_source_symtab_from_partial): Ditto.
* python/py-symtab.c (stpy_get_producer): Fetch producer from compunit.
* source.c (forget_cached_source_info_for_objfile): Fetch debugformat
and macro_table from compunit.
* symfile-debug.c (debug_qf_find_last_source_symtab): Change result
type to "struct compunit_symtab *". All callers updated.
(debug_qf_lookup_symbol): Ditto.
(debug_qf_find_pc_sect_compunit_symtab): Renamed from
debug_qf_find_pc_sect_symtab, change result type to
"struct compunit_symtab *". All callers updated.
* symfile.c (allocate_symtab): Delete objfile argument.
New argument cust.
(allocate_compunit_symtab): New function.
(add_compunit_symtab_to_objfile): New function.
* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
Change result type to "struct compunit_symtab *". All uses updated.
<find_pc_sect_compunit_symtab>: Renamed from find_pc_sect_symtab.
Change result type to "struct compunit_symtab *". All uses updated.
* symmisc.c (print_objfile_statistics): Compute blockvector count in
separate loop.
(dump_symtab_1): Update test for primary source symtab.
(maintenance_info_symtabs): Update to handle compunit symtabs.
(maintenance_check_symtabs): Ditto.
* symtab.c (set_primary_symtab): Delete.
(compunit_primary_filetab): New function.
(compunit_language): New function.
(iterate_over_some_symtabs): Change type of arguments "first",
"after_last" to "struct compunit_symtab *". All callers updated.
Update to loop over symtabs in each compunit.
(error_in_psymtab_expansion): Rename symtab argument to cust,
and change type to "struct compunit_symtab *". All callers updated.
(find_pc_sect_compunit_symtab): Renamed from find_pc_sect_symtab.
Change result type to "struct compunit_symtab *". All callers updated.
(find_pc_compunit_symtab): Renamed from find_pc_symtab.
Change result type to "struct compunit_symtab *". All callers updated.
(find_pc_sect_line): Only loop over symtabs within selected compunit
instead of all symtabs in the objfile.
* symtab.h (struct symtab) <blockvector>: Moved to compunit_symtab.
<compunit_symtab> New member.
<block_line_section>: Moved to compunit_symtab.
<locations_valid>: Ditto.
<epilogue_unwind_valid>: Ditto.
<macro_table>: Ditto.
<dirname>: Ditto.
<debugformat>: Ditto.
<producer>: Ditto.
<objfile>: Ditto.
<call_site_htab>: Ditto.
<includes>: Ditto.
<user>: Ditto.
<primary>: Delete
(SYMTAB_COMPUNIT): New macro.
(SYMTAB_BLOCKVECTOR): Update definition.
(SYMTAB_OBJFILE): Update definition.
(SYMTAB_DIRNAME): Update definition.
(struct compunit_symtab): New type. Common members among all source
symtabs within a compilation unit moved here. All uses updated.
(COMPUNIT_OBJFILE): New macro.
(COMPUNIT_FILETABS): New macro.
(COMPUNIT_DEBUGFORMAT): New macro.
(COMPUNIT_PRODUCER): New macro.
(COMPUNIT_DIRNAME): New macro.
(COMPUNIT_BLOCKVECTOR): New macro.
(COMPUNIT_BLOCK_LINE_SECTION): New macro.
(COMPUNIT_LOCATIONS_VALID): New macro.
(COMPUNIT_EPILOGUE_UNWIND_VALID): New macro.
(COMPUNIT_CALL_SITE_HTAB): New macro.
(COMPUNIT_MACRO_TABLE): New macro.
(ALL_COMPUNIT_FILETABS): New macro.
(compunit_symtab_ptr): New typedef.
(DEF_VEC_P (compunit_symtab_ptr)): New vector type.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Update expected output.
The bp-permanent test case assumes that a NOP is exactly as long as a
software breakpoint. This is not the case for the S390 "nop"
instruction, which is 4 bytes long, while a software breakpoint is
just 2 bytes long. The "nopr" instruction has the right size and can
be used instead.
Without this patch the test case fails on S390 when trying to continue
after SIGTRAP on the permanent breakpoint:
...
Continuing.
Program received signal SIGILL, Illegal instruction.
test () at /home/arnez/src/binutils-gdb/gdb/testsuite/gdb.base/bp-permanent.c:40
40 NOP; /* after permanent bp */
(gdb)
FAIL: gdb.base/bp-permanent.exp: always_inserted=off, sw_watchpoint=0:
basics: stop at permanent breakpoint
With this patch the test case succeeds without any FAILs.
gdb/testsuite/ChangeLog:
* gdb.base/bp-permanent.c (NOP): Define as 2-byte instead of
4-byte instruction on S390.
Consider the following code which declares a variable A2 which
is an array of arrays of integers.
type Array2_First is array (24 .. 26) of Integer;
type Array2_Second is array (1 .. 2) of Array2_First;
A1 : Array1_Second := ((10, 11, 12), (13, 14, 15));
Trying to print the type of that variable currently yields:
(gdb) ptype A2
type = array (1 .. 2, 24 .. 26) of integer
This is not correct, as this is the description of a two-dimension
array, which is different from an array of arrays. The expected
output is:
(gdb) ptype a2
type = array (1 .. 2) of foo_n926_029.array2_first
GDB's struct type currently handles multi-dimension arrays the same
way arrays of arrays, where each dimension is stored as a sub-array.
The ada-valprint module considers that consecutive array layers
are in fact multi-dimension arrays. For array of arrays, a typedef
layer is introduced between the two arrays, creating a break between
each array type.
In our situation, A2 is a described as a typedef of an array type...
.uleb128 0x8 # (DIE (0x125) DW_TAG_variable)
.ascii "a2\0" # DW_AT_name
.long 0xfc # DW_AT_type
.uleb128 0x4 # (DIE (0xfc) DW_TAG_typedef)
.long .LASF5 # DW_AT_name: "foo__array2_second"
.long 0x107 # DW_AT_type
.uleb128 0x5 # (DIE (0x107) DW_TAG_array_type)
.long .LASF5 # DW_AT_name: "foo__array2_second"
.long 0xb4 # DW_AT_type
.uleb128 0x6 # (DIE (0x114) DW_TAG_subrange_type)
.long 0x11b # DW_AT_type
.byte 0x2 # DW_AT_upper_bound
.byte 0 # end of children of DIE 0x107
... whose element type is, as expected, a typedef to the sub-array
type:
.uleb128 0x4 # (DIE (0xb4) DW_TAG_typedef)
.long .LASF4 # DW_AT_name: "foo__array2_first"
.long 0xbf # DW_AT_type
.uleb128 0x9 # (DIE (0xbf) DW_TAG_array_type)
.long .LASF4 # DW_AT_name: "foo__array2_first"
.long 0xd8 # DW_AT_GNAT_descriptive_type
.long 0x1c5 # DW_AT_type
.uleb128 0xa # (DIE (0xd0) DW_TAG_subrange_type)
.long 0xf0 # DW_AT_type
.byte 0x18 # DW_AT_lower_bound
.byte 0x1a # DW_AT_upper_bound
.byte 0 # end of children of DIE 0xbf
The reason why things fails is that, during expression evaluation,
GDB tries to "fix" A1's type. Because the sub-array has a parallel
(descriptive) type (DIE 0xd8), GDB thinks that our array's index
type must be dynamic and therefore needs to be fixed. This in turn
causes the sub-array to be "fixed", which itself results in the
typedef layer to be stripped.
However, looking closer at the parallel type, we see...
.uleb128 0xb # (DIE (0xd8) DW_TAG_structure_type)
.long .LASF8 # DW_AT_name: "foo__array2_first___XA"
[...]
.uleb128 0xc # (DIE (0xe4) DW_TAG_member)
.long .LASF10 # DW_AT_name: "foo__Tarray2_firstD1___XDLU_24__26"
... that all it tells us is that the array bounds are 24 and 26,
which is already correctly provided by the array's DW_TAG_subrange_type
bounds, meaning that this parallel type is just redundant.
Parallel types in general are slowly being removed in favor of
standard DWARF constructs. But in the meantime, this patch kills
two birds with one stone:
1. It recognizes this situation where the XA type is useless,
and saves an unnecessary range-type fixing;
2. It fixes the issue at hand because ignoring the XA type results
in no type fixing being required, which allows the typedef layer
to be preserved.
gdb/ChangeLog:
* ada-lang.c (ada_is_redundant_range_encoding): New function.
(ada_is_redundant_index_type_desc): New function.
(to_fixed_array_type): Ignore parallel XA type if redundant.
gdb/testsuite/ChangeLog:
* gdb.ada/arr_arr: New testcase.
Tested on x86_64-linux.
... when that packed array is part of a discriminated record and
one of the bounds is a discriminant.
Consider the following code:
type FUNNY_CHAR_T is (NUL, ' ', '"', '#', [etc]);
type FUNNY_STR_T is array (POSITIVE range <>) of FUNNY_CHAR_T;
pragma PACK (FUNNY_STR_T);
type FUNNY_STRING_T (SIZE : NATURAL := 1) is
record
STR : FUNNY_STR_T (1 .. SIZE) := (others => '0');
LENGTH : NATURAL := 4;
end record;
TEST: FUNNY_STRING_T(100);
GDB is able to print the value of variable "test" and "test.str".
But not "test.str(1)":
(gdb) p test
$1 = (size => 100, str => (33 'A', nul <repeats 99 times>), length => 1)
(gdb) p test.str
$2 = (33 'A', nul <repeats 99 times>)
(gdb) p test.str(1)
object size is larger than varsize-limit
The problem occurs during the phase where we are trying to resolve
the expression subscript operation. On the one hand of the subscript
operator, we have the result of the evaluation of "test.str", which
is our packed array. We have the following code to handle packed
arrays in particular:
if (ada_is_constrained_packed_array_type
(desc_base_type (value_type (argvec[0]))))
argvec[0] = ada_coerce_to_simple_array (argvec[0]);
This eventually leads to a call to constrained_packed_array_type
to return the "simple array". This function relies on a parallel
___XA type, when available, to determine the bounds. In our case,
we find type...
failure__funny_string_t__T4b___XA"
... which has one field describing the bounds of our array as:
failure__funny_string_t__T3b___XDLU_1__size
The part that interests us is after the ___XD suffix or,
in other words: "LU_1__size". What this means in GNAT encoding
parlance is that the lower bound is 1, and that the upper bound
is the value of "size". "size" is our discriminant in this case.
Normally, we would access the record's discriminant in order to
get the upper bound's value, but we do not have that information,
here. We are in a mode where we are just trying to "fix" the type
without an actual value. This is what the call to to_fixed_range_type
is doing, and because the fix'ing fails, it ends up returning
the ___XDLU type unmodified as our index type.
This shouldn't be a problem, except that the later part of
constrained_packed_array_type then uses that index_type to
determine the array size, via a call to get_discrete_bounds.
The problem is that the upper bound of the ___XDLU type is
dynamic (in the DWARF sense) while get_discrete_bounds implicitly
assumes that the bounds are static, and therefore accesses
them using macros that assume the bounds values are constants:
case TYPE_CODE_RANGE:
*lowp = TYPE_LOW_BOUND (type);
*highp = TYPE_HIGH_BOUND (type);
This therefore returns a bogus value for the upper bound,
leading to an unexpectedly large size for our array, which
later triggers the varsize-limit guard we've seen above.
This patch avoids the problem by adding special handling
of dynamic range types. It also extends the documentation
of the constrained_packed_array_type function to document
what happens in this situation.
gdb/ChangeLog:
* ada-lang.c (constrained_packed_array_type): Set the length
of the return array as if both bounds where zero if that
returned array's index type is dynamic.
gdb/testsuite/ChangeLog:
* gdb.ada/pkd_arr_elem: New Testcase.
Tested on x86_64-linux.
tests.
FAIL: gdb.reverse/consecutive-precsave.exp: reload precord save file
FAIL: gdb.reverse/finish-precsave.exp: reload precord save file
FAIL: gdb.reverse/until-precsave.exp: reload core file
FAIL: gdb.reverse/watch-precsave.exp: reload core file
FAIL: gdb.reverse/step-precsave.exp: reload core file
FAIL: gdb.reverse/break-precsave.exp: reload precord save file
FAIL: gdb.reverse/sigall-precsave.exp: reload precord save file
They happen for two reasons.
- mingw32 does not define SIGTRAP, so upon recording a core file, the
signal information will be missing, which in turn causes GDB to not
display the stopping signal when it loads the same core file. An
earlier message warns about this:
"warning: Signal SIGTRAP does not exist on this system."
- The testcase is crafted in a way that expects a pattern of the
stopping signal message instead of a successful core file read message.
The following patch fixes this by changing the old pattern to a more
reasonable one, while still ignoring the fact that mingw32-based GDB
does not record a SIGTRAP in a core file because it does not define
it.
gdb/testsuite/
2014-11-18 Luis Machado <lgustavo@codesourcery.com>
* gdb.reverse/break-precsave: Expect completion message for
core file reads.
* gdb.reverse/consecutive-precsave.exp: Likewise.
* gdb.reverse/finish-precsave.exp: Likewise.
* gdb.reverse/i386-precsave.exp: Likewise.
* gdb.reverse/machinestate-precsave.exp: Likewise.
* gdb.reverse/sigall-precsave.exp: Likewise.
* gdb.reverse/solib-precsave.exp: Likewise.
* gdb.reverse/step-precsave.exp: Likewise.
* gdb.reverse/until-precsave.exp: Likewise.
* gdb.reverse/watch-precsave.exp: Likewise.
Fix some more C compiler warnings for missing function return types
and implicit function declarations in the GDB testsuite.
gdb/testsuite/ChangeLog:
* gdb.base/bp-permanent.c: Include unistd.h.
* gdb.python/py-framefilter-mi.c (main): Add return type.
* gdb.python/py-framefilter.c (main): Likewise.
* gdb.trace/actions-changed.c (main): Likewise.
Remove literal line numbers from the regexps in mi-until.exp. Add
appropriate eye-catchers to until.c and refer to those instead.
This change fixes the test case after having disturbed the line
numbering with the previous fix for compiler warnings with -std=gnu11.
gdb/testsuite/ChangeLog:
* gdb.mi/until.c: Add eye-catchers.
* gdb.mi/mi-until.exp: Refer to eye-catchers instead of literal
line numbers.
In some .exp files it was missed to remove the references to
eye-catchers like "set breakpoint 9 here" when the non-prototype
function header variants they belonged to were deleted. This patch
cleans this up.
gdb/testsuite/ChangeLog:
* gdb.base/condbreak.exp: Drop references to removed non-prototype
function header variants in break1.c.
* gdb.base/ena-dis-br.exp: Likewise.
* gdb.base/hbreak2.exp: Likewise.
* gdb.reverse/until-precsave.exp: Drop references to removed
non-prototype function header variants in ur1.c.
* gdb.reverse/until-reverse.exp: Likewise.
Dwarf::tu and Dwarf::cu allow selection of units with 64-bit offsets
through an option. When selected, unit size is encoded properly, but
offset to abbreviation unit is still encoded in a 4-byte field. This
patch fixes the problem.
Reproducer:
Dwarf::assemble "blah.s" {
tu {is_64 1 version 4 addr_size 8} 0x1122334455667788 the_type {
type_unit {} { the_type: }
}
cu {is_64 1 version 4 addr_size 8} {
compile_unit {{language @DW_LANG_C}} {}
}
}
gdb/testsuite:
* lib/dwarf.exp (Dwarf::cu, Dwarf::tu): Emit
${_cu_offset_size} bytes abbrev offset.
Basically the problem is that "symtab" is ambiguous.
Is it the primary symtab (where we canonically think of
blockvectors as being stored) or is it for a specific file
(where each file's line table is stored) ?
gdb_disassembly wants the symtab that contains the line table
but is instead getting the primary symtab.
gdb/ChangeLog:
PR symtab/17559
* symtab.c (find_pc_line_symtab): New function.
* symtab.h (find_pc_line_symtab): Declare.
* disasm.c (gdb_disassembly): Call find_pc_line_symtab instead of
find_pc_symtab.
* tui/tui-disasm.c (tui_set_disassem_content): Ditto.
* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Ditto.
* tui/tui-source.c (tui_vertical_source_scroll): Ditto.
* tui/tui-win.c (make_visible_with_new_height): Ditto.
* tui/tui-winsource.c (tui_horizontal_source_scroll): Ditto.
(tui_display_main): Call find_pc_line_symtab instead of find_pc_line.
gdb/testsuite/ChangeLog:
PR symtab/17559
* gdb.base/line-symtabs.exp: New file.
* gdb.base/line-symtabs.c: New file.
* gdb.base/line-symtabs.h: New file.
The patch <https://sourceware.org/ml/gdb-patches/2014-03/msg00202.html>
fixed dw2-ifort-parameter.exp on powerpc64 by adding some labels to
get the start and end address of function func. This should also fix the
fail on thumb mode, however, this style is quite specific to gcc, and
other compiler, such as clang, may not guarantee the order of global
asms and functions. The test fails with clang:
$ make check RUNTESTFLAGS='dw2-ifort-parameter.exp CC_FOR_TARGET=clang'
(gdb) p/x param^M
No symbol "param" in current context.^M
(gdb) FAIL: gdb.dwarf2/dw2-ifort-parameter.exp: p/x param
With this patch applied, dw2-ifort-parameter.exp still passes for gcc
on arm thumb mode and popwerpc64, and it also passes for clang on
x86_linux.
gdb/testsuite:
2014-11-14 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-ifort-parameter.c: Remove inline asm.
(func): Add label func_label.
* gdb.dwarf2/dw2-ifort-parameter.exp (Dwarf::assemble):
Replace low_pc and high_pc with MACRO_AT_range.
Replace name, low_pc and high_pc with MACRO_AT_func.
Hi,
I see the fail in gdb.dwarf2/implptr-optimized-out.exp in thumb mode
(gdb) p p->f^M
No symbol "p" in current context.^M
(gdb) FAIL: gdb.dwarf2/implptr-optimized-out.exp: p p->f
and the crash on powerpc64
(gdb) continue^M
Continuing.^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x7d82100810000828 in ?? ()
The cause of both is that we incorrectly set attribute low_pc, since
main isn't resolved to function start address on these targets.
In this patch, we replace attributes name, low_pc and high_pc with
MACRO_AT_func. The fail on thumb mode is fixed, and crash on
powerpc64 is fixed too.
gdb/testsuite:
2014-11-14 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/implptr-optimized-out.exp (Dwarf::assemble):
Replace name, low_pc and high_pc with MACRO_AT_func.
This patch is to use dwarf::assemble to generate debug information, and
remove implptr-optimized-out.S as a result.
gdb/testsuite:
2014-11-14 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/implptr-optimized-out.exp: Use Dwarf::assemble to
produce debug information.
* gdb.dwarf2/implptr-optimized-out.S: Removed.
On arm-none-eabi target thumb mode, I see the following fail,
p the_int^M
$2 = 99^M
(gdb) FAIL: gdb.dwarf2/dwz.exp: p the_int
and on powerpc64 target, we even can't get function main from object
file,
disassemble main^M
No function contains specified address.^M
(gdb) FAIL: gdb.dwarf2/dwz.exp: disassemble main
This patch is to use MACRO_AT_func attribute to get the main's start
address and end address correctly, and also remove some code dwz.exp
getting main's length. This patch fixes fails on both thumb mode and
powerpc64 target.
PASS: gdb.dwarf2/dwz.exp: p other_int
PASS: gdb.dwarf2/dwz.exp: p the_int
gdb/testsuite:
2014-11-14 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dwz.exp: Remove the code to compile main.c to
object and get function length.
(Dwarf::assemble): Replace name, low_pc and high_pc attributes
with MACRO_AT_func.
(top-level): Replace gdb_compile and clean_restart with
prepare_for_testing.
* gdb.dwarf2/main.c (main): Add label main_label.
This patch addes DW macro attributes MACRO_AT_func and MACRO_AT_range
in dwarf assembler, which emits "DW_AT_low_pc func_start addr" and
"DW_AT_high_pc func_end addr". func_start and func_end are computed
automatically by proc function_range.
These two attributes are pseudo attribute or macro attribute, which
means they are not standard dwarf attribute in dwarf spec. Then can
be substituted or expanded to standard attributes or macro attributes.
See details in the comments to them. Dwarf assembler is extended to
handle them.
Now the attributes name/low_pc/high_pc can be replaced with
MACRO_AT_func like this:
subprogram {
{name main}
{low_pc main_start addr}
{high_pc main_end addr}
}
becomes:
subprogram {
{MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
}
users don't have to worry about the start and end of function main, and
they only need to add a label main_label in main.
gdb/testsuite:
2014-11-14 Yao Qi <yao@codesourcery.com>
* lib/dwarf.exp (function_range): New procedure.
(Dwarf::_handle_macro_at_func): New procedure.
(Dwarf::_handle_macro_at_range): New procedure.
(Dwarf): Handle MACRO_AT_func and MACRO_AT_range.
This patch is to move some code to a new procedure _handle_attribute,
which will be used in my following patches.
gdb/testsuite:
2014-11-14 Yao Qi <yao@codesourcery.com>
* lib/dwarf.exp (_handle_DW_TAG): Move some code to ...
(_handle_attribute): New procedure.
Remove old-style function header variants from sepdebug.c. Eliminate
references to the removed locations "breakpoint 9" and "breakpoint 13"
from sepdebug.exp.
gdb/testsuite/ChangeLog:
* gdb.base/sepdebug.c: Remove #ifdef PROTOTYPES, keep prototyped
variant.
* gdb.base/sepdebug.exp: Drop references to removed code.
Remove old-style function header variants from list0.h and list1.c.
Fill the removed lines with comments or empty lines, such that the
line numbering is undisturbed. Changes to the line numbering would
require heavy adjustments to list.exp, where many line numbers are
hard-coded, as well as a fair amount of knowledge about the source
code in and around certain lines. Thus the dependency on the line
numbering can not be eliminated so easily, and it may not even be a
useful goal for a "list" test case. Another option might be to adjust
the literal line numbers in list.exp, but even that is not as
straightforward as it may seem, since the test case expects certain
source lines to be exactly n lines apart.
gdb/testsuite/ChangeLog:
* gdb.base/list0.h: Remove #ifdef PROTOTYPES, keep prototyped
variant. Preserve original line numbering.
* gdb.base/list1.c: Likewise.
Remove old-style function headers from break.c and break1.c. Adjust
break.exp accordingly; in particular eliminate references to the
removed locations "breakpoint 9, 13, and 16" from break.exp.
gdb/testsuite/ChangeLog:
* gdb.base/break.c: Remove #ifdef PROTOTYPES, keep prototyped
variant.
* gdb.base/break1.c: Likewise.
* gdb.base/break.exp: Drop references to removed code.
The previous patch did not indent perform_all_tests() correctly after
moving the main logic into it, to avoid obscuring the functional
changes. This patch fixes the indentation.
gdb/testsuite/ChangeLog:
* gdb.base/callfuncs.exp (perform_all_tests): Re-indent.
In callfuncs.exp, compile callfuncs.c with and without C function
header prototypes and execute all tests after each compilation.
gdb/testsuite/ChangeLog:
* gdb.base/callfuncs.exp: Remove 'prototypes' variable. Move main
logic into perform_all_tests() and invoke it with and without
function header prototypes.
(do_function_calls): Remove conditional XFAIL for PR 5318.
(rerun_and_prepare): Remove duplicate code.
(perform_all_tests): New. Main logic moved here.