]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
6 years agoFix dwarf2read.c:dwarf2_find_containing_comp_unit's binary search
Sergio Durigan Junior [Wed, 28 Nov 2018 22:22:08 +0000 (17:22 -0500)] 
Fix dwarf2read.c:dwarf2_find_containing_comp_unit's binary search

First of all, I would like to express my gratitude to Keith Seitz, Jan
Kratochvil and Tom Tromey, who were really kind and helped a lot with
this bug.  The patch itself was authored by Jan.

This all began with:

  https://bugzilla.redhat.com/show_bug.cgi?id=1639242
  py-bt is broken, results in exception

In summary, the error reported by the bug above is:

  $ gdb -args python3
  GNU gdb (GDB) Fedora 8.1.1-3.fc28
  (...)
  Reading symbols from python3...Reading symbols from /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug...done.
  done.
  Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]

After a long investigation, and after thinking that the problem might
actually be on DWZ's side, we were able to determine that there's
something wrong going on when
dwarf2read.c:dwarf2_find_containing_comp_unit performs a binary search
over all of the CUs belonging to an objfile in order to find the CU
which contains a DIE at an specific offset.  The current algorithm is:

  static struct dwarf2_per_cu_data *
  dwarf2_find_containing_comp_unit (sect_offset sect_off,
    unsigned int offset_in_dwz,
    struct dwarf2_per_objfile *dwarf2_per_objfile)
  {
    struct dwarf2_per_cu_data *this_cu;
    int low, high;
    const sect_offset *cu_off;

    low = 0;
    high = dwarf2_per_objfile->all_comp_units.size () - 1;
    while (high > low)
      {
struct dwarf2_per_cu_data *mid_cu;
int mid = low + (high - low) / 2;

mid_cu = dwarf2_per_objfile->all_comp_units[mid];
cu_off = &mid_cu->sect_off;
if (mid_cu->is_dwz > offset_in_dwz
    || (mid_cu->is_dwz == offset_in_dwz && *cu_off >= sect_off))
  high = mid;
else
  low = mid + 1;
      }

For the sake of this example, let's consider that "sect_off =
0x7d".

There are a few important things going on here.  First,
"dwarf2_per_objfile->all_comp_units ()" will be sorted first by
whether the CU is a DWZ CU, and then by cu->sect_off.  In this
specific bug, "offset_in_dwz" is false, which means that, for the most
part of the loop, we're going to do "high = mid" (i.e, we'll work with
the lower part of the vector).

In our particular case, when we reach the part where "mid_cu->is_dwz
== offset_in_dwz" (i.e, both are false), we end up with "high = 2" and
"mid = 1".  I.e., there are only 2 elements in the vector who are not
DWZ.  The vector looks like this:

  #0: cu->sect_off = 0;   length = 114;  is_dwz = false  <-- low
  #1: cu->sect_off = 114; length = 7796; is_dwz = false  <-- mid
  #2: cu->sect_off = 0;   length = 28;   is_dwz = true   <-- high
  ...

The CU we want is #1, which is exactly where "mid" is.  Also, #1 is
not DWZ, which is also exactly what we want.  So we perform the second
comparison:

  (mid_cu->is_dwz == offset_in_dwz && *cu_off >= sect_off)
                                      ^^^^^^^^^^^^^^^^^^^

Because "*cu_off = 114" and "sect_off = 0x7d", this evaluates to
false, so we end up with "low = mid + 1 = 2", which actually gives us
the wrong CU (i.e., a CU that is DWZ).  Next in the code, GDB does:

    gdb_assert (low == high);
    this_cu = dwarf2_per_objfile->all_comp_units[low];
    cu_off = &this_cu->sect_off;
    if (this_cu->is_dwz != offset_in_dwz || *cu_off > sect_off)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      {
if (low == 0 || this_cu->is_dwz != offset_in_dwz)
  error (_("Dwarf Error: could not find partial DIE containing "
 "offset %s [in module %s]"),
 sect_offset_str (sect_off),
 bfd_get_filename (dwarf2_per_objfile->objfile->obfd));
...

Triggering the error we saw in the original bug report.

It's important to notice that we see the error message because the
selected CU is a DWZ one, but we're looking for a non-DWZ CU here.
However, even when the selected CU is *not* a DWZ (and we don't see
any error message), we still end up with the wrong CU.  For example,
suppose that the vector had:

  #0: cu->sect_off = 0;    length = 114;  is_dwz = false
  #1: cu->sect_off = 114;  length = 7796; is_dwz = false
  #2: cu->sect_off = 7910; length = 28;   is_dwz = false
  ...

I.e., #2's "is_dwz" is false instead of true.  In this case, we still
want #1, because that's where the DIE is located.  After the loop ends
up in #2, we have "is_dwz" as false, which is what we wanted, so we
compare offsets.  In this case, "7910 >= 0x7d", so we set "mid = high
= 2".  Next iteration, we have "mid = 0 + (2 - 0) / 2 = 1", and thus
we examining #1.  "is_dwz" is still false, but "114 >= 0x7d" also
evaluates to false, so "low = mid + 1 = 2", which makes the loop stop.
Therefore, we end up choosing #2 as our CU, even though #1 is the
right one.

The problem here is happening because we're comparing "sect_off"
directly against "*cu_off", while we should actually be comparing
against "*cu_off + mid_cu->length" (i.e., the end offset):

  ...
  || (mid_cu->is_dwz == offset_in_dwz
      && *cu_off + mid_cu->length >= sect_off))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ...

And this is what the patch does.  The idea is that if GDB is searching
for an offset that falls above the *end* of the CU being
analyzed (i.e., "mid"), then the next iteration should try a
higher-offset CU next.  The previous algorithm was using
the *beginning* of the CU.

Unfortunately, I could not devise a testcase for this problem, so I am
proposing a fix with this huge explanation attached to it in the hope
that it is sufficient.  After talking a bit to Keith (our testcase
guru), it seems that one would have to create an objfile with both DWZ
and non-DWZ sections, which may prove very hard to do, I think.

I ran this patch on our BuildBot, and no regressions were detected.

gdb/ChangeLog:
2018-11-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Keith Seitz  <keiths@redhat.com>
    Tom Tromey  <tom@tromey.com>
    Sergio Durigan Junior  <sergiodj@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1613614
PR gdb/24003
* dwarf2read.c (dwarf2_find_containing_comp_unit): Add
'mid_cu->length' to '*cu_off' when checking if 'sect_off' is
inside the CU.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Dec 2018 00:01:47 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Dec 2018 00:01:58 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Dec 2018 00:02:07 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 15 Dec 2018 00:01:34 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 14 Dec 2018 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 13 Dec 2018 00:01:42 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Dec 2018 00:01:38 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Dec 2018 00:01:25 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Dec 2018 00:01:41 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 9 Dec 2018 00:02:35 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Dec 2018 00:01:36 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Dec 2018 00:01:39 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Dec 2018 00:01:34 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Dec 2018 00:01:41 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Dec 2018 00:01:16 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Dec 2018 00:01:43 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Dec 2018 00:02:20 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Dec 2018 00:02:00 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Nov 2018 00:01:59 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Nov 2018 00:01:44 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Nov 2018 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Nov 2018 00:01:30 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Nov 2018 00:01:38 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Nov 2018 00:02:18 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Nov 2018 00:01:17 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Nov 2018 00:01:47 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Nov 2018 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoMake command-repeat work after gdb.execute
Benno Fünfstück [Wed, 21 Nov 2018 17:16:25 +0000 (17:16 +0000)] 
Make command-repeat work after gdb.execute

Since commit

  56bcdbea2bed ("Let gdb.execute handle multi-line commands")

command repetition after using the `gdb.execute` Python function
fails (the previous command is not repeated anymore). This happens
because read_command_lines_1 sets dont_repeat, but the call to
prevent_dont_repeat in execute_gdb_command is later.

The fix is to move the call to prevent_dont_repeat to the beginning of
the function.

Tested on my laptop (ArchLinux-x86_64).

gdb/ChangeLog:

PR python/23714
* gdb/python/python.c (execute_gdb_command): Call
prevent_dont_repeat earlier to avoid affecting dont_repeat.

gdb/testuite/ChangeLog:

PR python/23714
* gdb.python/python.exp: Test command repetition after
gdb.execute.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Nov 2018 00:01:50 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Nov 2018 00:01:53 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agogdb.base/warning.exp tweaks
Pedro Alves [Mon, 19 Nov 2018 15:08:46 +0000 (15:08 +0000)] 
gdb.base/warning.exp tweaks

#1- Check that the warning is emitted.

#2- Avoid overriding INTERNAL_GDBFLAGS, as per documentated in
    gdb/testsuite/README:

 ~~~
 The testsuite does not override a value provided by the user.
 ~~~

We don't actually need to tweak INTERNAL_GDBFLAGS, we just need to
append out -data-directory to GDBFLAGS, because each passed
-data-directory option leads to a call to the warning:

 $ ./gdb -data-directory=foo -data-directory=bar
 Warning: foo: No such file or directory.
 Warning: bar: No such file or directory.
 [...]

2018-11-19  Pedro Alves  <palves@redhat.com>

* gdb.base/warning.exp: Don't override INTERNAL_FLAGS.  Use
gdb_spawn_with_cmdline_opts instead of gdb_start.  Check that we
see the expected warning.

6 years agoAvoid crash when calling warning too early
Tom Tromey [Fri, 5 Oct 2018 20:54:35 +0000 (14:54 -0600)] 
Avoid crash when calling warning too early

I noticed that if you pass the name of an existing file (not a
directory) as the argument to --data-directory, gdb will crash:

    $ ./gdb -nx  --data-directory  ./gdb
    ../../binutils-gdb/gdb/target.c:590:56: runtime error: member call on null pointer of type 'struct target_ops'

This was later reported as PR gdb/23838.

This happens because warning ends up calling
target_supports_terminal_ours, which calls current_top_target, which
returns nullptr this early.

This fixes the problem by handling this case specially in
target_supports_terminal_ours.  I also changed
target_supports_terminal_ours to return bool.

2018-11-08  Tom Tromey  <tom@tromey.com>

PR gdb/23555:
PR gdb/23838:
* target.h (target_supports_terminal_ours): Return bool.
* target.c (target_supports_terminal_ours): Handle case where
current_top_target returns nullptr.  Return bool.

gdb/testsuite/ChangeLog
2018-11-08  Tom Tromey  <tom@tromey.com>

PR gdb/23555:
PR gdb/23838:
* gdb.base/warning.exp: New file.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Nov 2018 00:01:34 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Nov 2018 00:02:27 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Nov 2018 00:02:01 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Nov 2018 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 15 Nov 2018 00:01:37 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 14 Nov 2018 00:02:01 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Nov 2018 00:01:43 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Nov 2018 00:01:25 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 11 Nov 2018 00:02:13 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 10 Nov 2018 00:01:55 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 9 Nov 2018 00:01:27 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 8 Nov 2018 00:01:25 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Nov 2018 00:01:40 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Nov 2018 00:02:09 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Nov 2018 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 4 Nov 2018 00:02:20 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Nov 2018 00:02:35 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Nov 2018 00:02:00 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Nov 2018 00:01:36 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 31 Oct 2018 00:01:30 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Oct 2018 00:01:45 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Oct 2018 00:01:26 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Oct 2018 00:02:48 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Oct 2018 00:02:03 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Oct 2018 00:01:46 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Oct 2018 00:02:14 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Oct 2018 00:02:06 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 23 Oct 2018 00:02:11 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 22 Oct 2018 00:01:58 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 21 Oct 2018 00:02:09 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 20 Oct 2018 00:01:41 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 19 Oct 2018 00:01:51 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Oct 2018 00:02:16 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Oct 2018 00:02:07 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Oct 2018 00:01:36 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Oct 2018 00:01:33 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Oct 2018 00:02:19 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Oct 2018 00:01:51 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Oct 2018 00:01:26 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Oct 2018 00:01:45 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Oct 2018 00:01:31 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Oct 2018 00:02:09 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Oct 2018 00:01:19 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Oct 2018 00:02:41 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Oct 2018 00:01:08 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 5 Oct 2018 00:01:54 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 4 Oct 2018 00:01:28 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 3 Oct 2018 00:01:25 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 2 Oct 2018 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 1 Oct 2018 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 30 Sep 2018 00:02:14 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 29 Sep 2018 00:01:52 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 28 Sep 2018 00:01:33 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 27 Sep 2018 00:01:22 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Sep 2018 00:01:55 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Sep 2018 00:01:45 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Sep 2018 00:01:19 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Sep 2018 00:02:02 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Sep 2018 00:01:07 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Sep 2018 00:01:51 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Sep 2018 00:02:12 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 19 Sep 2018 00:01:26 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Sep 2018 00:01:12 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agopython: Make gdb.execute("show commands") work (PR 23669)
Simon Marchi [Mon, 17 Sep 2018 12:26:24 +0000 (08:26 -0400)] 
python: Make gdb.execute("show commands") work (PR 23669)

Since commit

  56bcdbea2bed ("Let gdb.execute handle multi-line commands")

trying to use a command like gdb.execute("show commands") in Python
fails.  GDB ends up trying to run the "commands" command.

The reason is that GDB gets confused with the special "commands"
command.  In process_next_line, the lookup_cmd_1 function returns the
cmd_list_element representing the "commands" sub-command of "show".
Lower, we check the cmd_list_element to see if it matches various
control commands by name, including the "commands" command.  This is
where we wrongfully conclude that the executed command must be
"commands", when in reality it was "show commands".

The fix proposed in this patch removes the comparisons by name, instead
comparing the cmd_list_element object by pointer with the objects
created at initialization time.

Tested on the buildbot, though on a single builder (Fedora-x86_64-m64).

gdb/ChangeLog:

PR python/23669
* breakpoint.c (commands_cmd_element): New.
(_initialize_breakpoint): Assign commands_cmd_element.
* breakpoint.h (commands_cmd_element): New.
* cli/cli-script.c (while_cmd_element, if_command,
define_cmd_element): New.
(command_name_equals): Remove.
(process_next_line): Compare commands by pointer, not by name.
(_initialize_cli_script): Assign the various cmd_list_element
variables.
* compile/compile.c (compile_cmd_element): New.
(_initialize_compile): Assign compile_cmd_element.
* compile/compile.h (compile_cmd_element): New.
* guile/guile.c (guile_cmd_element): New.
(install_gdb_commands): Assign guile_cmd_element.
* guile/guile.h (guile_cmd_element): New.
* python/python.c (python_cmd_element): New.
(_initialize_python): Assign python_cmd_element.
* python/python.h (python_cmd_element): New.
* tracepoint.c (while_stepping_cmd_element): New.
(_initialize_tracepoint): Assign while_stepping_cmd_element.
* tracepoint.h (while_stepping_cmd_element): New.

gdb/testsuite/ChangeLog:

PR python/23669
* gdb.python/python.exp: Test gdb.execute("show commands").

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Sep 2018 00:01:42 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Sep 2018 00:02:07 +0000 (00:02 +0000)] 
Automatic date update in version.in

6 years agoMove 'is_regular_file' from common-utils.c to filestuff.c
Sergio Durigan Junior [Sat, 15 Sep 2018 20:40:13 +0000 (16:40 -0400)] 
Move 'is_regular_file' from common-utils.c to filestuff.c

There is no reason for 'is_regular_file' to be in common-utils.c; it
belongs to 'filestuff.c'.  This commit moves the function definition
and its prototype to the appropriate files.

The motivation behind this move is a failure that happens on certain
cross-compilation environments when compiling the IPA library, due to
the way gnulib probes the need for a 'stat' call replacement.  Because
configure checks when cross-compiling are more limited, gnulib decides
that it needs to substitute the 'stat' calls its own 'rpl_stat';
however, the IPA library doesn't link with gnulib, which leads to an
error when compiling 'common-utils.c':

  ...
  /opt/x86-core2--musl--bleeding-edge-2018.09-1/bin/i686-buildroot-linux-musl-g++  -shared -fPIC -Wl,--soname=libinproctrace.so -Wl,--no-undefined -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os      -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/import -Ibuild-gnulib-gdbserver/import -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized  -DGDBSERVER \
   -Wl,--dynamic-list=./proc-service.list -o libinproctrace.so ax-ipa.o common-utils-ipa.o errors-ipa.o format-ipa.o print-utils-ipa.o regcache-ipa.o remote-utils-ipa.o rsp-low-ipa.o tdesc-ipa.o tracepoint-ipa.o utils-ipa.o vec-ipa.o linux-i386-ipa.o linux-x86-tdesc-ipa.o arch/i386-ipa.o -ldl -pthread
  /opt/x86-core2--musl--bleeding-edge-2018.09-1/lib/gcc/i686-buildroot-linux-musl/8.2.0/../../../../i686-buildroot-linux-musl/bin/ld: common-utils-ipa.o: in function `is_regular_file(char const*, int*)':
  common-utils.c:(.text+0x695): undefined reference to `rpl_stat'
  collect2: error: ld returned 1 exit status
  Makefile:413: recipe for target 'libinproctrace.so' failed
  make[1]: *** [libinproctrace.so] Error 1
  ...

More details can also be found at:

  https://sourceware.org/ml/gdb-patches/2018-09/msg00304.html

The most simple fix for this problem is to move 'is_regular_file' to
'filestuff.c', which is not used by IPA.  This ends up making the
files more logically organized as well, since 'is_regular_file' is a
file operation.

No regressions found.

gdb/ChangeLog:
2018-09-15  Sergio Durigan Junior  <sergiodj@redhat.com>

PR gdb/23663
* common/common-utils.c: Don't include '<sys/stat.h>'.
(is_regular_file): Move to...
* common/filestuff.c (is_regular_file): ... here.
* common/common-utils.h (is_regular_file): Move to...
* common/filestuff.h (is_regular_file): ... here.