2020-12-24 20:26:20 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
* remote.c (extended_remote_target::attach): Set target async in
|
|
|
|
|
the target-non-stop path too.
|
|
|
|
|
|
Fix attaching in non-stop mode (PR gdb/27055)
Attaching in non-stop mode currently misbehaves, like so:
(gdb) attach 1244450
Attaching to process 1244450
[New LWP 1244453]
[New LWP 1244454]
[New LWP 1244455]
[New LWP 1244456]
[New LWP 1244457]
[New LWP 1244458]
[New LWP 1244459]
[New LWP 1244461]
[New LWP 1244462]
[New LWP 1244463]
No unwaited-for children left.
At this point, GDB's stopped/running thread state is out of sync with
the inferior:
(gdb) info threads
Id Target Id Frame
* 1 LWP 1244450 "attach-non-stop" 0xf1b443bf in ?? ()
2 LWP 1244453 "attach-non-stop" (running)
3 LWP 1244454 "attach-non-stop" (running)
4 LWP 1244455 "attach-non-stop" (running)
5 LWP 1244456 "attach-non-stop" (running)
6 LWP 1244457 "attach-non-stop" (running)
7 LWP 1244458 "attach-non-stop" (running)
8 LWP 1244459 "attach-non-stop" (running)
9 LWP 1244461 "attach-non-stop" (running)
10 LWP 1244462 "attach-non-stop" (running)
11 LWP 1244463 "attach-non-stop" (running)
(gdb)
(gdb) interrupt -a
(gdb)
*nothing*
The problem is that attaching installs an inferior continuation,
called when the target reports the initial attach stop, here, in
inf-loop.c:inferior_event_handler:
/* Do all continuations associated with the whole inferior (not
a particular thread). */
if (inferior_ptid != null_ptid)
do_all_inferior_continuations (0);
However, currently in non-stop mode, inferior_ptid is still null_ptid
when we get here.
If you try to do "set debug infrun 1" to debug the problem, however,
then the attach completes correctly, with GDB reporting a stop for
each thread.
The bug is that we're missing a switch_to_thread/context_switch call
when handling the initial stop, here:
if (stop_soon == STOP_QUIETLY_NO_SIGSTOP
&& (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_STOP
|| ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
|| ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_0))
{
stop_print_frame = true;
stop_waiting (ecs);
ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
return;
}
Note how the STOP_QUIETLY / STOP_QUIETLY_REMOTE case above that does
call context_switch.
And the reason "set debug infrun 1" "fixes" it, is that the debug path
has a switch_to_thread call.
This patch fixes it by moving the main context_switch call earlier.
It also removes the:
if (ecs->ptid != inferior_ptid)
check at the same time because:
#1 - that is half of what context_switch already does
#2 - deprecated_context_hook is only used in Insight, and all it does
is set an int. It won't care if we call it when the current
thread hasn't actually changed.
A testcase exercising this will be added in a following patch.
gdb/ChangeLog:
PR gdb/27055
* infrun.c (handle_signal_stop): Move main context_switch call
earlier, before STOP_QUIETLY_NO_SIGSTOP.
2020-12-23 08:34:54 +08:00
|
|
|
|
2021-02-03 Pedro Alves <pedro@palves.net>
|
|
|
|
|
|
|
|
|
|
PR gdb/27055
|
|
|
|
|
* infrun.c (handle_signal_stop): Move main context_switch call
|
|
|
|
|
earlier, before STOP_QUIETLY_NO_SIGSTOP.
|
|
|
|
|
|
2021-01-07 04:58:04 +08:00
|
|
|
|
2021-02-02 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* NEWS (Changed commands): Add entry for the behavior change of
|
|
|
|
|
the inferior command.
|
|
|
|
|
* inferior.c (inferior_command): When no argument is given to the
|
|
|
|
|
inferior command, display info about the currently selected
|
|
|
|
|
inferior.
|
|
|
|
|
|
2021-02-02 23:40:52 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index, read_rnglist_index): Return
|
|
|
|
|
a sect_offset.
|
|
|
|
|
(read_attribute_reprocess): Adjust.
|
|
|
|
|
|
gdb/dwarf: split dwarf2_cu::ranges_base in two
Consider the test case added in this patch. It defines a compilation
unit with a DW_AT_rnglists_base attribute (used for attributes of form
DW_FORM_rnglistx), but also uses DW_AT_ranges of form
DW_FORM_sec_offset:
0x00000027: DW_TAG_compile_unit
DW_AT_ranges [DW_FORM_sec_offset] (0x0000004c
[0x0000000000005000, 0x0000000000006000))
DW_AT_rnglists_base [DW_FORM_sec_offset] (0x00000044)
The DW_AT_rnglists_base does not play a role in reading the DW_AT_ranges of
form DW_FORM_sec_offset, but it should also not do any harm.
This case is currently not handled correctly by GDB. This is not
something that a compiler is likely to emit, but in my opinion there's
no reason why GDB should fail reading it.
The problem is that in partial_die_info::read and a few other places
where the same logic is replicated, the cu->ranges_base value,
containing the DW_AT_rnglists_base value, is wrongfully added to the
DW_AT_ranges value.
It is quite messy how to decide whether cu->ranges_base should be added
to the attribute's value or not. But to summarize, the only time we
want to add it is when the attribute comes from a pre-DWARF 5 split unit
file (a .dwo) [1]. In this case, the DW_AT_ranges attribute from the
split unit file will have form DW_FORM_sec_offset, pointing somewhere in
the linked file's .debug_ranges section. *But* it's not a "true"
DW_FORM_sec_offset, in that it's an offset relative to the beginning of
that CU's contribution in the section, not relative to the beginning of
the section. So in that case, and only that case, do we want to add the
ranges base value, which we found from the DW_AT_GNU_ranges_base
attribute on the skeleton unit.
Almost all instances of the DW_AT_ranges attribute will be found in the
split unit (on DW_TAG_subprogram, for example), and therefore need to
have the ranges base added. However, the DW_TAG_compile_unit DIE in the
skeleton may also have a DW_AT_ranges attribute. For that one, the
ranges base must not be added. Once the DIEs have been loaded in GDB,
however, the distinction between what's coming from the skeleton and
what's coming from the split unit is not clear. It is all merged in one
big happy tree. So how do we know if a given attribute comes from the
split unit or not?
We use the fact that in pre-DWARF 5 split DWARF, DW_AT_ranges is found
on the skeleton's DW_TAG_compile_unit (in the linked file) and never in
the split unit's DW_TAG_compile_unit. This is why you have this in
partial_die_info::read:
int need_ranges_base = (tag != DW_TAG_compile_unit
&& attr.form != DW_FORM_rnglistx);
However, with the corner case described above (where we have a
DW_AT_rnglists_base attribute and a DW_AT_ranges attribute of form
DW_FORM_sec_offset) the condition gets it wrong when it encounters an
attribute like DW_TAG_subprogram with a DW_AT_ranges attribute of
DW_FORM_sec_offset form: it thinks that it is necessary to add the base,
when it reality it is not.
The problem boils down to failing to differentiate these cases:
- a DW_AT_ranges attribute of form DW_FORM_sec_offset in a
pre-DWARF 5 split unit (in which case we need to add the base)
- a DW_AT_ranges attribute of form DW_FORM_sec_offset in a DWARF 5
non-split unit (in which case we must not add the base)
What makes it unnecessarily complex is that the cu->ranges_base field is
overloaded, used to hold the pre-DWARF 5, non-standard
DW_AT_GNU_ranges_base and the DWARF 5 DW_AT_rnglists_base. In reality,
these two are called "bases" but are not the same thing. The result is
that we need twisted conditions to try to determine whether or not we
should add the base to the attribute's value.
To fix it, split the field in two distinct fields. I renamed everything
related to the "old" ranges base to "gnu_ranges_base", to make it clear
that it's about the non-standard, pre-DWARF 5 thing. And everything
related to the DWARF 5 thing gets renamed "rnglists". I think it
becomes much easier to reason this way.
The issue described above gets fixed by the fact that the
DW_AT_rnglists_base value does not end up in cu->gnu_ranges_base, so
cu->gnu_ranges_base stays 0. The condition to determine whether
gnu_ranges_base should be added can therefore be simplified back to:
tag != DW_TAG_compile_unit
... as it was before rnglistx support was added.
Extend the gdb.dwarf2/rnglists-sec-offset.exp to cover this case. I
also extended the test case for loclists similarly, just to see if there
would be some similar problem. There wasn't, but I think it's not a bad
idea to test that case for loclists as well, so I left it in the patch.
[1] https://gcc.gnu.org/wiki/DebugFission
gdb/ChangeLog:
* dwarf2/die.h (struct die_info) <ranges_base>: Split in...
<gnu_ranges_base>: ... this...
<rnglists_base>: ... and this.
* dwarf2/read.c (struct dwarf2_cu) <ranges_base>: Split in...
<gnu_ranges_base>: ... this...
<rnglists_base>: ... and this.
(read_cutu_die_from_dwo): Adjust
(dwarf2_get_pc_bounds): Adjust
(dwarf2_record_block_ranges): Adjust.
(read_full_die_1): Adjust
(partial_die_info::read): Adjust.
(read_rnglist_index): Adjust.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/rnglists-sec-offset.exp: Add test for DW_AT_ranges
of DW_FORM_sec_offset form plus DW_AT_rnglists_base attribute.
* gdb.dwarf2/loclists-sec-offset.exp: Add test for
DW_AT_location of DW_FORM_sec_offset plus DW_AT_loclists_base
attribute
Change-Id: Icd109038634b75d0e6e9d7d1dcb62fb9eb951d83
2021-02-02 23:41:59 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/die.h (struct die_info) <ranges_base>: Split in...
|
|
|
|
|
<gnu_ranges_base>: ... this...
|
|
|
|
|
<rnglists_base>: ... and this.
|
|
|
|
|
* dwarf2/read.c (struct dwarf2_cu) <ranges_base>: Split in...
|
|
|
|
|
<gnu_ranges_base>: ... this...
|
|
|
|
|
<rnglists_base>: ... and this.
|
|
|
|
|
(read_cutu_die_from_dwo): Adjust
|
|
|
|
|
(dwarf2_get_pc_bounds): Adjust
|
|
|
|
|
(dwarf2_record_block_ranges): Adjust.
|
|
|
|
|
(read_full_die_1): Adjust
|
|
|
|
|
(partial_die_info::read): Adjust.
|
|
|
|
|
(read_rnglist_index): Adjust.
|
|
|
|
|
|
gdb/dwarf: read correct rnglist/loclist header in read_{rng,loc}list_index
When loading the binary from PR 26813 in GDB, we get:
DW_FORM_rnglistx index pointing outside of .debug_rnglists offset array [in module /home/simark/build/binutils-gdb/gdb/MagicPurse]
... and the symbols fail to load.
In read_rnglist_index and read_loclist_index, we read the header
(documented in sections 7.28 and 7.29 of DWARF 5) of the CU's
contribution to the .debug_rnglists / .debug_loclists sections to
validate that the index we want to read makes sense. However, we always
read the header at the beginning of the section, rather than the header
for the contribution from which we want to read the index.
To illustrate, here's what the binary from PR 26813 contains. There are
two compile units:
0x0000000c: DW_TAG_compile_unit 1
DW_AT_ranges [DW_FORM_rnglistx]: 0x0
DW_AT_rnglists_base [DW_FORM_sec_offset]: 0xC
0x00003ec9: DW_TAG_compile_unit 2
DW_AT_ranges [DW_FORM_rnglistx]: 0xB
DW_AT_rnglists_base [DW_FORM_sec_offset]: 0x85
The layout of the .debug_rnglists is the following:
[0x00, 0x0B]: header for CU 1's contribution
[0x0C, 0x0F]: list of offsets for CU 1 (1 element)
[0x10, 0x78]: range lists data for CU 1
[0x79, 0x84]: header for CU 2's contribution
[0x85, 0xB4]: list of offsets for CU 2 (12 elements)
[0xB5, 0xBD7]: range lists data for CU 2
The DW_AT_rnglists_base attrbute points to the beginning of the list of
offsets for that CU, relative to the start of the .debug_rnglists
section. That's right after the header for that contribution.
When we try to read the DW_AT_ranges attribute for CU 2,
read_rnglist_index reads the header for CU 1 instead of the one for CU
2. Since there's only one element in CU 1's offset list, it believes
(wrongfully) that the index 0xB is out of range.
Fix it by reading the header just before where DW_AT_rnglists_base
points to. With this patch, I am able to load GDB built with clang-11
and -gdwarf-5 in itself, with and without -readnow.
gdb/ChangeLog:
PR gdb/26813
* dwarf2/read.c (read_loclists_rnglists_header): Add
header_offset parameter and use it.
(read_loclist_index): Read header of the current contribution,
not the one at the beginning of the section.
(read_rnglist_index): Likewise.
Change-Id: Ie53ff8251af8c1556f0a83a31aa8572044b79e3d
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26813
|
|
|
|
|
* dwarf2/read.c (read_loclists_rnglists_header): Add
|
|
|
|
|
header_offset parameter and use it.
|
|
|
|
|
(read_loclist_index): Read header of the current contribution,
|
|
|
|
|
not the one at the beginning of the section.
|
|
|
|
|
(read_rnglist_index): Likewise.
|
|
|
|
|
|
gdb/dwarf: few fixes for handling DW_FORM_{rng,loc}listx
We hit an assertion when loading the binary from PR 26813. When fixing
it, execution goes a up bit further but then hits another assert, and
another, and another. With these fours fixes, I am able to load the
binary and get to the prompt. An error is shown (index pointing outside
of the section), because the DW_FORM_rnglistx attribute is not read
correctly, but that one is taken care of by the next patch.
The four fixes are:
- attribute::form_requires_reprocessing needs to handle forms
DW_FORM_rnglistx and DW_FORM_loclistx, because set_unsigned_reprocess
is called for them in read_attribute_value.
- read_attribute_reprocess must call set_unsigned for them, not
set_address. The parameter of set_address is a CORE_ADDR, meaning
it's for program addresses. Post-reprocess, DW_FORM_rnglistx and
DW_FORM_loclistx are offsets into their respective sections
(.debug_rnglists and .debug_loclists). set_unsigned is the current
attribute value setter that fits the best. But perhaps we should have
a setter that takes a sect_offset?
- read_attribute_process must call as_unsigned_reprocess instead of
as_unsigned to get the pre-reprocess value, otherwise we hit the
assert inside as_unsigned that makes sure the attribute doesn't need
reprocessing.
- attribute::set_unsigned needs to clear the requires_reprocessing flag,
otherwise it stays set when reprocessing DW_FORM_rnglistx and
DW_FORM_loclistx attributes.
There's another assert that we hit once the next patch is applied, but
since it's in the same vein as the changes in this patch, I included it
in this patch:
- attribute::form_is_unsigned must handle form DW_FORM_loclistx,
otherwise we hit the assert when trying to call set_unsigned for an
attribute of this form. DW_FORM_rnglistx is already handled.
gdb/ChangeLog:
PR gdb/26813
* dwarf2/attribute.h (struct attribute) <set_unsigned>: Clear
requires_reprocessing flag.
* dwarf2/attribute.c (attribute::form_is_unsigned): Handle
DW_FORM_loclistx.
(attribute::form_requires_reprocessing): Handle DW_FORM_rnglistx
and DW_FORM_loclistx.
* dwarf2/read.c (read_attribute_reprocess): Use set_unsigned
instead of set_address for DW_FORM_loclistx and
DW_FORM_rnglistx.
Change-Id: I06c156fa3913ca98e4e39085f4ef171645b4bc1e
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26813
|
|
|
|
|
* dwarf2/attribute.h (struct attribute) <set_unsigned>: Clear
|
|
|
|
|
requires_reprocessing flag.
|
|
|
|
|
* dwarf2/attribute.c (attribute::form_is_unsigned): Handle
|
|
|
|
|
DW_FORM_loclistx.
|
|
|
|
|
(attribute::form_requires_reprocessing): Handle DW_FORM_rnglistx
|
|
|
|
|
and DW_FORM_loclistx.
|
|
|
|
|
* dwarf2/read.c (read_attribute_reprocess): Use set_unsigned
|
|
|
|
|
instead of set_address for DW_FORM_loclistx and
|
|
|
|
|
DW_FORM_rnglistx.
|
|
|
|
|
|
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index): Remove bound check for
|
|
|
|
|
start of offset.
|
|
|
|
|
(read_rnglist_index): Likewise.
|
|
|
|
|
|
2021-02-02 23:40:51 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index): Add bound check for the end
|
|
|
|
|
of the offset.
|
|
|
|
|
|
2021-02-02 23:40:50 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_rnglist_index): Fix bound check.
|
|
|
|
|
|
2021-02-02 23:40:50 +08:00
|
|
|
|
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (read_loclist_index): Change complaints into
|
|
|
|
|
errors.
|
|
|
|
|
|
2021-02-02 15:37:45 +08:00
|
|
|
|
2021-02-02 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR symtab/24620
|
|
|
|
|
* dwarf2/index-write.c (write_one_signatured_type): Skip if
|
|
|
|
|
psymtab == nullptr.
|
|
|
|
|
|
2021-01-19 00:00:38 +08:00
|
|
|
|
2021-02-01 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (HFILES_NO_SRCDIR): Add corefile.h.
|
|
|
|
|
* gcore.c (struct gcore_collect_regset_section_cb_data): Moved
|
|
|
|
|
here from linux-tdep.c and given a new name. Minor cleanups.
|
|
|
|
|
(gcore_collect_regset_section_cb): Likewise.
|
|
|
|
|
(gcore_collect_thread_registers): Likewise.
|
|
|
|
|
(gcore_build_thread_register_notes): Likewise.
|
|
|
|
|
(gcore_find_signalled_thread): Likewise.
|
|
|
|
|
* gcore.h (gcore_build_thread_register_notes): Declare.
|
|
|
|
|
(gcore_find_signalled_thread): Declare.
|
|
|
|
|
* fbsd-tdep.c: Add 'gcore.h' include.
|
|
|
|
|
(struct fbsd_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(fbsd_collect_regset_section_cb): Delete.
|
|
|
|
|
(fbsd_collect_thread_registers): Delete.
|
|
|
|
|
(struct fbsd_corefile_thread_data): Delete.
|
|
|
|
|
(fbsd_corefile_thread): Delete.
|
|
|
|
|
(fbsd_make_corefile_notes): Call
|
|
|
|
|
gcore_build_thread_register_notes instead of the now deleted
|
|
|
|
|
FreeBSD code.
|
|
|
|
|
* linux-tdep.c: Add 'gcore.h' include.
|
|
|
|
|
(struct linux_collect_regset_section_cb_data): Delete.
|
|
|
|
|
(linux_collect_regset_section_cb): Delete.
|
|
|
|
|
(linux_collect_thread_registers): Delete.
|
|
|
|
|
(linux_corefile_thread): Call
|
|
|
|
|
gcore_build_thread_register_notes.
|
|
|
|
|
(find_signalled_thread): Delete.
|
|
|
|
|
(linux_make_corefile_notes): Call gcore_find_signalled_thread.
|
|
|
|
|
|
[gdb/breakpoint] Fix stepping past non-stmt line-table entries
Consider the test-case small.c:
...
$ cat -n small.c
1 __attribute__ ((noinline, noclone))
2 int foo (char *c)
3 {
4 asm volatile ("" : : "r" (c) : "memory");
5 return 1;
6 }
7
8 int main ()
9 {
10 char tpl1[20] = "/tmp/test.XXX";
11 char tpl2[20] = "/tmp/test.XXX";
12 int fd1 = foo (tpl1);
13 int fd2 = foo (tpl2);
14 if (fd1 == -1) {
15 return 1;
16 }
17
18 return 0;
19 }
...
Compiled with gcc-8 and optimization:
...
$ gcc-8 -O2 -g small.c
...
We step through the calls to foo, but fail to visit line 13:
...
12 int fd1 = foo (tpl1);
(gdb) step
foo (c=c@entry=0x7fffffffdea0 "/tmp/test.XXX") at small.c:5
5 return 1;
(gdb) step
foo (c=c@entry=0x7fffffffdec0 "/tmp/test.XXX") at small.c:5
5 return 1;
(gdb) step
main () at small.c:14
14 if (fd1 == -1) {
(gdb)
...
This is caused by the following. The calls to foo are implemented by these
insns:
....
4003df: 0f 29 04 24 movaps %xmm0,(%rsp)
4003e3: 0f 29 44 24 20 movaps %xmm0,0x20(%rsp)
4003e8: e8 03 01 00 00 callq 4004f0 <foo>
4003ed: 48 8d 7c 24 20 lea 0x20(%rsp),%rdi
4003f2: 89 c2 mov %eax,%edx
4003f4: e8 f7 00 00 00 callq 4004f0 <foo>
4003f9: 31 c0 xor %eax,%eax
...
with corresponding line table entries:
...
INDEX LINE ADDRESS IS-STMT
8 12 0x00000000004003df Y
9 10 0x00000000004003df
10 11 0x00000000004003e3
11 12 0x00000000004003e8
12 13 0x00000000004003ed
13 12 0x00000000004003f2
14 13 0x00000000004003f4 Y
15 13 0x00000000004003f4
16 14 0x00000000004003f9 Y
17 14 0x00000000004003f9
...
Once we step out of the call to foo at 4003e8, we land at 4003ed, and gdb
enters process_event_stop_test to figure out what to do.
That entry has is-stmt=n, so it's not the start of a line, so we don't stop
there. However, we do update ecs->event_thread->current_line to line 13,
because the frame has changed (because we stepped out of the function).
Next we land at 4003f2. Again the entry has is-stmt=n, so it's not the start
of a line, so we don't stop there. However, because the frame hasn't changed,
we don't update update ecs->event_thread->current_line, so it stays 13.
Next we land at 4003f4. Now is-stmt=y, so it's the start of a line, and we'd
like to stop here.
But we don't stop because this test fails:
...
if ((ecs->event_thread->suspend.stop_pc == stop_pc_sal.pc)
&& (ecs->event_thread->current_line != stop_pc_sal.line
|| ecs->event_thread->current_symtab != stop_pc_sal.symtab))
{
...
because ecs->event_thread->current_line == 13 and stop_pc_sal.line == 13.
Fix this by resetting ecs->event_thread->current_line to 0 if is-stmt=n and
the frame has changed, such that we have:
...
12 int fd1 = foo (tpl1);
(gdb) step
foo (c=c@entry=0x7fffffffdbc0 "/tmp/test.XXX") at small.c:5
5 return 1;
(gdb) step
main () at small.c:13
13 int fd2 = foo (tpl2);
(gdb)
...
Tested on x86_64-linux, with gcc-7 and gcc-8.
gdb/ChangeLog:
2021-01-29 Tom de Vries <tdevries@suse.de>
PR breakpoints/26063
* infrun.c (process_event_stop_test): Reset
ecs->event_thread->current_line to 0 if is-stmt=n and frame has
changed.
gdb/testsuite/ChangeLog:
2021-01-29 Tom de Vries <tdevries@suse.de>
PR breakpoints/26063
* gdb.dwarf2/dw2-step-out-of-function-no-stmt.c: New test.
* gdb.dwarf2/dw2-step-out-of-function-no-stmt.exp: New file.
2021-01-29 20:36:52 +08:00
|
|
|
|
2021-01-29 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/26063
|
|
|
|
|
* infrun.c (process_event_stop_test): Reset
|
|
|
|
|
ecs->event_thread->current_line to 0 if is-stmt=n and frame has
|
|
|
|
|
changed.
|
|
|
|
|
|
2021-01-28 02:20:35 +08:00
|
|
|
|
2021-01-28 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* thread.c (thr_try_catch_cmd): Replace swith_to_thread with an
|
|
|
|
|
assert. Extend the header comment.
|
|
|
|
|
|
gdb/tui: remove special handling of locator/status window
The locator window, or status window as it is sometimes called is
handled differently to all the other windows.
The reason for this is that the class representing this
window (tui_locator_window) does two jobs, first this class represents
a window just like any other that has space on the screen and fills
the space with content. The second job is that this class serves as a
storage area to hold information about the current location that the
TUI windows represent, so the class has members like 'addr' and
'line_no', for example which are used within this class, and others
when they want to know which line/address the TUI windows should be
showing to the user.
Because of this dual purpose we must always have an instance of the
tui_locator_window so that there is somewhere to store this location
information.
The result of this is that the locator window must never be deleted
like other windows, which results in some special case code.
In this patch I propose splitting the two roles of the
tui_locator_window class. The tui_locator_window class will retain
just its window drawing parts, and will be treated just like any other
window. This should allow all special case code for this window to be
deleted.
The other role, that of tracking the current tui location will be
moved into a new class (tui_location_tracker), of which there will be
a single global instance. All of the places where we previously use
the locator window to get location information will now be updated to
get this from the tui_location_tracker.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* Makefile.in (SUBDIR_TUI_SRCS): Add tui/tui-location.c.
(HFILES_NO_SRCDIR): Add tui/tui-location.h.
* tui/tui-data.h (TUI_STATUS_WIN): Define.
(tui_locator_win_info_ptr): Delete declaration.
* tui/tui-disasm.c: Add 'tui/tui-location.h' include.
(tui_disasm_window::set_contents): Fetch state from tui_location
global.
(tui_get_begin_asm_address): Likewise.
* tui/tui-layout.c (tui_apply_current_layout): Remove special case
for locator window.
(get_locator_window): Delete.
(initialize_known_windows): Treat locator window just like all the
rest.
* tui/tui-source.c: Add 'tui/tui-location.h' include.
(tui_source_window::set_contents): Fetch state from tui_location
global.
(tui_source_window::showing_source_p): Likewise.
* tui/tui-stack.c: Add 'tui/tui-location.h' include.
(_locator): Delete.
(tui_locator_win_info_ptr): Delete.
(tui_locator_window::make_status_line): Fetch state from
tui_location global.
(tui_locator_window::rerender): Remove check of 'handle',
reindent function body.
(tui_locator_window::set_locator_fullname): Delete.
(tui_locator_window::set_locator_info): Delete.
(tui_update_locator_fullname): Delete.
(tui_show_frame_info): Likewise.
(tui_show_locator_content): Access window through TUI_STATUS_WIN.
* tui/tui-stack.h (tui_locator_window::set_locator_info): Moved to
tui/tui-location.h and renamed to
tui_location_tracker::set_location.
(tui_locator_window::set_locator_fullname): Moved to
tui/tui-location.h and renamed to
tui_location_tracker::set_fullname.
(tui_locator_window::full_name): Delete.
(tui_locator_window::proc_name): Delete.
(tui_locator_window::line_no): Delete.
(tui_locator_window::addr): Delete.
(tui_locator_window::gdbarch): Delete.
(tui_update_locator_fullname): Delete declaration.
* tui/tui-wingeneral.c (tui_refresh_all): Removed special handling
for locator window.
* tui/tui-winsource.c: Add 'tui/tui-location.h' include.
(tui_display_main): Call function on tui_location directly.
* tui/tui.h (enum tui_win_type): Add STATUS_WIN.
* tui/tui-location.c: New file.
* tui/tui-location.h: New file.
2021-01-26 02:43:19 +08:00
|
|
|
|
2021-01-28 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (SUBDIR_TUI_SRCS): Add tui/tui-location.c.
|
|
|
|
|
(HFILES_NO_SRCDIR): Add tui/tui-location.h.
|
|
|
|
|
* tui/tui-data.h (TUI_STATUS_WIN): Define.
|
|
|
|
|
(tui_locator_win_info_ptr): Delete declaration.
|
|
|
|
|
* tui/tui-disasm.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(tui_disasm_window::set_contents): Fetch state from tui_location
|
|
|
|
|
global.
|
|
|
|
|
(tui_get_begin_asm_address): Likewise.
|
|
|
|
|
* tui/tui-layout.c (tui_apply_current_layout): Remove special case
|
|
|
|
|
for locator window.
|
|
|
|
|
(get_locator_window): Delete.
|
|
|
|
|
(initialize_known_windows): Treat locator window just like all the
|
|
|
|
|
rest.
|
|
|
|
|
* tui/tui-source.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(tui_source_window::set_contents): Fetch state from tui_location
|
|
|
|
|
global.
|
|
|
|
|
(tui_source_window::showing_source_p): Likewise.
|
|
|
|
|
* tui/tui-stack.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(_locator): Delete.
|
|
|
|
|
(tui_locator_win_info_ptr): Delete.
|
|
|
|
|
(tui_locator_window::make_status_line): Fetch state from
|
|
|
|
|
tui_location global.
|
|
|
|
|
(tui_locator_window::rerender): Remove check of 'handle',
|
|
|
|
|
reindent function body.
|
|
|
|
|
(tui_locator_window::set_locator_fullname): Delete.
|
|
|
|
|
(tui_locator_window::set_locator_info): Delete.
|
|
|
|
|
(tui_update_locator_fullname): Delete.
|
|
|
|
|
(tui_show_frame_info): Likewise.
|
|
|
|
|
(tui_show_locator_content): Access window through TUI_STATUS_WIN.
|
|
|
|
|
* tui/tui-stack.h (tui_locator_window::set_locator_info): Moved to
|
|
|
|
|
tui/tui-location.h and renamed to
|
|
|
|
|
tui_location_tracker::set_location.
|
|
|
|
|
(tui_locator_window::set_locator_fullname): Moved to
|
|
|
|
|
tui/tui-location.h and renamed to
|
|
|
|
|
tui_location_tracker::set_fullname.
|
|
|
|
|
(tui_locator_window::full_name): Delete.
|
|
|
|
|
(tui_locator_window::proc_name): Delete.
|
|
|
|
|
(tui_locator_window::line_no): Delete.
|
|
|
|
|
(tui_locator_window::addr): Delete.
|
|
|
|
|
(tui_locator_window::gdbarch): Delete.
|
|
|
|
|
(tui_update_locator_fullname): Delete declaration.
|
|
|
|
|
* tui/tui-wingeneral.c (tui_refresh_all): Removed special handling
|
|
|
|
|
for locator window.
|
|
|
|
|
* tui/tui-winsource.c: Add 'tui/tui-location.h' include.
|
|
|
|
|
(tui_display_main): Call function on tui_location directly.
|
|
|
|
|
* tui/tui.h (enum tui_win_type): Add STATUS_WIN.
|
|
|
|
|
* tui/tui-location.c: New file.
|
|
|
|
|
* tui/tui-location.h: New file.
|
|
|
|
|
|
2021-01-28 23:12:10 +08:00
|
|
|
|
2021-01-28 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (get_type_arch): Rename to...
|
|
|
|
|
(struct type) <arch>: ... this, update all users.
|
|
|
|
|
|
2021-01-28 23:09:02 +08:00
|
|
|
|
2021-01-28 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (struct type) <arch>: Rename to...
|
|
|
|
|
<arch_owner>: ... this, update all users.
|
|
|
|
|
<objfile>: Rename to...
|
|
|
|
|
<objfile_owner>: ... this, update all users.
|
|
|
|
|
|
2021-01-28 17:58:43 +08:00
|
|
|
|
2021-01-28 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* gdbcmd.h (execute_command_to_string): Update comment.
|
|
|
|
|
* top.c (execute_command_to_string): Update header comment.
|
|
|
|
|
|
[gdb/breakpoints] Fix longjmp master breakpoint with separate debug info
When running test-case gdb.base/longjmp.exp with target board unix/-m32, we
run into:
...
(gdb) next^M
Warning:^M
Cannot insert breakpoint 0.^M
Cannot access memory at address 0x7dbf7353^M
^M
__libc_siglongjmp (env=0x804a040 <env>, val=1) at longjmp.c:28^M
28 longjmps++;^M
(gdb) FAIL: gdb.base/longjmp.exp: next over longjmp(1)
...
The failure to access memory happens in i386_get_longjmp_target and is due to
glibc having pointer encryption (aka "pointer mangling" or "pointer guard") of
the long jump buffer. This is a known problem.
In create_longjmp_master_breakpoint (which attempts to install a master
longjmp breakpoint) a preference scheme is present, which installs a
probe breakpoint if a libc:longjmp probe is present, and otherwise falls back
to setting breakpoints at the names in the longjmp_names array.
But in fact, both the probe breakpoint and the longjmp_names breakpoints are
set. The latter ones are set when processing libc.so.debug, and the former
one when processing libc.so. In other words, this is the longjmp variant of
PR26881, which describes the same problem for master exception breakpoints.
This problem only triggers when the glibc debug info package is installed,
which is not due to the debug info itself in libc.so.debug, but due to the
minimal symbols (because create_longjmp_master_breakpoint uses minimal symbols
to translate the longjmp_names to addresses).
The problem doesn't trigger for -m64, because there tdep->jb_pc_offset is not
set.
Fix this similar to commit 1940319c0ef (the fix for PR26881): only install
longjmp_names breakpoints in libc.so/libc.so.debug if installing the
libc:longjmp probe in libc.so failed.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-01-28 Tom de Vries <tdevries@suse.de>
PR breakpoints/27205
* breakpoint.c (create_longjmp_master_breakpoint_probe)
(create_longjmp_master_breakpoint_names): New function, factored out
of ...
(create_longjmp_master_breakpoint): ... here. Only try to install
longjmp_names breakpoints in libc.so/libc.so.debug if installing probe
breakpoint in libc.so failed.
2021-01-28 17:59:42 +08:00
|
|
|
|
2021-01-28 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/27205
|
|
|
|
|
* breakpoint.c (create_longjmp_master_breakpoint_probe)
|
|
|
|
|
(create_longjmp_master_breakpoint_names): New function, factored out
|
|
|
|
|
of ...
|
|
|
|
|
(create_longjmp_master_breakpoint): ... here. Only try to install
|
|
|
|
|
longjmp_names breakpoints in libc.so/libc.so.debug if installing probe
|
|
|
|
|
breakpoint in libc.so failed.
|
|
|
|
|
|
2021-01-02 04:11:28 +08:00
|
|
|
|
2021-01-27 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/27133
|
|
|
|
|
* cli/cli-interp.c (cli_interp_base::set_logging): Ensure the
|
|
|
|
|
unique_ptr is released when the wrapped pointer is kept for later
|
|
|
|
|
use.
|
|
|
|
|
|
GDB: aarch64: Add ability to displaced step over a BR/BLR instruction
Enable displaced stepping over a BR/BLR instruction
Displaced stepping over an instruction executes a instruction in a
scratch area and then manually fixes up the PC address to leave
execution where it would have been if the instruction were in its
original location.
The BR instruction does not need modification in order to run correctly
at a different address, but the displaced step fixup method should not
manually adjust the PC since the BR instruction sets that value already.
The BLR instruction should also avoid such a fixup, but must also have
the link register modified to point to just after the original code
location rather than back to the scratch location.
This patch adds the above functionality.
We add this functionality by modifying aarch64_displaced_step_others
rather than by adding a new visitor method to aarch64_insn_visitor.
We choose this since it seems that visitor approach is designed
specifically for PC relative instructions (which must always be modified
when executed in a different location).
It seems that the BR and BLR instructions are more like the RET
instruction which is already handled specially in
aarch64_displaced_step_others.
This also means the gdbserver code to relocate an instruction when
creating a fast tracepoint does not need to be modified, since nothing
special is needed for the BR and BLR instructions there.
Regression tests showed nothing untoward on native aarch64 (though it
took a while for me to get the testcase to account for PIE).
------#####
Original observed (mis)behaviour before was that displaced stepping over
a BR or BLR instruction would not execute the function they called.
Most easily seen by putting a breakpoint with a condition on such an
instruction and a print statement in the functions they called.
When run with the breakpoint enabled the function is not called and
"numargs called" is not printed.
When run with the breakpoint disabled the function is called and the
message is printed.
--- GDB Session
~ [15:57:14] % gdb ../using-blr
Reading symbols from ../using-blr...done.
(gdb) disassemble blr_call_value
Dump of assembler code for function blr_call_value:
...
0x0000000000400560 <+28>: blr x2
...
0x00000000004005b8 <+116>: ret
End of assembler dump.
(gdb) break *0x0000000000400560
Breakpoint 1 at 0x400560: file ../using-blr.c, line 22.
(gdb) condition 1 10 == 0
(gdb) run
Starting program: /home/matmal01/using-blr
[Inferior 1 (process 33279) exited with code 012]
(gdb) disable 1
(gdb) run
Starting program: /home/matmal01/using-blr
numargs called
[Inferior 1 (process 33289) exited with code 012]
(gdb)
Test program:
---- using-blr ----
\#include <stdio.h>
typedef int (foo) (int, int);
typedef void (bar) (int, int);
struct sls_testclass {
foo *x;
bar *y;
int left;
int right;
};
__attribute__ ((noinline))
int blr_call_value (struct sls_testclass x)
{
int retval = x.x(x.left, x.right);
if (retval % 10)
return 100;
return 9;
}
__attribute__ ((noinline))
int blr_call (struct sls_testclass x)
{
x.y(x.left, x.right);
if (x.left % 10)
return 100;
return 9;
}
int
numargs (__attribute__ ((unused)) int left, __attribute__ ((unused)) int right)
{
printf("numargs called\n");
return 10;
}
void
altfunc (__attribute__ ((unused)) int left, __attribute__ ((unused)) int right)
{
printf("altfunc called\n");
}
int main(int argc, char **argv)
{
struct sls_testclass x = { .x = numargs, .y = altfunc, .left = 1, .right = 2 };
if (argc > 2)
{
blr_call (x);
}
else
blr_call_value (x);
return 10;
}
2021-01-28 01:09:46 +08:00
|
|
|
|
2021-01-27 Matthew Malcomson <matthew.malcomson@arm.com>
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c (aarch64_displaced_step_others): Account for
|
|
|
|
|
BLR and BR instructions.
|
|
|
|
|
* arch/aarch64-insn.h (enum aarch64_opcodes): Add BR opcode.
|
|
|
|
|
(enum aarch64_masks): New.
|
|
|
|
|
|
2021-01-26 23:49:09 +08:00
|
|
|
|
2021-01-26 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* windows-nat.c (DEBUG_EXEC, DEBUG_EVENTS, DEBUG_MEM)
|
|
|
|
|
(DEBUG_EXCEPT): Use debug_prefixed_printf_cond.
|
|
|
|
|
(windows_init_thread_list, windows_nat::handle_load_dll)
|
|
|
|
|
(windows_nat::handle_unload_dll, windows_nat_target::resume)
|
|
|
|
|
(windows_nat_target::resume)
|
|
|
|
|
(windows_nat_target::get_windows_debug_event)
|
|
|
|
|
(windows_nat_target::interrupt, windows_xfer_memory)
|
|
|
|
|
(windows_nat_target::close): Update.
|
|
|
|
|
* nat/windows-nat.c (DEBUG_EVENTS): Use
|
|
|
|
|
debug_prefixed_printf_cond.
|
|
|
|
|
(matching_pending_stop, fetch_pending_stop)
|
|
|
|
|
(continue_last_debug_event): Update.
|
|
|
|
|
|
2020-12-17 03:36:15 +08:00
|
|
|
|
2020-12-17 Mihails Strasuns <mihails.strasuns@intel.com>
|
|
|
|
|
|
|
|
|
|
* linux-tdep.c (linux_make_mappings_corefile_notes): Start using
|
|
|
|
|
elfcore_write_file_note.
|
|
|
|
|
|
2020-01-15 07:14:24 +08:00
|
|
|
|
2021-01-26 Shahab Vahedi <shahab@synopsys.com>
|
|
|
|
|
|
|
|
|
|
* arc-tdep.c (arc_add_reggroups): New function.
|
|
|
|
|
(arc_gdbarch_init): Call arc_add_reggroups.
|
|
|
|
|
|
2021-01-26 18:00:38 +08:00
|
|
|
|
2021-01-26 Anton Kolesov <anton.kolesov@synopsys.com>
|
2017-06-28 18:15:46 +08:00
|
|
|
|
|
|
|
|
|
* arc-tdep.c (arc_skip_prologue): Log "pc" address.
|
|
|
|
|
|
2021-01-25 23:32:31 +08:00
|
|
|
|
2021-01-25 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
|
|
|
|
Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (partial_die_info::read): Use as_unsigned () for
|
|
|
|
|
DW_AT_ranges.
|
|
|
|
|
|
2021-01-25 23:13:51 +08:00
|
|
|
|
2021-01-25 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (get_mpz): New function.
|
|
|
|
|
(get_dwarf2_rational_constant): Use it.
|
|
|
|
|
|
2021-01-25 22:38:21 +08:00
|
|
|
|
2021-01-25 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (resolve_subexp): Handle array context.
|
|
|
|
|
|
2021-01-24 03:20:11 +08:00
|
|
|
|
2021-01-23 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
PR compile/25575
|
|
|
|
|
* compile/compile-loc2c.c (note_register): New function.
|
|
|
|
|
(pushf_register_address, pushf_register): Use it.
|
|
|
|
|
|
2021-01-24 03:20:11 +08:00
|
|
|
|
2021-01-23 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
|
|
|
|
|
Change type of "registers_used".
|
|
|
|
|
* dwarf2/loc.h (dwarf2_compile_property_to_c): Update.
|
|
|
|
|
* dwarf2/loc.c (dwarf2_compile_property_to_c)
|
|
|
|
|
(locexpr_generate_c_location, loclist_generate_c_location): Change
|
|
|
|
|
type of "registers_used".
|
|
|
|
|
* compile/compile.h (compile_dwarf_expr_to_c)
|
|
|
|
|
(compile_dwarf_bounds_to_c): Update.
|
|
|
|
|
* compile/compile-loc2c.c (pushf_register_address)
|
|
|
|
|
(pushf_register, do_compile_dwarf_expr_to_c)
|
|
|
|
|
(compile_dwarf_expr_to_c, compile_dwarf_bounds_to_c): Change type
|
|
|
|
|
of "registers_used".
|
|
|
|
|
* compile/compile-c.h (generate_c_for_variable_locations):
|
|
|
|
|
Update.
|
|
|
|
|
* compile/compile-c-symbols.c (generate_vla_size)
|
|
|
|
|
(generate_c_for_for_one_variable): Change type of
|
|
|
|
|
"registers_used".
|
|
|
|
|
(generate_c_for_variable_locations): Return std::vector.
|
|
|
|
|
* compile/compile-c-support.c (generate_register_struct): Change
|
|
|
|
|
type of "registers_used".
|
|
|
|
|
(compute): Update.
|
|
|
|
|
|
2021-01-24 08:48:32 +08:00
|
|
|
|
2021-01-23 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* compile/compile-internal.h (class compile_instance)
|
|
|
|
|
<set_arguments>: Change return type.
|
|
|
|
|
* compile/compile.c (compile_to_object): Remove call to reset.
|
|
|
|
|
(compile_instance::set_arguments): Change return type.
|
|
|
|
|
|
gdb: fix regression in copy_type_recursive
Commit 5b7d941b90d1 ("gdb: add owner-related methods to struct type")
introduced a regression when running gdb.base/jit-reader-simple.exp and
others. A NULL pointer dereference happens here:
#3 0x0000557b7e9e8650 in gdbarch_obstack (arch=0x0) at /home/simark/src/binutils-gdb/gdb/gdbarch.c:484
#4 0x0000557b7ea5b138 in copy_type_recursive (objfile=0x614000006640, type=0x62100018da80, copied_types=0x62100018e280) at /home/simark/src/binutils-gdb/gdb/gdbtypes.c:5537
#5 0x0000557b7ea5dcbb in copy_type_recursive (objfile=0x614000006640, type=0x62100018e200, copied_types=0x62100018e280) at /home/simark/src/binutils-gdb/gdb/gdbtypes.c:5598
#6 0x0000557b802cef51 in preserve_one_value (value=0x6110000b3640, objfile=0x614000006640, copied_types=0x62100018e280) at /home/simark/src/binutils-gdb/gdb/value.c:2518
#7 0x0000557b802cf787 in preserve_values (objfile=0x614000006640) at /home/simark/src/binutils-gdb/gdb/value.c:2562
#8 0x0000557b7fbaf19b in reread_symbols () at /home/simark/src/binutils-gdb/gdb/symfile.c:2489
#9 0x0000557b7ec65d1d in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at /home/simark/src/binutils-gdb/gdb/infcmd.c:439
#10 0x0000557b7ec67a97 in run_command (args=0x0, from_tty=1) at /home/simark/src/binutils-gdb/gdb/infcmd.c:546
This is inside a TYPE_ALLOC macro. The fact that gdbarch_obstack is
called means that the type is flagged as being arch-owned, but arch=0x0
means that type::arch returned NULL, probably meaning that the m_owner
field contains NULL.
If we look at the code before the problematic patch, in the
copy_type_recursive function, we see:
if (! TYPE_OBJFILE_OWNED (type))
return type;
...
TYPE_OBJFILE_OWNED (new_type) = 0;
TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
The last two lines were replaced with:
new_type->set_owner (type->arch ());
get_type_arch and type->arch isn't the same thing: get_type_arch gets
the type's arch owner if it is arch-owned, and gets the objfile's arch
if the type is objfile owned. So it always returns non-NULL.
type->arch returns the type's arch if the type is arch-owned, else NULL.
So since the original type is objfile owned, it effectively made the new
type arch-owned (that is good) but set the owner to NULL (that is bad).
Fix this by using get_type_arch again there.
I spotted one other similar change in lookup_array_range_type, in the
original patch. But that one appears to be correct, as it is executed
only if the type is arch-owned.
Add some asserts in type::set_owner to ensure we never set a NULL owner.
That would have helped catch the issue a little bit earlier, so it could
help in the future.
gdb/ChangeLog:
* gdbtypes.c (copy_type_recursive): Use get_type_arch.
* gdbtypes.h (struct type) <set_owner>: Add asserts.
Change-Id: I5d8bc7bfc83b3abc579be0b5aadeae4241179a00
2021-01-24 06:36:55 +08:00
|
|
|
|
2021-01-23 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.c (copy_type_recursive): Use get_type_arch.
|
|
|
|
|
* gdbtypes.h (struct type) <set_owner>: Add asserts.
|
|
|
|
|
|
2021-01-12 06:40:59 +08:00
|
|
|
|
2021-01-23 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* Makefile.in (SELFTESTS_SRCS): Add
|
|
|
|
|
unittests/gdb_tilde_expand-selftests.c.
|
|
|
|
|
* unittests/gdb_tilde_expand-selftests.c: New file.
|
|
|
|
|
|
gdb: add new version style
This commit adds a new 'version' style, which replaces the hard coded
styling currently used for GDB's version string. GDB's version number
is displayed:
1. In the output of 'show version', and
2. When GDB starts up (without the --quiet option).
This new style can only ever affect the first of these two cases as
the second case is printed before GDB has processed any initialization
files, or processed any GDB commands passed on the command line.
However, because the first case exists I think this commit makes
sense, it means the style is no longer hard coded into GDB, and we can
add some tests that the style can be enabled/disabled correctly.
This commit is an alternative to a patch Tom posted here:
https://sourceware.org/pipermail/gdb-patches/2020-June/169820.html
I've used the style name 'version' instead of 'startup' to reflect
what the style is actually used for. If other parts of the startup
text end up being highlighted I imagine they would get their own
styles based on what is being highlighted. I feel this is more inline
with the other style names that are already in use within GDB.
I also decoupled adding this style from the idea of startup options,
and the possibility of auto-saving startup options. Those ideas can
be explored in later patches.
This commit should probably be considered only a partial solution to
issue PR cli/25956. The colours of the style are no longer hard
coded, however, it is still impossible to change the styling of the
version string displayed during startup, so in one sense, the styling
of that string is still "hard coded". A later patch will hopefully
extend GDB to allow it to adjust the version styling before the
initial version string is printed.
gdb/ChangeLog:
PR cli/25956
* cli/cli-style.c: Add 'cli/cli-setshow.h' include.
(version_style): Define.
(cli_style_option::cli_style_option): Add intensity parameter, and
use as appropriate.
(_initialize_cli_style): Register version style set/show commands.
* cli/cli-style.h (cli_style_option): Add intensity parameter.
(version_style): Declare.
* top.c (print_gdb_version): Use version_stype, and styled_string
to print the GDB version string.
gdb/doc/ChangeLog:
PR cli/25956
* gdb.texinfo (Output Styling): Document version style.
gdb/testsuite/ChangeLog:
PR cli/25956
* gdb.base/style.exp (run_style_tests): Add version string test.
(test_startup_version_string): Use version style name.
* lib/gdb-utils.exp (style): Handle version style name.
2021-01-14 04:08:51 +08:00
|
|
|
|
2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
PR cli/25956
|
|
|
|
|
* NEWS: Mention new command.
|
|
|
|
|
* cli/cli-style.c: Add 'cli/cli-setshow.h' include.
|
|
|
|
|
(version_style): Define.
|
|
|
|
|
(cli_style_option::cli_style_option): Add intensity parameter, and
|
|
|
|
|
use as appropriate.
|
|
|
|
|
(_initialize_cli_style): Register version style set/show commands.
|
|
|
|
|
* cli/cli-style.h (cli_style_option): Add intensity parameter.
|
|
|
|
|
(version_style): Declare.
|
|
|
|
|
* top.c (print_gdb_version): Use version_stype, and styled_string
|
|
|
|
|
to print the GDB version string.
|
|
|
|
|
|
gdb: don't print escape characters when a style is disabled
While working on another patch I noticed that if I disable a single
style with, for example:
set style filename background none
set style filename foreground none
set style filename intensity normal
Then in some places escape characters are still injected into the
output stream. This is a bit of an edge case, and I can't think when
this would actually cause problems, but it still felt like a bit of an
annoyance.
One place where this does impact is in testing, where it becomes
harder to write tight test patterns if it is not obvious when GDB will
decide to inject escape sequences.
It's especially annoying because depending on how something is printed
then GDB might, or might not, add escape characters. So this would
not add escape characters if the filename style was disabled:
fprintf_filtered (file, "%ps",
styled_string (file_name_style.style (),
"This is a test"));
But this would add escape characters:
fprintf_styled (file, file_name_style.style (),
"%s", "This is a test");
I tracked this down to some calls to set_output_style in utils.c.
Currently some calls to set_output_style (in utils.c) are guarded like
this:
if (!STYLE.is_default ())
set_output_style (stream, STYLE);
But some calls are not. It is the calls that are NOT guarded that
cause the extra escape sequences to be emitted.
My initial proposal to resolve this issue was simply to ensure that
all calls to set_output_style were guarded. The patch I posted for
this can be found here:
https://sourceware.org/pipermail/gdb-patches/2021-January/175096.html
The feedback on this proposal was that it might be better to guard
against the escape sequences being emitted at a later lever, right
down at emit_style_escape.
So this is what this version does. In emit_style_escape we already
track the currently applied style, so if the style we are being asked
to switch to is the same as the currently applied style then no escape
sequence needs to be emitted.
Making this change immediately exposed some issues in
fputs_maybe_filtered related to line wrapping. The best place to start
to understand what's going on with the styling and wrapping is look at
the test:
gdb.base/style.exp: all styles enabled: frame when width=20
If you run this test and then examine the output in an editor so the
escape sequences can be seen you'll see the duplicate escape sequences
that are emitted before this patch, the compare to after this patch
you'll see the set of escape sequences should be the minimum required.
In order to test these changes I have rewritten the gdb.base/style.exp
test script. The core of the script is now run multiple times. The
first time the test is run things are as they were before, all styles
are on.
After that the test is rerun multiple times. Each time through a
single style is disabled using the 3 explicit set calls listed above.
I then repeat all the tests, however, I arrange so that the patterns
for the disabled style now require no escape sequences.
gdb/ChangeLog:
* utils.c (emit_style_escape): Only emit an escape sequence if the
requested style is different than the current applied style.
(fputs_maybe_filtered): Adjust the juggling of the wrap_style, and
current applied_style.
(fputs_styled): Remove is_default check.
(fputs_styled_unfiltered): Likewise.
(vfprintf_styled_no_gdbfmt): Likewise.
gdb/testsuite/ChangeLog:
* gdb.base/style.exp (limited_style): New proc.
(clean_restart_and_disable): New proc.
(run_style_tests): New proc. Most of the old tests from this file
are now in this proc.
(test_startup_version_string): New proc. Reamining test from the
old file is in this proc.
2021-01-14 04:08:42 +08:00
|
|
|
|
2021-01-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* utils.c (emit_style_escape): Only emit an escape sequence if the
|
|
|
|
|
requested style is different than the current applied style.
|
|
|
|
|
(fputs_maybe_filtered): Adjust the juggling of the wrap_style, and
|
|
|
|
|
current applied_style.
|
|
|
|
|
(fputs_styled): Remove is_default check.
|
|
|
|
|
(fputs_styled_unfiltered): Likewise.
|
|
|
|
|
(vfprintf_styled_no_gdbfmt): Likewise.
|
|
|
|
|
|
gdb: add remote_debug_printf
This is the next in the new-style debug macro series.
For this one, I decided to omit the function name from the "Sending packet" /
"Packet received" kind of prints, just because it's not very useful in that
context and hinders readability more than anything else. This is completely
arbitrary.
This is with:
[remote] putpkt_binary: Sending packet: $qTStatus#49...
[remote] getpkt_or_notif_sane_1: Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
and without:
[remote] Sending packet: $qTStatus#49...
[remote] Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
A difference is that previously, the query packet and its reply would be
printed on the same line, like this:
Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
Now, they are printed on two lines, since each remote_debug_printf{,_nofunc}
prints its own complete message including an end of line. It's probably
a matter of taste, but I prefer the two-line version, it's easier to
follow, especially when the query packet is long.
As a result, lib/range-stepping-support.exp needs to be updated, as it
currently expects the vCont packet and the reply to be on the same line.
I think it's sufficient in that context to just expect the vCont packet
and not the reply, since the goal is just to count how many vCont;r GDB
sends.
gdb/ChangeLog:
* remote.h (remote_debug_printf): New.
(remote_debug_printf_nofunc): New.
(REMOTE_SCOPED_DEBUG_ENTER_EXIT): New.
* remote.c: Use above macros throughout file.
gdbsupport/ChangeLog:
* common-debug.h (debug_prefixed_printf_cond_nofunc): New.
* common-debug.c (debug_prefixed_vprintf): Handle a nullptr
func.
gdb/testsuite/ChangeLog:
* lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
Adjust to "set debug remote" changes.
Change-Id: Ica6dead50d3f82e855c7d763f707cef74bed9fee
2021-01-23 01:43:27 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.h (remote_debug_printf): New.
|
|
|
|
|
(remote_debug_printf_nofunc): New.
|
|
|
|
|
(REMOTE_SCOPED_DEBUG_ENTER_EXIT): New.
|
|
|
|
|
* remote.c: Use above macros throughout file.
|
|
|
|
|
|
2021-01-23 01:40:48 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.h (remote_debug): Change to bool.
|
|
|
|
|
* remote.c (remote_debug): Change to bool.
|
|
|
|
|
(_initialize_remote): Adjust.
|
|
|
|
|
|
2021-01-23 01:39:08 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target.h (remote_debug): Move to...
|
|
|
|
|
* remote.h (remote_debug): ... here.
|
|
|
|
|
* top.c (remote_debug): Move to...
|
|
|
|
|
* remote.c (remote_debug): ... here.
|
|
|
|
|
* remote-sim.c: Include remote.h.
|
|
|
|
|
|
2021-01-23 01:35:54 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* cli/cli-cmds.c (show_remote_debug): Remove.
|
|
|
|
|
(show_remote_timeout): Remove.
|
|
|
|
|
(_initialize_cli_cmds): Don't register commands.
|
|
|
|
|
* remote.c (show_remote_debug): Move here.
|
|
|
|
|
(show_remote_timeout): Move here.
|
|
|
|
|
(_initialize_remote): Register commands.
|
|
|
|
|
|
2021-01-23 01:23:53 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE): Remove, change all users to use the
|
|
|
|
|
type::objfile method instead.
|
|
|
|
|
|
2021-01-23 01:23:40 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE_OWNED): Remove, update all users to
|
|
|
|
|
use the type::is_objfile_owned method.
|
|
|
|
|
|
2021-01-23 01:21:09 +08:00
|
|
|
|
2021-01-22 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* gdbtypes.h (TYPE_OBJFILE_OWNED): Adjust.
|
|
|
|
|
(TYPE_OWNER): Remove.
|
|
|
|
|
(TYPE_OBJFILE): Adjust.
|
|
|
|
|
(struct main_type) <flag_objfile_owned>: Rename to...
|
|
|
|
|
<m_flag_objfile_owned>: ... this.
|
|
|
|
|
<owner>: Rename to...
|
|
|
|
|
<m_owner>: ... this.
|
|
|
|
|
(struct type) <is_objfile_owned, set_owner, objfile, arch>: New
|
|
|
|
|
methods.
|
|
|
|
|
(TYPE_ALLOC): Adjust.
|
|
|
|
|
* gdbtypes.c (alloc_type): Adjust.
|
|
|
|
|
(alloc_type_arch): Adjust.
|
|
|
|
|
(alloc_type_copy): Adjust.
|
|
|
|
|
(get_type_arch): Adjust.
|
|
|
|
|
(smash_type): Adjust.
|
|
|
|
|
(lookup_array_range_type): Adjust.
|
|
|
|
|
(recursive_dump_type): Adjust.
|
|
|
|
|
(copy_type_recursive): Adjust.
|
|
|
|
|
* compile/compile-c-types.c (convert_func): Adjust.
|
|
|
|
|
(convert_type_basic): Adjust.
|
|
|
|
|
* compile/compile-cplus-types.c (compile_cplus_convert_func):
|
|
|
|
|
Adjust.
|
|
|
|
|
* language.c
|
|
|
|
|
(language_arch_info::type_and_symbol::alloc_type_symbol):
|
|
|
|
|
Adjust.
|
|
|
|
|
|
2021-01-21 21:27:12 +08:00
|
|
|
|
2021-01-21 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* coffread.c (enter_linenos): Passing string to complaint.
|
|
|
|
|
* valops.c (value_assign): Make array view.
|
|
|
|
|
|
2021-01-22 03:12:22 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.h (debug_auto_load): Move here.
|
|
|
|
|
(auto_load_debug_printf): New.
|
|
|
|
|
* auto-load.c: Use auto_load_debug_printf.
|
|
|
|
|
(debug_auto_load): Move to header.
|
|
|
|
|
* linux-thread-db.c (try_thread_db_load): Use
|
|
|
|
|
auto_load_debug_printf.
|
|
|
|
|
* main.c (captured_main_1): Likewise.
|
|
|
|
|
|
2021-01-22 03:07:45 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* f-valprint.c (f77_array_offset_tbl): Remove.
|
|
|
|
|
|
2021-01-22 03:05:54 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdb_bfd.c (bfd_cache_debug_printf): New, use throughout file.
|
|
|
|
|
|
gdb: use interruptible_select when connecting to a remote
When GDB is waiting trying to connect to a remote target and it receives
a SIGWINCH (terminal gets resized), the blocking system call gets
interrupted and we abort.
For example, I connect to some port (on which nothing listens):
(gdb) tar rem :1234
... GDB blocks here, resize the terminal ...
:1234: Interrupted system call.
The backtrace where GDB is blocked while waiting for the connection to
establish is:
#0 0x00007fe9db805b7b in select () from /usr/lib/libc.so.6
#1 0x000055f2472e9c42 in gdb_select (n=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7ffe8fafe050) at /home/simark/src/binutils-gdb/gdb/posix-hdep.c:31
#2 0x000055f24759c212 in wait_for_connect (sock=-1, polls=0x7ffe8fafe300) at /home/simark/src/binutils-gdb/gdb/ser-tcp.c:147
#3 0x000055f24759d0e8 in net_open (scb=0x62500015b900, name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/ser-tcp.c:356
#4 0x000055f2475a0395 in serial_open_ops_1 (ops=0x55f24892ca60 <tcp_ops>, open_name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/serial.c:244
#5 0x000055f2475a01d6 in serial_open (name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/serial.c:231
#6 0x000055f2474d5274 in remote_serial_open (name=0x6020000601d8 ":1234") at /home/simark/src/binutils-gdb/gdb/remote.c:5019
#7 0x000055f2474d7025 in remote_target::open_1 (name=0x6020000601d8 ":1234", from_tty=1, extended_p=0) at /home/simark/src/binutils-gdb/gdb/remote.c:5571
#8 0x000055f2474d47d5 in remote_target::open (name=0x6020000601d8 ":1234", from_tty=1) at /home/simark/src/binutils-gdb/gdb/remote.c:4898
#9 0x000055f24776379f in open_target (args=0x6020000601d8 ":1234", from_tty=1, command=0x611000042bc0) at /home/simark/src/binutils-gdb/gdb/target.c:242
Fix that by using interruptible_select in wait_for_connect, instead of
gdb_select. Resizing the terminal now no longer aborts the connection.
It is still possible to interrupt the connection using ctrl-c.
gdb/ChangeLog:
* ser-tcp.c (wait_for_connect): Use interruptible_select instead
of gdb_select.
Change-Id: Ie25577bd1e5699e4847b6b53fdfa10b8c0dc5c89
2021-01-22 03:04:52 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* ser-tcp.c (wait_for_connect): Use interruptible_select instead
|
|
|
|
|
of gdb_select.
|
|
|
|
|
|
2021-01-02 20:51:27 +08:00
|
|
|
|
2021-01-21 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
PR python/19151
|
|
|
|
|
* python/py-breakpoint.c (bppy_get_location): Handle
|
|
|
|
|
bp_hardware_breakpoint.
|
|
|
|
|
(bppy_init): Likewise.
|
|
|
|
|
(gdbpy_breakpoint_created): Likewise.
|
|
|
|
|
|
2021-01-21 22:26:44 +08:00
|
|
|
|
2021-01-21 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arm-tdep.c (arm_debug_printf): Add and use throughout file.
|
|
|
|
|
|
2021-01-21 11:38:20 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* gdb_bfd.c (debug_bfd_cache): Change type to bool.
|
|
|
|
|
(_initialize_gdb_bfd): Adjust.
|
|
|
|
|
|
gdb/dwarf: add assertion in maybe_queue_comp_unit
The symptom that leads to this is the crash described in PR 26828:
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:23478:25: runtime error: member access within null pointer of type 'struct dwarf2_cu'
The line of the crash is the following, in follow_die_offset:
if (target_cu != cu)
target_cu->ancestor = cu; <--- HERE
The line that assign nullptr to `target_cu` is the `per_objfile->get_cu`
call after having called maybe_queue_comp_unit:
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language))
load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
false, cu->language);
target_cu = per_objfile->get_cu (per_cu); <--- HERE
Some background: there is an invariant, documented in
maybe_queue_comp_unit's doc, that if a CU is queued for expansion
(present in dwarf2_per_bfd::queue), then its DIEs are loaded in memory.
"its DIEs are loaded in memory" is a synonym for saying that a dwarf2_cu
object exists for this CU. Yet another way to say it is that
`per_objfile->get_cu (per_cu)` returns something not nullptr for that
CU.
The crash documented in PR 26828 triggers some hard-to-reproduce
sequence that ends up violating the invariant:
- dwarf2_fetch_die_type_sect_off gets called for a DIE in CU A
- The DIE in CU A requires some DIE in CU B
- follow_die_offset calls maybe_queue_comp_unit. maybe_queue_comp_unit
sees CU B is not queued and its DIEs are not loaded, so it enqueues it
and returns 1 to its caller - meaning "the DIEs are not loaded, you
should load them" - prompting follow_die_offset to load the DIEs by
calling load_full_comp_unit
- Note that CU B is enqueued by maybe_queue_comp_unit even if it has
already been expanded. It's a bit useless (and causes trouble, see
next patch), but that's how it works right now.
- Since we entered the dwarf2/read code through
dwarf2_fetch_die_type_sect_off, nothing processes the queue, so we
exit the dwarf2/read code with CU B still lingering in the queue.
- dwarf2_fetch_die_type_sect_off gets called for a DIE in CU A, again
- The DIE in CU A requires some DIE in CU B, again
- This time, maybe_queue_comp_unit sees that CU B is in the queue.
Because of the invariant that if a CU is in the queue, its DIEs are
loaded in the memory, it returns 0 to its caller, meaning "you don't
need to load the DIEs!".
- That happens to be true, so everything is fine for now.
- Time passes, some things call dwarf2_per_objfile::age_comp_units
enough so that CU B's age becomes past the dwarf_max_cache_age
threshold. age_comp_units proceeds to free CU B's DIEs. Remember
that CU B is still lingering in the queue (oops, the invariant just
got violated).
- dwarf2_fetch_die_type_sect_off gets called for a DIE in CU A, again
- The DIE in CU A requires some DIE in CU B, again
- maybe_queue_comp_unit sees that CU B is in the queue, so returns to
its caller "you don't need to load the DIEs!". However, we know at
this point this is false.
- follow_die_offset doesn't load the DIEs and tries to obtain the DIEs for
CU B:
target_cu = per_objfile->get_cu (per_cu);
But since they are not loaded, target_cu is nullptr, and we get the
crash mentioned above a few lines after that.
This patch adds an assertions in maybe_queue_comp_unit to verify the
invariant, to make sure it doesn't return a falsehood to its caller.
The current patch doesn't fix the issue (the next patch does), but it
makes it so we catch the problem earlier and get this assertion failure
instead of a segmentation fault:
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:9100: internal-error:
int maybe_queue_comp_unit(dwarf2_cu*, dwarf2_per_cu_data*, dwarf2_per_objfile*, language):
Assertion `per_objfile->get_cu (per_cu) != nullptr' failed.
gdb/ChangeLog:
PR gdb/26828
* dwarf2/read.c (maybe_queue_comp_unit): Add assertion.
Change-Id: I4e51bd7bd58773f9fadf480179cbc4bae61508fe
2021-01-21 10:04:43 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
PR gdb/26828
|
|
|
|
|
* dwarf2/read.c (maybe_queue_comp_unit): Add assertion.
|
|
|
|
|
|
2021-01-21 09:57:49 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* dwarf2/read.c (follow_die_offset): Add logging.
|
|
|
|
|
(dwarf2_per_objfile::age_comp_units): Add logging.
|
|
|
|
|
|
gdb: make some variables static
I'm trying to enable clang's -Wmissing-variable-declarations warning.
This patch fixes all the obvious spots where we can simply add "static"
(at least, found when building on x86-64 Linux).
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
* aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
aarch64_stub_unwind, aarch64_normal_base, ): Make static.
* arm-linux-tdep.c (arm_prologue_unwind): Make static.
* arm-tdep.c (struct frame_unwind): Make static.
* auto-load.c (auto_load_safe_path_vec): Make static.
* csky-tdep.c (csky_stub_unwind): Make static.
* gdbarch.c (gdbarch_data_registry): Make static.
* gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
* i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
* i386-tdep.c (i386_frame_setup_skip_insns,
i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
Make static.
* infrun.c (observer_mode): Make static.
* linux-nat.c (sigchld_action): Make static.
* linux-thread-db.c (thread_db_list): Make static.
* maint-test-options.c (maintenance_test_options_list):
* mep-tdep.c (mep_csr_registers): Make static.
* mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
(stats): Make static.
* nat/linux-osdata.c (struct osdata_type): Make static.
* ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
* progspace.c (last_program_space_num): Make static.
* python/py-param.c (struct parm_constant): Remove struct type
name.
(parm_constants): Make static.
* python/py-record-btrace.c (btpy_list_methods): Make static.
* python/py-record.c (recpy_gap_type): Make static.
* record.c (record_goto_cmdlist): Make static.
* regcache.c (regcache_descr_handle): Make static.
* registry.h (DEFINE_REGISTRY): Make definition static.
* symmisc.c (std_in, std_out, std_err): Make static.
* top.c (previous_saved_command_line): Make static.
* tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
static.
* unittests/command-def-selftests.c (nr_duplicates,
nr_invalid_prefixcmd, lists): Make static.
* unittests/observable-selftests.c (test_notification): Make
static.
* unittests/optional/assignment/1.cc (counter): Make static.
* unittests/optional/assignment/2.cc (counter): Make static.
* unittests/optional/assignment/3.cc (counter): Make static.
* unittests/optional/assignment/4.cc (counter): Make static.
* unittests/optional/assignment/5.cc (counter): Make static.
* unittests/optional/assignment/6.cc (counter): Make static.
gdbserver/ChangeLog:
* ax.cc (bytecode_address_table): Make static.
* debug.cc (debug_file): Make static.
* linux-low.cc (stopping_threads): Make static.
(step_over_bkpt): Make static.
* linux-x86-low.cc (amd64_emit_ops, i386_emit_ops): Make static.
* tracepoint.cc (stop_tracing_bkpt, flush_trace_buffer_bkpt,
alloced_trace_state_variables, trace_buffer_ctrl,
tracing_start_time, tracing_stop_time, tracing_user_name,
tracing_notes, tracing_stop_note): Make static.
Change-Id: Ic1d8034723b7802502bda23770893be2338ab020
2021-01-21 09:55:05 +08:00
|
|
|
|
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.
|
|
|
|
|
* aarch64-tdep.c (tdesc_aarch64_list, aarch64_prologue_unwind,
|
|
|
|
|
aarch64_stub_unwind, aarch64_normal_base, ): Make static.
|
|
|
|
|
* arm-linux-tdep.c (arm_prologue_unwind): Make static.
|
|
|
|
|
* arm-tdep.c (struct frame_unwind): Make static.
|
|
|
|
|
* auto-load.c (auto_load_safe_path_vec): Make static.
|
|
|
|
|
* csky-tdep.c (csky_stub_unwind): Make static.
|
|
|
|
|
* gdbarch.c (gdbarch_data_registry): Make static.
|
|
|
|
|
* gnu-v2-abi.c (gnu_v2_abi_ops): Make static.
|
|
|
|
|
* i386-netbsd-tdep.c (i386nbsd_mc_reg_offset): Make static.
|
|
|
|
|
* i386-tdep.c (i386_frame_setup_skip_insns,
|
|
|
|
|
i386_tramp_chain_in_reg_insns, i386_tramp_chain_on_stack_insns):
|
|
|
|
|
Make static.
|
|
|
|
|
* infrun.c (observer_mode): Make static.
|
|
|
|
|
* linux-nat.c (sigchld_action): Make static.
|
|
|
|
|
* linux-thread-db.c (thread_db_list): Make static.
|
|
|
|
|
* maint-test-options.c (maintenance_test_options_list):
|
|
|
|
|
* mep-tdep.c (mep_csr_registers): Make static.
|
|
|
|
|
* mi/mi-cmds.c (struct mi_cmd_stats): Remove struct type name.
|
|
|
|
|
(stats): Make static.
|
|
|
|
|
* nat/linux-osdata.c (struct osdata_type): Make static.
|
|
|
|
|
* ppc-netbsd-tdep.c (ppcnbsd_reg_offsets): Make static.
|
|
|
|
|
* progspace.c (last_program_space_num): Make static.
|
|
|
|
|
* python/py-param.c (struct parm_constant): Remove struct type
|
|
|
|
|
name.
|
|
|
|
|
(parm_constants): Make static.
|
|
|
|
|
* python/py-record-btrace.c (btpy_list_methods): Make static.
|
|
|
|
|
* python/py-record.c (recpy_gap_type): Make static.
|
|
|
|
|
* record.c (record_goto_cmdlist): Make static.
|
|
|
|
|
* regcache.c (regcache_descr_handle): Make static.
|
|
|
|
|
* registry.h (DEFINE_REGISTRY): Make definition static.
|
|
|
|
|
* symmisc.c (std_in, std_out, std_err): Make static.
|
|
|
|
|
* top.c (previous_saved_command_line): Make static.
|
|
|
|
|
* tracepoint.c (trace_user, trace_notes, trace_stop_notes): Make
|
|
|
|
|
static.
|
|
|
|
|
* unittests/command-def-selftests.c (nr_duplicates,
|
|
|
|
|
nr_invalid_prefixcmd, lists): Make static.
|
|
|
|
|
* unittests/observable-selftests.c (test_notification): Make
|
|
|
|
|
static.
|
|
|
|
|
* unittests/optional/assignment/1.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/2.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/3.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/4.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/5.cc (counter): Make static.
|
|
|
|
|
* unittests/optional/assignment/6.cc (counter): Make static.
|
|
|
|
|
|
2021-01-21 09:38:57 +08:00
|
|
|
|
2021-01-20 Joel Sherrill <joel@rtems.org>
|
|
|
|
|
|
|
|
|
|
PR gdb/27219
|
|
|
|
|
* remote.c (struct remote_thread_info) <resume_state>: Rename
|
|
|
|
|
to...
|
|
|
|
|
<get_resume_state>: ... this.
|
|
|
|
|
(remote_target::resume): Adjust.
|
|
|
|
|
(remote_target::commit_resume): Adjust.
|
|
|
|
|
(remote_target::select_thread_for_ambiguous_stop_reply): Adjust.
|
|
|
|
|
|
2021-01-03 15:42:52 +08:00
|
|
|
|
2021-01-20 Sergio Durigan Junior <sergiodj@sergiodj.net>
|
|
|
|
|
Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* stap-probe.c (stap_parse_single_operand): Handle '!'
|
|
|
|
|
operator.
|
|
|
|
|
(stap_parse_argument_conditionally): Likewise.
|
|
|
|
|
Skip spaces after processing open-parenthesis sub-expression.
|
|
|
|
|
(stap_parse_argument_1): Skip spaces after call to
|
|
|
|
|
stap_parse_argument_conditionally.
|
|
|
|
|
Handle case when right-side expression is a parenthesized
|
|
|
|
|
sub-expression.
|
|
|
|
|
Skip spaces after call to stap_parse_argument_1.
|
|
|
|
|
|
2021-01-16 03:35:36 +08:00
|
|
|
|
2021-01-19 Lancelot SIX <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* top.h (switch_thru_all_uis): Use DISABLE_COPY_AND_ASSIGN.
|
|
|
|
|
|
trad-frame cleanups
With the new member functions for struct trad_frame_saved_reg, there is no
need to invoke some of the set/get functions anymore. This patch removes
those and adjusts all callers.
Even though the most natural initial state of a saved register value is
UNKNOWN, there are target backends relying on the previous initial state
of REALREG set to a register's own number. I noticed this in at least a
couple targets: aarch64 and riscv.
Because of that, I decided to keep the reset function that sets the set of
register values to REALREG. I can't exercise all the targets to make sure
the initial state change won't break things, hence why it is risky to change
the default.
Validated with --enable-targets=all on aarch64-linux Ubuntu 18.04/20.04.
gdb/ChangeLog
2021-01-19 Luis Machado <luis.machado@linaro.org>
* trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate
memory and save data.
(trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr)
(trad_frame_set_unknown, trad_frame_set_value_bytes)
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
(trad_frame_value_bytes_p): Remove.
(trad_frame_reset_saved_regs): Adjust documentation.
* trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a
constructor and reset the state of the registers.
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
(trad_frame_value_bytes_p, trad_frame_set_value)
(trad_frame_set_realreg, trad_frame_set_addr)
(trad_frame_set_unknown, trad_frame_set_value_bytes): Remove.
(trad_frame_set_reg_realreg): Update to call member function.
(trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise.
(trad_frame_get_prev_register): Likewise.
* aarch64-tdep.c (aarch64_analyze_prologue)
(aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1)
(aarch64_prologue_prev_register): Update to use member functions.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
* arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise.
* arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache)
(arm_make_epilogue_frame_cache): Likewise.
* avr-tdep.c (avr_frame_unwind_cache)
(avr_frame_prev_register): Likewise.
* cris-tdep.c (cris_scan_prologue): Likewise.
* csky-tdep.c (csky_frame_unwind_cache): Likewise.
* frv-tdep.c (frv_analyze_prologue): Likewise.
* hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* mips-tdep.c (set_reg_offset, mips_insn16_frame_cache)
(mips_micro_frame_cache, mips_insn32_frame_cache): Likewise.
(reset_saved_regs): Adjust to set realreg.
* riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to
call member functions.
* rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache)
* s390-tdep.c (s390_prologue_frame_unwind_cache)
(s390_backchain_frame_unwind_cache): Likewise.
* score-tdep.c (score7_analyze_prologue)
(score3_analyze_prologue, score_make_prologue_cache): Likewise.
* sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
* sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
* tilegx-tdep.c (tilegx_analyze_prologue)
(tilegx_frame_cache): Likewise.
* v850-tdep.c (v850_frame_cache): Likewise.
* vax-tdep.c (vax_frame_cache): Likewise.
2021-01-15 02:43:28 +08:00
|
|
|
|
2021-01-19 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* trad-frame.h (trad_frame_saved_reg) <set_value_bytes>: Allocate
|
|
|
|
|
memory and save data.
|
|
|
|
|
(trad_frame_set_value, trad_frame_set_realreg, trad_frame_set_addr)
|
|
|
|
|
(trad_frame_set_unknown, trad_frame_set_value_bytes)
|
|
|
|
|
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
|
|
|
|
|
(trad_frame_value_bytes_p): Remove.
|
|
|
|
|
(trad_frame_reset_saved_regs): Adjust documentation.
|
|
|
|
|
* trad-frame.c (trad_frame_alloc_saved_regs): Initialize via a
|
|
|
|
|
constructor and reset the state of the registers.
|
|
|
|
|
(trad_frame_value_p, trad_frame_addr_p, trad_frame_realreg_p)
|
|
|
|
|
(trad_frame_value_bytes_p, trad_frame_set_value)
|
|
|
|
|
(trad_frame_set_realreg, trad_frame_set_addr)
|
|
|
|
|
(trad_frame_set_unknown, trad_frame_set_value_bytes): Remove.
|
|
|
|
|
(trad_frame_set_reg_realreg): Update to call member function.
|
|
|
|
|
(trad_frame_set_reg_addr, trad_frame_set_reg_value_bytes): Likewise.
|
|
|
|
|
(trad_frame_get_prev_register): Likewise.
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c (aarch64_analyze_prologue)
|
|
|
|
|
(aarch64_analyze_prologue_test, aarch64_make_prologue_cache_1)
|
|
|
|
|
(aarch64_prologue_prev_register): Update to use member functions.
|
|
|
|
|
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
|
|
|
|
|
* alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Likewise.
|
|
|
|
|
* arc-tdep.c (arc_print_frame_cache, arc_make_frame_cache): Likewise.
|
|
|
|
|
* arm-tdep.c (arm_make_prologue_cache, arm_exidx_fill_cache)
|
|
|
|
|
(arm_make_epilogue_frame_cache): Likewise.
|
|
|
|
|
* avr-tdep.c (avr_frame_unwind_cache)
|
|
|
|
|
(avr_frame_prev_register): Likewise.
|
|
|
|
|
* cris-tdep.c (cris_scan_prologue): Likewise.
|
|
|
|
|
* csky-tdep.c (csky_frame_unwind_cache): Likewise.
|
|
|
|
|
* frv-tdep.c (frv_analyze_prologue): Likewise.
|
|
|
|
|
* hppa-tdep.c (hppa_frame_cache, hppa_fallback_frame_cache): Likewise.
|
|
|
|
|
* lm32-tdep.c (lm32_frame_cache): Likewise.
|
|
|
|
|
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
|
|
|
|
|
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
|
|
|
|
|
* mips-tdep.c (set_reg_offset, mips_insn16_frame_cache)
|
|
|
|
|
(mips_micro_frame_cache, mips_insn32_frame_cache): Likewise.
|
|
|
|
|
(reset_saved_regs): Adjust to set realreg.
|
|
|
|
|
* riscv-tdep.c (riscv_scan_prologue, riscv_frame_cache): Adjust to
|
|
|
|
|
call member functions.
|
|
|
|
|
* rs6000-tdep.c (rs6000_frame_cache, rs6000_epilogue_frame_cache)
|
|
|
|
|
* s390-tdep.c (s390_prologue_frame_unwind_cache)
|
|
|
|
|
(s390_backchain_frame_unwind_cache): Likewise.
|
|
|
|
|
* score-tdep.c (score7_analyze_prologue)
|
|
|
|
|
(score3_analyze_prologue, score_make_prologue_cache): Likewise.
|
|
|
|
|
* sparc-netbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
|
|
|
|
|
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* sparc64-netbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
|
|
|
|
|
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* tilegx-tdep.c (tilegx_analyze_prologue)
|
|
|
|
|
(tilegx_frame_cache): Likewise.
|
|
|
|
|
* v850-tdep.c (v850_frame_cache): Likewise.
|
|
|
|
|
* vax-tdep.c (vax_frame_cache): Likewise.
|
|
|
|
|
|
2021-01-16 00:16:04 +08:00
|
|
|
|
2021-01-19 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* frame.h (get_frame_register_bytes): Pass a gdb::array_view instead
|
|
|
|
|
of buffer + length.
|
|
|
|
|
(put_frame_register_bytes): Likewise.
|
|
|
|
|
Adjust documentation.
|
|
|
|
|
(get_frame_memory): Pass a gdb::array_view instead of buffer + length.
|
|
|
|
|
(safe_frame_unwind_memory): Likewise.
|
|
|
|
|
* frame.c (get_frame_register_bytes, put_frame_register_bytes)
|
|
|
|
|
(get_frame_memory, safe_frame_unwind_memory): Adjust to use
|
|
|
|
|
gdb::array_view.
|
|
|
|
|
* amd64-fbsd-tdep.c (amd64fbsd_sigtramp_p): Likewise.
|
|
|
|
|
* amd64-linux-tdep.c (amd64_linux_sigtramp_start): Likewise.
|
|
|
|
|
* amd64-obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
|
|
|
|
|
* arc-linux-tdep.c (arc_linux_is_sigtramp): Likewise.
|
|
|
|
|
* cris-tdep.c (cris_sigtramp_start, cris_rt_sigtramp_start): Likewise.
|
|
|
|
|
* dwarf2/loc.c (rw_pieced_value): Likewise.
|
|
|
|
|
* hppa-tdep.c (hppa_frame_cache): Likewise.
|
|
|
|
|
* i386-fbsd-tdep.c (i386fbsd_sigtramp_p): Likewise.
|
|
|
|
|
* i386-gnu-tdep.c (i386_gnu_sigtramp_start): Likewise.
|
|
|
|
|
* i386-linux-tdep.c (i386_linux_sigtramp_start)
|
|
|
|
|
(i386_linux_rt_sigtramp_start): Likewise.
|
|
|
|
|
* i386-obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
|
|
|
|
|
* i386-tdep.c (i386_register_to_value): Likewise.
|
|
|
|
|
* i387-tdep.c (i387_register_to_value): Likewise.
|
|
|
|
|
* ia64-tdep.c (ia64_register_to_value): Likewise.
|
|
|
|
|
* m32r-linux-tdep.c (m32r_linux_sigtramp_start)
|
|
|
|
|
(m32r_linux_rt_sigtramp_start): Likewise.
|
|
|
|
|
* m68k-linux-tdep.c (m68k_linux_pc_in_sigtramp): Likewise.
|
|
|
|
|
* m68k-tdep.c (m68k_register_to_value): Likewise.
|
|
|
|
|
* mips-tdep.c (mips_register_to_value)
|
|
|
|
|
(mips_value_to_register): Likewise.
|
|
|
|
|
* ppc-fbsd-tdep.c (ppcfbsd_sigtramp_frame_sniffer)
|
|
|
|
|
(ppcfbsd_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* ppc-obsd-tdep.c (ppcobsd_sigtramp_frame_sniffer)
|
|
|
|
|
(ppcobsd_sigtramp_frame_cache): Likewise.
|
|
|
|
|
* rs6000-tdep.c (rs6000_in_function_epilogue_frame_p)
|
|
|
|
|
(rs6000_register_to_value): Likewise.
|
|
|
|
|
* tilegx-tdep.c (tilegx_analyze_prologue): Likewise.
|
|
|
|
|
* tramp-frame.c (tramp_frame_start): Likewise.
|
|
|
|
|
* valops.c (value_assign): Likewise.
|
|
|
|
|
|
2020-12-24 03:06:11 +08:00
|
|
|
|
2021-01-19 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
* aarch64-linux-tdep.c (aarch64_linux_restore_vreg): Pass in an
|
|
|
|
|
array_view.
|
|
|
|
|
* trad-frame.c (trad_frame_set_value_bytes): Use gdb::array_view
|
|
|
|
|
instead of buffer and size.
|
|
|
|
|
(trad_frame_set_reg_value_bytes): Likewise.
|
|
|
|
|
* trad-frame.h (trad_frame_set_reg_value_bytes): Likewise.
|
|
|
|
|
(trad_frame_set_value_bytes): Likewise.
|
|
|
|
|
|
2021-01-19 10:28:20 +08:00
|
|
|
|
2021-01-18 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* copyright.py (NOT_FSF_LIST): Delete sim/testsuite/sim/bfin/s21.s.
|
|
|
|
|
|
2020-12-02 23:10:06 +08:00
|
|
|
|
2021-01-18 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* riscv-fbsd-tdep.c (riscv_fbsd_supply_gregset): Delete.
|
|
|
|
|
(riscv_fbsd_gregset): Use riscv_supply_regset.
|
|
|
|
|
(riscv_fbsd_fpregset): Likewise.
|
|
|
|
|
* riscv-linux-tdep.c (riscv_linux_gregset): Likewise.
|
|
|
|
|
(riscv_linux_fregset): Likewise.
|
|
|
|
|
* riscv-tdep.c (riscv_supply_regset): Define new function.
|
|
|
|
|
* riscv-tdep.h (riscv_supply_regset): Declare new function.
|
|
|
|
|
|
[gdb/tdep] Handle si_addr_bnd in compat_siginfo_from_siginfo
When running test-case gdb.arch/i386-mpx-sigsegv.exp with target board
unix/-m32, we run into:
...
(gdb) continue^M
Continuing.^M
Saw a #BR! status 1 at 0x8048c2d^M
^M
Program received signal SIGSEGV, Segmentation fault^M
Upper bound violation while accessing address 0x0804c15c^M
Bounds: [lower = 0x00000000, upper = 0x00000000].^M
0x08048a4f in lower (p=0x804c160, a=0x804c180, b=0x804c1a0, c=0x804c1c0, \
d=0x804c1e0, len=1) at i386-mpx-sigsegv.c:79^M
79 value = *(p - len);^M
(gdb) FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
...
The problem is that lower and upper in the Bounds message are 0x0, which is
caused by $_siginfo._sifields._sigfault._addr_bnd.{_lower,_upper} evaluating
to 0x0.
Fix this by copying the si_lower/si_upper fields in
compat_siginfo_from_siginfo.
Tested on x86_64-linux, with target board unix/-m32.
gdb/ChangeLog:
2021-01-18 Tom de Vries <tdevries@suse.de>
PR tdep/27172
* nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper, SEGV_BNDERR):
New macro.
(compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
for SEGV_BNDERR.
2021-01-18 16:32:38 +08:00
|
|
|
|
2021-01-18 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR tdep/27172
|
|
|
|
|
* nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper, SEGV_BNDERR):
|
|
|
|
|
New macro.
|
|
|
|
|
(compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
|
|
|
|
|
for SEGV_BNDERR.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (class remote_target) <remote_hostio_send_command,
|
|
|
|
|
remote_hostio_parse_result>: Constify parameter.
|
|
|
|
|
(remote_hostio_parse_result): Likewise.
|
|
|
|
|
(remote_target::remote_hostio_send_command): Adjust.
|
|
|
|
|
(remote_target::remote_hostio_pread_vFile): Adjust.
|
|
|
|
|
(remote_target::fileio_readlink): Adjust.
|
|
|
|
|
(remote_target::fileio_fstat): Adjust.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (remote_target::start_remote): Move wait_status to
|
|
|
|
|
narrower scope.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (class remote_target):
|
|
|
|
|
<add_current_inferior_and_thread>: Constify parameter.
|
|
|
|
|
(stop_reply_extract_thread): Likewise.
|
|
|
|
|
(remote_target::get_current_thread): Likewise.
|
|
|
|
|
(remote_target::add_current_inferior_and_thread): Likewise.
|
|
|
|
|
|
2021-01-18 13:46:13 +08:00
|
|
|
|
2021-01-18 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* remote.c (class remote_target)
|
|
|
|
|
<remote_unpack_thread_info_response,
|
|
|
|
|
parse_threadlist_response>: Constify parameter and/or return
|
|
|
|
|
value and or local variable.
|
|
|
|
|
(stub_unpack_int): Likewise.
|
|
|
|
|
(unpack_nibble): Likewise.
|
|
|
|
|
(unpack_byte): Likewise.
|
|
|
|
|
(unpack_int): Likewise.
|
|
|
|
|
(unpack_string): Likewise.
|
|
|
|
|
(unpack_threadid): Likewise.
|
|
|
|
|
(remote_target::remote_unpack_thread_info_response): Likewise.
|
|
|
|
|
(remote_target::parse_threadlist_response): Likewise.
|
|
|
|
|
|
2021-01-16 04:21:04 +08:00
|
|
|
|
2021-01-15 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* tui/tui.c (tui_is_window_visible): Compare to nullptr, not 0.
|
|
|
|
|
|
2021-01-15 06:52:00 +08:00
|
|
|
|
2021-01-14 Lancelot Six <lsix@lancelotsix.com>
|
|
|
|
|
|
|
|
|
|
* MAINTAINERS (Write After Approval): Add myself.
|
|
|
|
|
|
2021-01-05 04:40:41 +08:00
|
|
|
|
2021-01-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
|
|
|
|
|
|
|
|
|
* trad-frame.c (trad_frame_alloc_saved_regs): Avoid compile-error
|
|
|
|
|
because is_trivially_default_constructible was first implemented with
|
|
|
|
|
gcc-5.
|
|
|
|
|
|
[gdb/breakpoint] Handle .plt.sec in in_plt_section
Consider the following test-case small.c:
...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void) {
int *p = (int *)malloc (sizeof(int) * 4);
memset (p, 0, sizeof(p));
printf ("p[0] = %d; p[3] = %d\n", p[0], p[3]);
return 0;
}
...
On Ubuntu 20.04, we get:
...
$ gcc -O0 -g small.c
$ gdb -batch a.out -ex start -ex step
Temporary breakpoint 1, main () at small.c:6
6 int *p = (int *) malloc(sizeof(int) * 4);
p[0] = 0; p[3] = 0
[Inferior 1 (process $dec) exited normally]
...
but after switching off the on-by-default fcf-protection, we get the desired
behaviour:
...
$ gcc -O0 -g small.c -fcf-protection=none
$ gdb -batch a.out -ex start -ex step
Temporary breakpoint 1, main () at small.c:6
6 int *p = (int *) malloc(sizeof(int) * 4);
7 memset (p, 0, sizeof(p));
...
Using "set debug infrun 1", the first observable difference between the two
debug sessions is that with -fcf-protection=none we get:
...
[infrun] process_event_stop_test: stepped into dynsym resolve code
...
In this case, "in_solib_dynsym_resolve_code (malloc@plt)" returns true because
"in_plt_section (malloc@plt)" returns true.
With -fcf-protection=full, "in_solib_dynsym_resolve_code (malloc@plt)" returns
false because "in_plt_section (malloc@plt)" returns false, because the section
name for malloc@plt is .plt.sec instead of .plt, which is not handled in
in_plt_section:
...
static inline int
in_plt_section (CORE_ADDR pc)
{
return pc_in_section (pc, ".plt");
}
...
Fix this by handling .plt.sec in in_plt_section.
Tested on x86_64-linux.
[ Another requirement to be able to reproduce this is to have a dynamic linker
with a "malloc" minimal symbol, which causes find_solib_trampoline_target to
find it, such that skip_language_trampoline returns the address for the
dynamic linkers malloc. This causes the step machinery to set a breakpoint
there, and to continue, expecting to hit it. Obviously, we execute glibc's
malloc instead, so the breakpoint is not hit and we continue to program
completion. ]
gdb/ChangeLog:
2021-01-14 Tom de Vries <tdevries@suse.de>
PR breakpoints/27151
* objfiles.h (in_plt_section): Handle .plt.sec.
2021-01-14 17:35:34 +08:00
|
|
|
|
2021-01-14 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR breakpoints/27151
|
|
|
|
|
* objfiles.h (in_plt_section): Handle .plt.sec.
|
|
|
|
|
|
gdb: better handling of 'S' packets
This commit builds on work started in the following two commits:
commit 24ed6739b699f329c2c45aedee5f8c7d2f54e493
Date: Thu Jan 30 14:35:40 2020 +0000
gdb/remote: Restore support for 'S' stop reply packet
commit cada5fc921e39a1945c422eea055c8b326d8d353
Date: Wed Mar 11 12:30:13 2020 +0000
gdb: Handle W and X remote packets without giving a warning
This is related to how GDB handles remote targets that send back 'S'
packets.
In the first of the above commits we fixed GDB's ability to handle a
single process, single threaded target that sends back 'S' packets.
Although the 'T' packet would always be preferred to 'S' these days,
there's nothing really wrong with 'S' for this situation.
The second commit above fixed an oversight in the first commit, a
single-process, multi-threaded target can send back a process wide
event, for example the process exited event 'W' without including a
process-id, this also is fine as there is no ambiguity in this case.
In PR gdb/26819 we run into yet another problem with the above
commits. In this case we have a single process with two threads, GDB
hits a breakpoint in thread 2 and then performs a stepi:
(gdb) b main
Breakpoint 1 at 0x1212340830: file infinite_loop.S, line 10.
(gdb) c
Continuing.
Thread 2 hit Breakpoint 1, main () at infinite_loop.S:10
10 in infinite_loop.S
(gdb) set debug remote 1
(gdb) stepi
Sending packet: $vCont;s:2#24...Packet received: S05
../binutils-gdb/gdb/infrun.c:5807: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
What happens in this case is that on the RISC-V target displaced
stepping is not supported, so when the stepi is issued GDB steps just
thread 2. As only a single thread was set running the target decides
that is can get away with sending back an 'S' packet without a
thread-id. GDB then associates the stop with thread 1 (the first
non-exited thread), but as thread 1 was not previously set executing
the assertion seen above triggers.
As an aside I am surprised that the target sends pack 'S' in this
situation. The target is happy to send back 'T' (including thread-id)
when multiple threads are set running, so (to me) it would seem easier
to just always use the 'T' packet when multiple threads are in use.
However, the target only uses 'T' when multiple threads are actually
executing, otherwise an 'S' packet it used.
Still, when looking at the above situation we can see that GDB should
be able to understand which thread the 'S' reply is referring too.
The problem is that is that in commit 24ed6739b699 (above) when a stop
reply comes in with no thread-id we look for the first non-exited
thread and select that as the thread the stop applies too.
What we should really do is select the first non-exited, resumed thread,
and associate the stop event with this thread. In the above example
both thread 1 and 2 are non-exited, but only thread 2 is resumed, so
this is what we should use.
There's a test for this issue included which works with stock
gdbserver by disabling use of the 'T' packet, and enabling
'scheduler-locking' within GDB so only one thread is set running.
gdb/ChangeLog:
PR gdb/26819
* remote.c
(remote_target::select_thread_for_ambiguous_stop_reply): New
member function.
(remote_target::process_stop_reply): Call
select_thread_for_ambiguous_stop_reply.
gdb/testsuite/ChangeLog:
PR gdb/26819
* gdb.server/stop-reply-no-thread-multi.c: New file.
* gdb.server/stop-reply-no-thread-multi.exp: New file.
Change-Id: I9b49d76c2a99063dcc76203fa0f5270a72825d15
2021-01-14 09:26:58 +08:00
|
|
|
|
2021-01-13 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
PR gdb/26819
|
|
|
|
|
* remote.c
|
|
|
|
|
(remote_target::select_thread_for_ambiguous_stop_reply): New
|
|
|
|
|
member function.
|
|
|
|
|
(remote_target::process_stop_reply): Call
|
|
|
|
|
select_thread_for_ambiguous_stop_reply.
|
|
|
|
|
|
2021-01-14 09:25:58 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* record-btrace.c (class record_btrace_target): Remove.
|
|
|
|
|
(record_btrace_target::commit_resume): Remove.
|
|
|
|
|
* record-full.c (class record_full_target): Remove.
|
|
|
|
|
(record_full_target::commit_resume): Remove.
|
|
|
|
|
|
gdb: make the remote target track its own thread resume state
The next patch moves the target commit_resume method to be a
process_stratum_target-only method. The only non-process targets that
currently implement the commit_resume method are the btrace and full
record targets. The only reason they need to do so is to prevent a
commit resume from reaching the beneath (process) target if they are
currently replaying.
This is important if a record target is used on top of the remote target
(the only process target implementing the commit_resume method).
Currently, the remote target checks the `thread_info::executing` flag of
a thread to know if it should commit resume that thread:
if (!tp->executing || remote_thr->vcont_resumed)
continue;
The `tp->executing` flag is set by infrun when it has asked the target
stack to resume the thread, and therefore if the thread is executing,
from its point of view. It _not_ equivalent to whether the remote
target was asked to resume this thread.
Indeed, if infrun asks the target stack to resume some thread while the
record target is replaying, the record target won't forward the resume
request the remote target beneath, because we don't actually want to
resume the thread on the execution target. But the `tp->executing` flag
is still set, because from the point of view of infrun, the thread
executes. So, if the commit_resume call wasn't intercepted by the
record target as it is today and did reach the remote target, the remote
target would say "Oh, this thread should be executing and I haven't
vCont-resumed it! I must vCont-resume it!". But that would be wrong,
because it was never asked to resume this thread, the resume request did
not reach it. This is why the record targets currently need to
implement commit_resume: to prevent the beneath target from
commit_resuming threads it wasn't asked to resume.
Since commit_resume will become a method on process_stratum_target in
the following patch, record targets won't have a chance to intercept the
calls and that would result in the remote target commit_resuming threads
it shouldn't. To avoid this, this patch makes the remote target track
its own thread resumption state. That means, tracking which threads it
was asked to resume via target_ops::resume. Regardless of the context
of this patch, I think this change makes it easier to understand how
resume / commit_resume works in the remote target. It makes the target
more self-contained, as it only depends on what it gets asked to do via
the target methods, and not on tp->executing, which is a flag maintained
from the point of view of infrun.
I initially made it so this state was only used when the remote target
operates in non-stop mode, since commit_resume is only used when the
target is non-stop. However, it's more consistent and it can be useful
to maintain this state even in all-stop too. In all-stop, receiving a
stop notification for one thread means all threads of the target are
considered stopped.
From the point of view of the remote target, there are three states a
thread can be in:
1. not resumed
2. resumed but pending vCont-resume
3. resumed
State 2 only exists when the target is non-stop.
As of this patch, valid state transitions are:
- 1 -> 2 (through the target resume method if in non-stop)
- 2 -> 3 (through the target commit_resume method if in non-stop)
- 1 -> 3 (through the target resume method if in all-stop)
- 3 -> 1 (through a remote stop notification / reporting an event to the
event loop)
A subsequent patch will make it possible to go from 2 to 1, in case
infrun asks to stop a thread that was resumed but not commit-resumed
yet. I don't think it can happen as of now.
In terms of code, this patch replaces the vcont_resumed field with an
enumeration that explicitly represents the three states described above.
The last_resume_sig and last_resume_step fields are moved to a structure
which is clearly identified as only used when the thread is in the
"resumed but pending vCont-resume" state.
gdb/ChangeLog:
* remote.c (enum class resume_state): New.
(struct resumed_pending_vcont_info): New.
(struct remote_thread_info) <resume_state, set_not_resumed,
set_resumed_pending_vcont, resumed_pending_vcont_info,
set_resumed, m_resume_state, m_resumed_pending_vcont_info>:
New.
<last_resume_step, last_resume_sig, vcont_resumed>: Remove.
(remote_target::remote_add_thread): Adjust.
(remote_target::process_initial_stop_replies): Adjust.
(remote_target::resume): Adjust.
(remote_target::commit_resume): Rely on state in
remote_thread_info and not on tp->executing.
(remote_target::process_stop_reply): Adjust.
Change-Id: I10480919ccb4552faa62575e447a36dbe7c2d523
2021-01-14 09:20:43 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* remote.c (enum class resume_state): New.
|
|
|
|
|
(struct resumed_pending_vcont_info): New.
|
|
|
|
|
(struct remote_thread_info) <resume_state, set_not_resumed,
|
|
|
|
|
set_resumed_pending_vcont, resumed_pending_vcont_info,
|
|
|
|
|
set_resumed, m_resume_state, m_resumed_pending_vcont_info>:
|
|
|
|
|
New.
|
|
|
|
|
<last_resume_step, last_resume_sig, vcont_resumed>: Remove.
|
|
|
|
|
(remote_target::remote_add_thread): Adjust.
|
|
|
|
|
(remote_target::process_initial_stop_replies): Adjust.
|
|
|
|
|
(remote_target::resume): Adjust.
|
|
|
|
|
(remote_target::commit_resume): Rely on state in
|
|
|
|
|
remote_thread_info and not on tp->executing.
|
|
|
|
|
(remote_target::process_stop_reply): Adjust.
|
|
|
|
|
|
2021-01-14 03:32:39 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arc-tdep.h (arc_debug_printf): New.
|
|
|
|
|
* arc-tdep.c: Use arc_debug_printf.
|
|
|
|
|
* arc-linux-nat.c (arc_linux_nat_debug_printf): Add and use.
|
|
|
|
|
* arc-linux-tdep.c (arc_linux_debug_printf): Add and use.
|
|
|
|
|
* arc-newlib-tdep.c (arc_newlib_debug_printf): Add and use.
|
|
|
|
|
|
2021-01-14 03:32:23 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arc-tdep.h (arc_debug): Change type to bool.
|
|
|
|
|
* arc-tdep.c (arc_debug): Change type to bool.
|
|
|
|
|
(arc_analyze_prologue): Adjust.
|
|
|
|
|
(_initialize_arc_tdep): Use add_setshow_boolean_cmd.
|
|
|
|
|
* arc-linux-nat.c (ps_get_thread_area): Adjust.
|
|
|
|
|
|
2021-01-14 01:00:37 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.c (auto_load_objfile_script_1): Use bool.
|
|
|
|
|
(execute_script_contents): Use bool.
|
|
|
|
|
|
2021-01-14 00:57:24 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.h (auto_load_gdb_scripts_enabled): Return bool, move
|
|
|
|
|
comment here.
|
|
|
|
|
* auto-load.c (auto_load_gdb_scripts_enabled): Return bool, move
|
|
|
|
|
comment to header.
|
|
|
|
|
* extension-priv.h (struct extension_language_script_ops)
|
|
|
|
|
<auto_load_enabled>: Return bool.
|
|
|
|
|
* extension.h (ext_lang_auto_load_enabled): Return bool, move
|
|
|
|
|
comment here.
|
|
|
|
|
* extension.c (ext_lang_auto_load_enabled): Return bool, move
|
|
|
|
|
comment to header.
|
|
|
|
|
* guile/guile-header.h (gdbscm_auto_load_enabled): Return bool,
|
|
|
|
|
move comment here.
|
|
|
|
|
* guile/scm-auto-load.c (gdbscm_auto_load_enabled): Return bool,
|
|
|
|
|
move comment to header.
|
|
|
|
|
* python/python-header.h (gdbpy_auto_load_enabled): Return bool,
|
|
|
|
|
move comment here.
|
|
|
|
|
* python/py-auto-load.c (gdbpy_auto_load_enabled): Return bool,
|
|
|
|
|
move comment to header.
|
|
|
|
|
|
2021-01-14 00:44:24 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* auto-load.h (file_is_auto_load_safe): Change return type to
|
|
|
|
|
bool, move comment here.
|
|
|
|
|
* auto-load.c (file_is_auto_load_safe): Change return type and
|
|
|
|
|
advice_printed to bool. Move comment to header.
|
|
|
|
|
|
gdb: convert jit to new-style debug macros
Here's a sample output, with infrun debug enabled as well to show
nesting:
[infrun] fetch_inferior_event: enter
[infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
[infrun] print_target_wait_results: 4116727.4116727.0 [process 4116727],
[infrun] print_target_wait_results: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] handle_inferior_event: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] start_step_over: enter
[infrun] start_step_over: stealing global queue of threads to step, length = 0
[infrun] operator(): step-over queue now empty
[infrun] start_step_over: exit
[infrun] handle_signal_stop: stop_pc=0x555555555229
[infrun] handle_jit_event: handling bp_jit_event
[jit] jit_read_descriptor: descriptor_addr = 0x5555555580b0
[jit] jit_register_code: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_bfd_try_read_symtab: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_breakpoint_re_set_internal: breakpoint_addr = 0x555555555229
[infrun] process_event_stop_test: BPSTAT_WHAT_SINGLE
[infrun] process_event_stop_test: no stepping, continue
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [process 4116727] at 0x555555555229
[infrun] prepare_to_wait: prepare_to_wait
[infrun] fetch_inferior_event: exit
gdb/ChangeLog:
* jit.c (jit_debug_printf): New, use throughout file.
Change-Id: Ic0f5eb3ffc926fb555de4914e7dc1076ada63a97
2021-01-13 23:48:51 +08:00
|
|
|
|
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* jit.c (jit_debug_printf): New, use throughout file.
|
|
|
|
|
|
2021-01-13 07:09:51 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* infrun.c (normal_stop): Fix indentation.
|
|
|
|
|
|
2021-01-13 03:19:49 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* top.h (readnow_symbol_files, readnever_symbol_files): Move
|
|
|
|
|
declarations to ...
|
|
|
|
|
* symfile.h: ... here.
|
|
|
|
|
* symfile.c: Update doc.
|
|
|
|
|
|
2021-01-13 03:19:49 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target.h (baud_rate, serial_parity): Move declarations...
|
|
|
|
|
* serial.h: ... here.
|
|
|
|
|
* main.c: Include serial.h.
|
|
|
|
|
* serial.c (baud_rate, serial_parity): Update doc.
|
|
|
|
|
|
2021-01-12 23:42:43 +08:00
|
|
|
|
2021-01-12 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* top.c (pre_init_ui_hook): Remove.
|
|
|
|
|
|
aarch64: Add support for bfloat16 in gdb.
This patch adds support for bfloat16 in AArch64 gdb.
Also adds the field "bf" to vector registers h0-h31.
Also adds the vector "bf" to h field in vector registers v0-v31.
The following is how the vector register h and v looks like.
Before this patch:
(gdb) p $h0
$1 = {f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0}, s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
After this patch:
(gdb) p $h0
$1 = {bf = 0, f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {bf = 0x0, f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {bf = {0, 0, 0, 0, 0, 0, 0, 0}, f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0},
s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {bf = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
gdb/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* aarch64-tdep.c (aarch64_vnh_type): Add "bf" field in h registers.
(aarch64_vnv_type): Add "bf" type in h field of v registers.
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerated.
* features/aarch64-fpu.xml: Add bfloat16 type.
gdb/testsuite/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* gdb.arch/aarch64-fp.exp: Modify to test bfloat16 support.
2021-01-12 21:57:23 +08:00
|
|
|
|
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c (aarch64_vnh_type): Add "bf" field in h registers.
|
|
|
|
|
(aarch64_vnv_type): Add "bf" type in h field of v registers.
|
|
|
|
|
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerated.
|
|
|
|
|
* features/aarch64-fpu.xml: Add bfloat16 type.
|
|
|
|
|
|
gdb: fix debug dump of OP_BOOL expressions
Consider this GDB session:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x4055d90, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x4055d90, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL Unknown format
1 BINOP_ADD
2 OP_BOOL Unknown format
3 OP_NULL Unknown format
$1 = .TRUE.
The final dump of the OP_BOOL is completely wrong. After this patch
we now get:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x2d07470, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x2d07470, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL TRUE
$1 = .TRUE.
Much better. I added a test for this into the Fortran testsuite.
gdb/ChangeLog:
* expprint.c (dump_subexp_body_standard): Handle OP_BOOL.
gdb/testsuite/ChangeLog:
* gdb.fortran/debug-expr.exp: Add new tests.
2021-01-11 23:40:18 +08:00
|
|
|
|
2021-01-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* expprint.c (dump_subexp_body_standard): Handle OP_BOOL.
|
|
|
|
|
|
2021-01-11 22:14:02 +08:00
|
|
|
|
2021-01-12 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-exp.y (dot_ops): Rename to...
|
|
|
|
|
(fortran_operators): ...this. Add a header comment. Add symbol
|
|
|
|
|
based operators.
|
|
|
|
|
(yylex): Update to use fortran_operators not dot_ops. Remove
|
|
|
|
|
special handling for '**', this is now included in
|
|
|
|
|
fortran_operators.
|
|
|
|
|
|
2021-01-12 05:52:42 +08:00
|
|
|
|
2021-01-11 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* arch/aarch64-insn.h (aarch64_debug_printf): New.
|
|
|
|
|
* arch/aarch64-insn.c: Use aarch64_debug_printf.
|
|
|
|
|
* aarch64-tdep.c: Use aarch64_debug_printf.
|
|
|
|
|
|
2021-01-12 05:30:44 +08:00
|
|
|
|
2021-01-11 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* solib-aix.c (solib_aix_debug_printf): New, use throughout
|
|
|
|
|
file.
|
|
|
|
|
|
2021-01-12 05:18:48 +08:00
|
|
|
|
2021-01-11 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* jit.c (jit_debug): Change type to bool.
|
|
|
|
|
(_initialize_jit): Adjust.
|
|
|
|
|
|
2021-01-10 02:38:41 +08:00
|
|
|
|
2021-01-09 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
PR compile/23672
|
|
|
|
|
* compile/compile.c (compile_to_object): Avoid crash when
|
|
|
|
|
osabi_triplet_regexp returns NULL.
|
|
|
|
|
|
2021-01-10 01:06:25 +08:00
|
|
|
|
2021-01-09 Tom Tromey <tom@tromey.com>
|
|
|
|
|
|
|
|
|
|
* tracepoint.h (class collection_list) <append_exp>: Take a
|
|
|
|
|
std::string.
|
|
|
|
|
* tracepoint.c (collection_list::append_exp): Take a std::string.
|
|
|
|
|
(encode_actions_1): Update.
|
|
|
|
|
|
2021-01-09 03:20:12 +08:00
|
|
|
|
2021-01-08 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* parse.c (parse_expression): Add void_context_p parameter. Use
|
|
|
|
|
parse_exp_in_context.
|
|
|
|
|
* printcmd.c (print_command_1): Change voidprint to bool. Pass to
|
|
|
|
|
parse_expression.
|
|
|
|
|
(print_command, call_command): Update.
|
|
|
|
|
* expression.h (parse_expression): Add void_context_p parameter.
|
|
|
|
|
|
gdb: user variables with components of dynamic type
Consider this Fortran type:
type :: some_type
integer, allocatable :: array_one (:,:)
integer :: a_field
integer, allocatable :: array_two (:,:)
end type some_type
And a variable declared:
type(some_type) :: some_var
Now within GDB we try this:
(gdb) set $a = some_var
(gdb) p $a
$1 = ( array_one =
../../src/gdb/value.c:3968: internal-error: Unexpected lazy value type.
Normally, when an internalvar ($a in this case) is created, it is
non-lazy, the value is immediately copied out of the inferior into
GDB's memory.
When printing the internalvar ($a) GDB will extract each field in
turn, so in this case `array_one`. As the original internalvar is
non-lazy then the extracted field will also be non-lazy, with its
contents immediately copied from the parent internalvar.
However, when the field has a dynamic type this is not the case, in
value_primitive_field we see that any field with dynamic type is
always created lazy. Further, the content of this field will usually
not have been captured in the contents buffer of the original value, a
field with dynamic location is effectively a pointer value contained
within the parent value, with rules in the DWARF for how to
dereference the pointer.
So, we end up with a lazy lval_internalvar_component representing a
field within an lval_internalvar. This eventually ends up in
value_fetch_lazy, which currently does not support
lval_internalvar_component, and we see the error above.
My original plan for how to handle this involved extending
value_fetch_lazy to handle lval_internalvar_component. However, when
I did this I ran into another error:
(gdb) set $a = some_var
(gdb) p $a
$1 = ( array_one = ((1, 1) (1, 1) (1, 1)), a_field = 5, array_two = ((0, 0, 0) (0, 0, 0)) )
(gdb) p $a%array_one
$2 = ((1, 1) (1, 1) (1, 1))
(gdb) p $a%array_one(1,1)
../../src/gdb/value.c:1547: internal-error: void set_value_address(value*, CORE_ADDR): Assertion `value->lval == lval_memory' failed.
The problem now is inside set_value_component_location, where we
attempt to set the address for a component if the original parent
value has a dynamic location. GDB does not expect to ever set the
address on anything other than an lval_memory value (which seems
reasonable).
In order to resolve this issue I initially thought about how an
internalvar should "capture" the value of a program variable at the
moment the var is created. In an ideal world (I think) GDB would be
able to do this even for values with dynamic type. So in our above
example doing `set $a = some_var` would capture the content of
'some_var', but also the content of 'array_one', and also 'array_two',
even though these content regions are not contained within the region
of 'some_var'.
Supporting this would require GDB values to be able to carry around
multiple non-contiguous regions of memory as content in some way,
which sounds like a pretty huge change to a core part of GDB.
So, I wondered if there was some other solution that wouldn't require
such a huge change.
What if values with a dynamic location were though of like points with
automatic dereferencing? Given this C structure:
struct foo_t {
int *val;
}
struct foo_t my_foo;
Then in GDB:
(gdb) $a = my_foo
We would expect GDB to capture the pointer value in '$a', but not the
value pointed at by the pointer. So maybe it's not that unreasonable
to think that given a dynamically typed field GDB will capture the
address of the content, but not the actual content itself.
That's what this patch does.
The approach is to catch this case in set_value_component_location.
When we create a component location (of an lval_internalvar) that has
a dynamic data location, the lval_internalvar_component is changed
into an lval_memory. After this, both of the above issues are
resolved. In the first case, the lval_memory is still lazy, but
value_fetch_lazy knows how to handle that. In the second case, when
we access an element of the array we are now accessing an element of
an lval_memory, not an lval_internalvar_component, and calling
set_value_address on an lval_memory is fine.
gdb/ChangeLog:
* value.c (set_value_component_location): Adjust the VALUE_LVAL
for internalvar components that have a dynamic location.
gdb/testsuite/ChangeLog:
* gdb.fortran/intvar-dynamic-types.exp: New file.
* gdb.fortran/intvar-dynamic-types.f90: New file.
2020-10-22 18:34:52 +08:00
|
|
|
|
2021-01-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* value.c (set_value_component_location): Adjust the VALUE_LVAL
|
|
|
|
|
for internalvar components that have a dynamic location.
|
|
|
|
|
|
[gdb] Fix internal-error in process_event_stop_test
The function create_exception_master_breakpoint in gdb/breakpoint.c attempts
to set a master exception breakpoint in each objfile. It tries this using
a libgcc/unwind probe, and if that fails then using the
_Unwind_DebugHook symbol:
...
for (objfile *objfile : current_program_space->objfiles ())
{
/* Try using probes. */
if (/* successful */)
continue;
/* Try using _Unwind_DebugHook */
}
...
The preference scheme works ok both if the objfile has debug info, and if it's
stripped.
But it doesn't work when the objfile has a .gnu_debuglink to a .debug file
(and the .debug file is present). What happens is that:
- we first encounter objfile libgcc.debug
- we try using probes, and this fails
- so we try _Unwind_DebugHook, which succeeds
- next we encounter objfile libgcc
- we try using probes, and this succeeds.
So, we end up with a master exception breakpoint in both libgcc (using probes)
and libgcc.debug (using _Unwind_DebugHook).
This eventually causes:
...
(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3
next^M
src/gdb/infrun.c:6384: internal-error: \
void process_event_stop_test(execution_control_state*): \
Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \
failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next
past catch (GDB internal error)
...
To trigger this internal-error, we need to use gcc-10 or later to compile the
test-case, such that it contains the fix for gcc PR97774 - "Incorrect line
info for try/catch".
Fix this by only trying to install the master exception breakpoint in
libgcc.debug using the _Unwind_DebugHook method, if the install using probes
in libgcc failed.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-01-08 Tom de Vries <tdevries@suse.de>
PR gdb/26881
* breakpoint.c (create_exception_master_breakpoint_probe)
(create_exception_master_breakpoint_hook): Factor out
of ...
(create_exception_master_breakpoint): ... here. Only try to install
the master exception breakpoint in objfile.debug using the
_Unwind_DebugHook method, if the install using probes in objfile
failed.
2021-01-08 18:11:16 +08:00
|
|
|
|
2021-01-08 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
PR gdb/26881
|
|
|
|
|
* breakpoint.c (create_exception_master_breakpoint_probe)
|
|
|
|
|
(create_exception_master_breakpoint_hook): Factor out
|
|
|
|
|
of ...
|
|
|
|
|
(create_exception_master_breakpoint): ... here. Only try to install
|
|
|
|
|
the master exception breakpoint in objfile.debug using the
|
|
|
|
|
_Unwind_DebugHook method, if the install using probes in objfile
|
|
|
|
|
failed.
|
|
|
|
|
|
2021-01-08 01:13:21 +08:00
|
|
|
|
2021-01-08 Andrew Burgess <andrew.burgess@embecosm.com>
|
|
|
|
|
|
|
|
|
|
* f-lang.c (fortran_value_subarray): Call value_from_component.
|
|
|
|
|
|
2015-12-30 12:52:57 +08:00
|
|
|
|
2021-01-07 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* remote-sim.c: Include memory-map.h.
|
|
|
|
|
(gdbsim_target): Define memory_map override.
|
|
|
|
|
(gdbsim_target::memory_map): Define.
|
|
|
|
|
|
2021-01-07 22:02:46 +08:00
|
|
|
|
2021-01-07 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (do_full_match): Conditionally skip "_ada_" prefix.
|
|
|
|
|
|
2021-01-07 21:58:19 +08:00
|
|
|
|
2021-01-07 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (add_component_interval): Start loop using vector's
|
|
|
|
|
updated size.
|
|
|
|
|
|
Fix fixed-point binary operation type handling
Testing showed that gdb was not correctly handling some fixed-point
binary operations correctly.
Addition and subtraction worked by casting the result to the type of
left hand operand. So, "fixed+int" had a different type -- and
different value -- from "int+fixed".
Furthermore, for multiplication and division, it does not make sense
to first cast both sides to the fixed-point type. For example, this
can prevent "f * 1" from yielding "f", if 1 is not in the domain of
"f". Instead, this patch changes gdb to use the value. (This is
somewhat different from Ada semantics, as those can yield a "universal
fixed point".)
This includes a new test case. It is only run in "minimal" mode, as
the old-style fixed point works differently, and is obsolete, so I
have no plans to change it.
gdb/ChangeLog
2021-01-06 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_evaluate_subexp) <BINOP_ADD, BINOP_SUB>:
Do not cast result.
* valarith.c (fixed_point_binop): Handle multiplication
and division specially.
* valops.c (value_to_gdb_mpq): New function.
(value_cast_to_fixed_point): Use it.
gdb/testsuite/ChangeLog
2021-01-06 Tom Tromey <tromey@adacore.com>
* gdb.ada/fixed_points/pck.ads (Delta4): New constant.
(FP4_Type): New type.
(FP4_Var): New variable.
* gdb.ada/fixed_points/fixed_points.adb: Update.
* gdb.ada/fixed_points.exp: Add tests for binary operators.
2021-01-07 04:47:48 +08:00
|
|
|
|
2021-01-06 Tom Tromey <tromey@adacore.com>
|
|
|
|
|
|
|
|
|
|
* ada-lang.c (ada_evaluate_subexp) <BINOP_ADD, BINOP_SUB>:
|
|
|
|
|
Do not cast result.
|
|
|
|
|
* valarith.c (fixed_point_binop): Handle multiplication
|
|
|
|
|
and division specially.
|
|
|
|
|
* valops.c (value_to_gdb_mpq): New function.
|
|
|
|
|
(value_cast_to_fixed_point): Use it.
|
|
|
|
|
|
2020-12-21 21:26:29 +08:00
|
|
|
|
2021-01-05 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-winsource.c (tui_source_window_base::refresh_window):
|
|
|
|
|
Call wnoutrefresh instead of tui_win_info::refresh_window.
|
|
|
|
|
|
2020-12-21 20:52:03 +08:00
|
|
|
|
2021-01-05 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* tui/tui-source.c (tui_source_window::show_line_number):
|
|
|
|
|
Redraw second space after line number.
|
|
|
|
|
|
2020-12-21 20:16:24 +08:00
|
|
|
|
2021-01-05 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
PR tui/26927
|
|
|
|
|
* tui/tui-winsource.c (tui_source_window_base::refresh_window):
|
|
|
|
|
Fix source pad size in prefresh.
|
|
|
|
|
(tui_source_window_base::show_source_content): Grow source pad
|
|
|
|
|
if necessary.
|
|
|
|
|
|
2015-06-19 16:24:13 +08:00
|
|
|
|
2021-01-04 Mike Frysinger <vapier@gentoo.org>
|
|
|
|
|
|
|
|
|
|
* bfin-tdep.c (bfin_push_dummy_call): Use align_up.
|
|
|
|
|
(bfin_frame_align): Use align_down.
|
|
|
|
|
|
2021-01-05 02:34:25 +08:00
|
|
|
|
2021-01-04 Tom de Vries <tdevries@suse.de>
|
|
|
|
|
|
|
|
|
|
* buildsym.c (buildsym_compunit::record_line): Filter out end-of-seq
|
|
|
|
|
terminators that do not terminate anything.
|
|
|
|
|
|
gdb: introduce scoped debug prints
I spent a lot of time reading infrun debug logs recently, and I think
they could be made much more readable by being indented, to clearly see
what operation is done as part of what other operation. In the current
format, there are no visual cues to tell where things start and end,
it's just a big flat list. It's also difficult to understand what
caused a given operation (e.g. a call to resume_1) to be done.
To help with this, I propose to add the new scoped_debug_start_end
structure, along with a bunch of macros to make it convenient to use.
The idea of scoped_debug_start_end is simply to print a start and end
message at construction and destruction. It also increments/decrements
a depth counter in order to make debug statements printed during this
range use some indentation. Some care is taken to handle the fact that
debug can be turned on or off in the middle of such a range. For
example, a "set debug foo 1" command in a breakpoint command, or a
superior GDB manually changing the debug_foo variable.
Two macros are added in gdbsupport/common-debug.h, which are helpers to
define module-specific macros:
- scoped_debug_start_end: takes a message that is printed both at
construction / destruction, with "start: " and "end: " prefixes.
- scoped_debug_enter_exit: prints hard-coded "enter" and "exit"
messages, to denote the entry and exit of a function.
I added some examples in the infrun module to give an idea of how it can
be used and what the result looks like. The macros are in capital
letters (INFRUN_SCOPED_DEBUG_START_END and
INFRUN_SCOPED_DEBUG_ENTER_EXIT) to mimic the existing SCOPE_EXIT, but
that can be changed if you prefer something else.
Here's an excerpt of the debug
statements printed when doing "continue", where a displaced step is
started:
[infrun] proceed: enter
[infrun] proceed: addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT
[infrun] global_thread_step_over_chain_enqueue: enqueueing thread Thread 0x7ffff75a5640 (LWP 2289301) in global step over chain
[infrun] start_step_over: enter
[infrun] start_step_over: stealing global queue of threads to step, length = 1
[infrun] start_step_over: resuming [Thread 0x7ffff75a5640 (LWP 2289301)] for step-over
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [Thread 0x7ffff75a5640 (LWP 2289301)] at 0x5555555551bd
[displaced] displaced_step_prepare_throw: displaced-stepping Thread 0x7ffff75a5640 (LWP 2289301) now
[displaced] prepare: selected buffer at 0x5555555550c2
[displaced] prepare: saved 0x5555555550c2: 1e fa 31 ed 49 89 d1 5e 48 89 e2 48 83 e4 f0 50
[displaced] amd64_displaced_step_copy_insn: copy 0x5555555551bd->0x5555555550c2: c7 45 fc 00 00 00 00 eb 13 8b 05 d4 2e 00 00 83
[displaced] displaced_step_prepare_throw: prepared successfully thread=Thread 0x7ffff75a5640 (LWP 2289301), original_pc=0x5555555551bd, displaced_pc=0x5555555550c2
[displaced] resume_1: run 0x5555555550c2: c7 45 fc 00
[infrun] infrun_async: enable=1
[infrun] prepare_to_wait: prepare_to_wait
[infrun] start_step_over: [Thread 0x7ffff75a5640 (LWP 2289301)] was resumed.
[infrun] operator(): step-over queue now empty
[infrun] start_step_over: exit
[infrun] proceed: start: resuming threads, all-stop-on-top-of-non-stop
[infrun] proceed: resuming Thread 0x7ffff7da7740 (LWP 2289296)
[infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [Thread 0x7ffff7da7740 (LWP 2289296)] at 0x7ffff7f7d9b7
[infrun] prepare_to_wait: prepare_to_wait
[infrun] proceed: resuming Thread 0x7ffff7da6640 (LWP 2289300)
[infrun] resume_1: thread Thread 0x7ffff7da6640 (LWP 2289300) has pending wait status status->kind = stopped, signal = GDB_SIGNAL_TRAP (currently_stepping=0).
[infrun] prepare_to_wait: prepare_to_wait
[infrun] proceed: [Thread 0x7ffff75a5640 (LWP 2289301)] resumed
[infrun] proceed: resuming Thread 0x7ffff6da4640 (LWP 2289302)
[infrun] resume_1: thread Thread 0x7ffff6da4640 (LWP 2289302) has pending wait status status->kind = stopped, signal = GDB_SIGNAL_TRAP (currently_stepping=0).
[infrun] prepare_to_wait: prepare_to_wait
[infrun] proceed: end: resuming threads, all-stop-on-top-of-non-stop
[infrun] proceed: exit
We can easily see where the call to `proceed` starts and end. We can
also see why there are a bunch of resume_1 calls, it's because we are
resuming threads, emulating all-stop on top of a non-stop target.
We also see that debug statements nest well with other modules that have
been migrated to use the "new" debug statement helpers (because they all
use debug_prefixed_vprintf in the end. I think this is desirable, for
example we could see the debug statements about reading the DWARF info
of a library nested under the debug statements about loading that
library.
Of course, modules that haven't been migrated to use the "new" helpers
will still print without indentations. This will be one good reason to
migrate them.
I think the runtime cost (when debug statements are disabled) of this is
reasonable, given the improvement in readability. There is the cost of
the conditionals (like standard debug statements), one more condition
(if (m_must_decrement_print_depth)) and the cost of constructing a stack
object, which means copying a fews pointers.
Adding the print in fetch_inferior_event breaks some tests that use "set
debug infrun", because it prints a debug statement after the prompt. I
adapted these tests to cope with it, by using the "-prompt" switch of
gdb_test_multiple to as if this debug statement is part of the expected
prompt. It's unfortunate that we have to do this, but I think the debug
print is useful, and I don't want a few tests to get in the way of
adding good debug output.
gdbsupport/ChangeLog:
* common-debug.h (debug_print_depth): New.
(struct scoped_debug_start_end): New.
(scoped_debug_start_end): New.
(scoped_debug_enter_exit): New.
* common-debug.cc (debug_prefixed_vprintf): Print indentation.
gdb/ChangeLog:
* debug.c (debug_print_depth): New.
* infrun.h (INFRUN_SCOPED_DEBUG_START_END): New.
(INFRUN_SCOPED_DEBUG_ENTER_EXIT): New.
* infrun.c (start_step_over): Use
INFRUN_SCOPED_DEBUG_ENTER_EXIT.
(proceed): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT and
INFRUN_SCOPED_DEBUG_START_END.
(fetch_inferior_event): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT.
gdbserver/ChangeLog:
* debug.cc (debug_print_depth): New.
gdb/testsuite/ChangeLog:
* gdb.base/ui-redirect.exp: Expect infrun debug print after
prompt.
* gdb.threads/ia64-sigill.exp: Likewise.
* gdb.threads/watchthreads-reorder.exp: Likewise.
Change-Id: I7c3805e6487807aa63a1bae318876a0c69dce949
2021-01-05 00:56:10 +08:00
|
|
|
|
2021-01-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* debug.c (debug_print_depth): New.
|
|
|
|
|
* infrun.h (INFRUN_SCOPED_DEBUG_START_END): New.
|
|
|
|
|
(INFRUN_SCOPED_DEBUG_ENTER_EXIT): New.
|
|
|
|
|
* infrun.c (start_step_over): Use
|
|
|
|
|
INFRUN_SCOPED_DEBUG_ENTER_EXIT.
|
|
|
|
|
(proceed): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT and
|
|
|
|
|
INFRUN_SCOPED_DEBUG_START_END.
|
|
|
|
|
(fetch_inferior_event): Use INFRUN_SCOPED_DEBUG_ENTER_EXIT.
|
|
|
|
|
|
gdb: use infrun_debug_printf in print_target_wait_results
The code in print_target_wait_results uses a single call to debug_printf
in order to make sure a single timestamp is emitted, despite printing
multiple lines. The result is:
941502.043284 [infrun] target_wait (-1.0.0, status) =
[infrun] 649832.649832.0 [process 649832],
[infrun] status->kind = stopped, signal = GDB_SIGNAL_TRAP
I find this decision a bit counter productive, because it messes up the
alignment of the three lines. We don't care that three (slightly
different) timestamps are printed.
I suggest to change this function to use infrun_debug_printf, with this
result:
941601.425771 [infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
941601.425824 [infrun] print_target_wait_results: 651481.651481.0 [process 651481],
941601.425867 [infrun] print_target_wait_results: status->kind = stopped, signal = GDB_SIGNAL_TRAP
Note that the current code only prints the waiton_ptid as a string
between square brackets if pid != -1. I don't think this complexity is
needed in a debug print. I made it so it's always printed, which I
think results in a much simpler function.
gdb/ChangeLog:
* infrun.c (print_target_wait_results): Use infrun_debug_printf.
Change-Id: I817bd10286b8e641a6c751ac3a1bd1ddf9b18ce0
2021-01-05 00:56:10 +08:00
|
|
|
|
2021-01-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* infrun.c (print_target_wait_results): Use infrun_debug_printf.
|
|
|
|
|
|
gdb: make "set debug timestamp" work nice with new debug printouts
New in v2:
- implement by modifying vprintf_unfiltered rather than
debug_prefixed_vprintf.
I tried enabling debug timestamps, and realized that it doesn't play
well with the revamp of the debug printouts I've been working on:
$ ./gdb -q -nx --data-directory=data-directory -ex "set debug infrun" -ex "set debug timestamp" a.out
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x1131: file test.c, line 2.
Starting program: /home/smarchi/build/binutils-gdb-all-targets/gdb/a.out
939897.769338 [infrun] infrun_async:
939897.769383 enable=1
939897.769409
939897.915218 [infrun] proceed:
939897.915281 addr=0x7ffff7fd0100, signal=GDB_SIGNAL_0
939897.915315
939897.915417 [infrun] start_step_over:
939897.915464 stealing global queue of threads to step, length = 0
939897.915502
939897.915567 [infrun] operator():
939897.915601 step-over queue now empty
939897.915633
939897.915690 [infrun] proceed:
939897.915729 resuming process 636244
939897.915768
939897.915892 [infrun] resume_1:
939897.915954 step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [process 636244] at 0x7ffff7fd0100
939897.915991
939897.916119 [infrun] prepare_to_wait:
939897.916153 prepare_to_wait
939897.916201
939897.916661 [infrun] target_wait (-1.0.0, status) =
[infrun] 636244.636244.0 [process 636244],
[infrun] status->kind = stopped, signal = GDB_SIGNAL_TRAP
939897.916734 [infrun] handle_inferior_event:
939897.916768 status->kind = stopped, signal = GDB_SIGNAL_TRAP
939897.916799
This is due to debug_prefixed_vprintf being implemented as three
separate calls to debug_printf / debug_vprintf. Each call gets its own
timestamp and newline, curtesy of vprintf_unfiltered.
My first idea was to add a "line_start" parameter to debug_vprintf,
allowing the caller to say whether the print is the start of the line.
A debug timestamp would only be printed if line_start was true.
However, that was much more invasive than the simple fix implemented in
this patch.
My second idea was to make debug_prefixed_vprintf use string_printf and
issue a single call to debug_printf. That would however prevent future
use of styling in the debug messages.
What is implemented in this patch is the same as is implemented in
GDBserver: the timestamp-printing code in GDB tracks whether the last
debug output ended with a newline. If so, it prints a timestamp on the
next debug output.
After the fix, it looks like this:
$ ./gdb -q -nx --data-directory=data-directory -ex "set debug infrun" -ex "set debug timestamp" a.out
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x1131: file test.c, line 2.
Starting program: /home/smarchi/build/binutils-gdb-all-targets/gdb/a.out
941112.135662 [infrun] infrun_async: enable=1
941112.279930 [infrun] proceed: addr=0x7ffff7fd0100, signal=GDB_SIGNAL_0
941112.280064 [infrun] start_step_over: stealing global queue of threads to step, length = 0
941112.280125 [infrun] operator(): step-over queue now empty
941112.280194 [infrun] proceed: resuming process 646228
941112.280332 [infrun] resume_1: step=0, signal=GDB_SIGNAL_0, trap_expected=0, current thread [process 646228] at 0x7ffff7fd0100
941112.280480 [infrun] prepare_to_wait: prepare_to_wait
941112.281004 [infrun] target_wait (-1.0.0, status) =
[infrun] 646228.646228.0 [process 646228],
[infrun] status->kind = stopped, signal = GDB_SIGNAL_TRAP
941112.281078 [infrun] handle_inferior_event: status->kind = stopped, signal = GDB_SIGNAL_TRAP
gdb/ChangeLog:
* utils.c (vfprintf_unfiltered): Print timestamp only when
previous debug output ended with a newline.
Change-Id: Idcfe3acc7e3d0f526a5f0a43a5e0884bf93c41ae
2021-01-05 00:56:10 +08:00
|
|
|
|
2021-01-04 Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
|
|
|
|
|
|
* utils.c (vfprintf_unfiltered): Print timestamp only when
|
|
|
|
|
previous debug output ended with a newline.
|
|
|
|
|
|
Refactor struct trad_frame_saved_regs
The following patch drops the overloading going on with the trad_frame_saved_reg
struct and defines a new struct with a KIND enum and a union of different
fields.
The new struct looks like this:
struct trad_frame_saved_reg
{
setters/getters
...
private:
trad_frame_saved_reg_kind m_kind;
union {
LONGEST value;
int realreg;
LONGEST addr;
const gdb_byte *value_bytes;
} m_reg;
};
And the enums look like this:
/* Describes the kind of encoding a stored register has. */
enum class trad_frame_saved_reg_kind
{
/* Register value is unknown. */
UNKNOWN = 0,
/* Register value is a constant. */
VALUE,
/* Register value is in another register. */
REALREG,
/* Register value is at an address. */
ADDR,
/* Register value is a sequence of bytes. */
VALUE_BYTES
};
The patch also adds setters/getters and updates all the users of the old
struct.
It is worth mentioning that due to the previous overloaded nature of the
fields, some tdep files like to store negative offsets and indexes in the ADDR
field, so I kept the ADDR as LONGEST instead of CORE_ADDR. Those cases may
be better supported by a new enum entry.
I have not addressed those cases in this patch to prevent unwanted breakage,
given I have no way to test some of the targets. But it would be nice to
clean those up eventually.
The change to frame-unwind.* is to constify the parameter being passed to the
unwinding functions, given we now accept a "const gdb_byte *" for value bytes.
Tested on aarch64-linux/Ubuntu 20.04/18.04 and by building GDB with
--enable-targets=all.
gdb/ChangeLog:
2021-01-04 Luis Machado <luis.machado@linaro.org>
Update all users of trad_frame_saved_reg to use the new member
functions.
Remote all struct keywords from declarations of trad_frame_saved_reg
types, except on forward declarations.
* aarch64-tdep.c: Update.
* alpha-mdebug-tdep.c: Update.
* alpha-tdep.c: Update.
* arc-tdep.c: Update.
* arm-tdep.c: Update.
* avr-tdep.c: Update.
* cris-tdep.c: Update.
* csky-tdep.c: Update.
* frv-tdep.c: Update.
* hppa-linux-tdep.c: Update.
* hppa-tdep.c: Update.
* hppa-tdep.h: Update.
* lm32-tdep.c: Update.
* m32r-linux-tdep.c: Update.
* m32r-tdep.c: Update.
* m68hc11-tdep.c: Update.
* mips-tdep.c: Update.
* moxie-tdep.c: Update.
* riscv-tdep.c: Update.
* rs6000-tdep.c: Update.
* s390-linux-tdep.c: Update.
* s390-tdep.c: Update.
* score-tdep.c: Update.
* sparc-netbsd-tdep.c: Update.
* sparc-sol2-tdep.c: Update.
* sparc64-fbsd-tdep.c: Update.
* sparc64-netbsd-tdep.c: Update.
* sparc64-obsd-tdep.c: Update.
* sparc64-sol2-tdep.c: Update.
* tilegx-tdep.c: Update.
* v850-tdep.c: Update.
* vax-tdep.c: Update.
* frame-unwind.c (frame_unwind_got_bytes): Make parameter const.
* frame-unwind.h (frame_unwind_got_bytes): Likewise.
* trad-frame.c: Update.
Remove TF_REG_* enum.
(trad_frame_alloc_saved_regs): Add a static assertion to check for
a trivially-constructible struct.
(trad_frame_reset_saved_regs): Adjust to use member function.
(trad_frame_value_p): Likewise.
(trad_frame_addr_p): Likewise.
(trad_frame_realreg_p): Likewise.
(trad_frame_value_bytes_p): Likewise.
(trad_frame_set_value): Likewise.
(trad_frame_set_realreg): Likewise.
(trad_frame_set_addr): Likewise.
(trad_frame_set_unknown): Likewise.
(trad_frame_set_value_bytes): Likewise.
(trad_frame_get_prev_register): Likewise.
* trad-frame.h: Update.
(trad_frame_saved_reg_kind): New enum.
(struct trad_frame_saved_reg) <addr, realreg, data>: Remove.
<m_kind, m_reg>: New member fields.
<set_value, set_realreg, set_addr, set_unknown, set_value_bytes>
<kind, value, realreg, addr, value_bytes, is_value, is_realreg>
<is_addr, is_unknown, is_value_bytes>: New member functions.
2020-12-23 04:45:21 +08:00
|
|
|
|
2021-01-04 Luis Machado <luis.machado@linaro.org>
|
|
|
|
|
|
|
|
|
|
Update all users of trad_frame_saved_reg to use the new member
|
|
|
|
|
functions.
|
|
|
|
|
|
|
|
|
|
Remote all struct keywords from declarations of trad_frame_saved_reg
|
|
|
|
|
types, except on forward declarations.
|
|
|
|
|
|
|
|
|
|
* aarch64-tdep.c: Update.
|
|
|
|
|
* alpha-mdebug-tdep.c: Update.
|
|
|
|
|
* alpha-tdep.c: Update.
|
|
|
|
|
* arc-tdep.c: Update.
|
|
|
|
|
* arm-tdep.c: Update.
|
|
|
|
|
* avr-tdep.c: Update.
|
|
|
|
|
* cris-tdep.c: Update.
|
|
|
|
|
* csky-tdep.c: Update.
|
|
|
|
|
* frv-tdep.c: Update.
|
|
|
|
|
* hppa-linux-tdep.c: Update.
|
|
|
|
|
* hppa-tdep.c: Update.
|
|
|
|
|
* hppa-tdep.h: Update.
|
|
|
|
|
* lm32-tdep.c: Update.
|
|
|
|
|
* m32r-linux-tdep.c: Update.
|
|
|
|
|
* m32r-tdep.c: Update.
|
|
|
|
|
* m68hc11-tdep.c: Update.
|
|
|
|
|
* mips-tdep.c: Update.
|
|
|
|
|
* moxie-tdep.c: Update.
|
|
|
|
|
* riscv-tdep.c: Update.
|
|
|
|
|
* rs6000-tdep.c: Update.
|
|
|
|
|
* s390-linux-tdep.c: Update.
|
|
|
|
|
* s390-tdep.c: Update.
|
|
|
|
|
* score-tdep.c: Update.
|
|
|
|
|
* sparc-netbsd-tdep.c: Update.
|
|
|
|
|
* sparc-sol2-tdep.c: Update.
|
|
|
|
|
* sparc64-fbsd-tdep.c: Update.
|
|
|
|
|
* sparc64-netbsd-tdep.c: Update.
|
|
|
|
|
* sparc64-obsd-tdep.c: Update.
|
|
|
|
|
* sparc64-sol2-tdep.c: Update.
|
|
|
|
|
* tilegx-tdep.c: Update.
|
|
|
|
|
* v850-tdep.c: Update.
|
|
|
|
|
* vax-tdep.c: Update.
|
|
|
|
|
|
|
|
|
|
* frame-unwind.c (frame_unwind_got_bytes): Make parameter const.
|
|
|
|
|
* frame-unwind.h (frame_unwind_got_bytes): Likewise.
|
|
|
|
|
|
|
|
|
|
* trad-frame.c: Update.
|
|
|
|
|
Remove TF_REG_* enum.
|
|
|
|
|
(trad_frame_alloc_saved_regs): Add a static assertion to check for
|
|
|
|
|
a trivially-constructible struct.
|
|
|
|
|
(trad_frame_reset_saved_regs): Adjust to use member function.
|
|
|
|
|
(trad_frame_value_p): Likewise.
|
|
|
|
|
(trad_frame_addr_p): Likewise.
|
|
|
|
|
(trad_frame_realreg_p): Likewise.
|
|
|
|
|
(trad_frame_value_bytes_p): Likewise.
|
|
|
|
|
(trad_frame_set_value): Likewise.
|
|
|
|
|
(trad_frame_set_realreg): Likewise.
|
|
|
|
|
(trad_frame_set_addr): Likewise.
|
|
|
|
|
(trad_frame_set_unknown): Likewise.
|
|
|
|
|
(trad_frame_set_value_bytes): Likewise.
|
|
|
|
|
(trad_frame_get_prev_register): Likewise.
|
|
|
|
|
* trad-frame.h: Update.
|
|
|
|
|
(trad_frame_saved_reg_kind): New enum.
|
|
|
|
|
(struct trad_frame_saved_reg) <addr, realreg, data>: Remove.
|
|
|
|
|
<m_kind, m_reg>: New member fields.
|
|
|
|
|
<set_value, set_realreg, set_addr, set_unknown, set_value_bytes>
|
|
|
|
|
<kind, value, realreg, addr, value_bytes, is_value, is_realreg>
|
|
|
|
|
<is_addr, is_unknown, is_value_bytes>: New member functions.
|
|
|
|
|
|
2021-01-03 10:32:14 +08:00
|
|
|
|
2021-01-02 Simon Marchi <simon.marchi@polymtl.ca>
|
|
|
|
|
|
|
|
|
|
* target-float.c: Fix typos.
|
|
|
|
|
|
2021-01-03 00:35:25 +08:00
|
|
|
|
2021-01-02 Hannes Domani <ssbssa@yahoo.de>
|
|
|
|
|
|
|
|
|
|
* gdb-gdb.py.in: Fix main_type.flds_bnds.bounds pretty printer.
|
|
|
|
|
|
2021-01-01 16:08:28 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
* gdbarch.sh: Update copyright year range.
|
|
|
|
|
|
2021-01-01 16:03:39 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
Update copyright year range in copyright header of all GDB files.
|
|
|
|
|
|
2021-01-01 15:56:12 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
* copyright.py (get_update_list): Add "gdbserver" and "gdbsupport"
|
|
|
|
|
to the list of directories to update.
|
|
|
|
|
|
2021-01-01 15:53:14 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
|
|
|
|
|
|
|
|
|
* top.c (print_gdb_version): Update copyright year.
|
|
|
|
|
|
2021-01-01 15:45:58 +08:00
|
|
|
|
2021-01-01 Joel Brobecker <brobecker@adacore.com>
|
2020-12-28 04:36:55 +08:00
|
|
|
|
|
2021-01-01 15:45:58 +08:00
|
|
|
|
* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2020.
|
2020-12-28 04:36:55 +08:00
|
|
|
|
|
2021-01-01 15:45:58 +08:00
|
|
|
|
For older changes see ChangeLog-2020.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
Local Variables:
|
|
|
|
|
mode: change-log
|
|
|
|
|
left-margin: 8
|
|
|
|
|
fill-column: 74
|
|
|
|
|
version-control: never
|
2007-08-10 06:44:38 +08:00
|
|
|
|
coding: utf-8
|
1999-04-16 09:35:26 +08:00
|
|
|
|
End:
|