Age | Commit message (Collapse) | Author | Files | Lines |
|
While trying to create skips for libstdc++, I found myself debugging GDB
quite a bit, mostly to find out what the exact function name to match
is. I thought it would make sense to have this information as debug
output.
This patch adds "set debug skip on|off".
gdb/ChangeLog:
* skip.c (debug_skip): New variable.
(skiplist_entry::do_skip_file_p): Add debug output.
(skiplist_entry::do_skip_gfile_p): Likewise.
(skiplist_entry::skip_function_p): Likewise.
(_initialize_step_skip): Create debug command.
* NEWS: Mention set/show debug skip.
gdb/doc/ChangeLog:
* gdb.texinfo (Skipping Over Functions and Files): Document
set/show debug skip.
|
|
On Mac OS X Sierra and later, the shell is not allowed to be
debug so add a check and disable startup with shell in that
case. This disabling is done temporary before forking
inferior and restored after the fork.
gdb/ChangeLog:
* darwin-nat.c (should_disable_startup_with_shell):
New function.
(darwin_nat_target::create_inferior): Add call.
Change-Id: Ie4d9090f65fdf2e83ecf7a0f9d0647fb1c27cdcc
|
|
Debugging a program under Darwin does not work:
(gdb) start
Temporary breakpoint 1 at 0x100000fb4: file /tmp/helloworld.c, line 1.
Starting program: /private/tmp/helloworld
[New Thread 0x2903 of process 60326]
During startup program terminated with signal SIGTRAP, Trace/breakpoint
trap.
Field signaled from darwin_thread_info is not initialized thus signal
sent to the debuggee is considered as not sent by GDB whereas it should.
This patch fixes this problem and also updates (change type and/or
initialize) other fields in the same structure at the same time.
gdb/ChangeLog:
* darwin-nat.h (struct darwin_thread_info) <gdb_port,
inf_port, msg_state>: Initialize.
(struct darwin_thread_info) <signaled, single_step>: Change
type and initialize.
(struct darwin_thread_info) <event>: Initialize.
Change-Id: I0fe2a6985df9d0dfcc8a2a258a3ef70cfa19b403
|
|
This is a backport of a gnulib fix for the following bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=23558
The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB. With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.
The solution is to backport the following gnulib commit:
commit a96d2e67052c879b1bcc5bc461722beac75fc372
Author: Bruno Haible <bruno@clisp.org>
Date: Thu Aug 23 21:13:19 2018 +0200
getcwd: Add cross-compilation guesses.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation
guesses.
|
|
This reverts commit 7a6dbc2fdb2323c35e981f93236f323e9d7c0b24 ("Update
gnulib to current upstream master"). It is needed because the gnulib
update caused problems with people using old GCC compilers (version
4.8, for example), which support C99 but don't default to using it.
Unfortunately this broke GDB for these users. A more detailed report
of what happened can be found at:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00157.html
The reason for updating our gnulib copy was to fix PR gdb/23558.
Reverting this patch reintroduces the bug, so in order to fix it I
will submit a subsequent patch which cherry-picks the fix from gnulib.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
Revert:
2018-08-29 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/extra/snippet/_Noreturn.h: Rename to...
* gnulib/import/_Noreturn.h: ... this.
* gnulib/import/alloca.in.h: Update.
* gnulib/import/extra/snippet/arg-nonnull.h: Rename to...
* gnulib/import/arg-nonnull.h: ... this.
* gnulib/import/assure.h: Update.
* gnulib/import/at-func.c: Update.
* gnulib/import/basename-lgpl.c: Update.
* gnulib/import/extra/snippet/c++defs.h: Rename to...
* gnulib/import/c++defs.h: ... this.
* gnulib/import/canonicalize-lgpl.c: Update.
* gnulib/import/cdefs.h: Update.
* gnulib/import/chdir-long.c: Update.
* gnulib/import/chdir-long.h: Update.
* gnulib/import/cloexec.c: Update.
* gnulib/import/cloexec.h: Update.
* gnulib/import/close.c: Update.
* gnulib/import/closedir.c: Update.
* gnulib/import/config.charset: Update.
* gnulib/import/dirent-private.h: Update.
* gnulib/import/dirent.in.h: Update.
* gnulib/import/dirfd.c: Update.
* gnulib/import/dirname-lgpl.c: Update.
* gnulib/import/dirname.h: Update.
* gnulib/import/dosname.h: Update.
* gnulib/import/dup-safer-flag.c: Update.
* gnulib/import/dup-safer.c: Update.
* gnulib/import/dup.c: Update.
* gnulib/import/dup2.c: Update.
* gnulib/import/errno.in.h: Update.
* gnulib/import/error.c: Update.
* gnulib/import/error.h: Update.
* gnulib/import/exitfail.c: Update.
* gnulib/import/exitfail.h: Update.
* gnulib/import/extra/update-copyright: Update.
* gnulib/import/fchdir.c: Update.
* gnulib/import/fcntl.c: Update.
* gnulib/import/fcntl.in.h: Update.
* gnulib/import/fd-hook.c: Update.
* gnulib/import/fd-hook.h: Update.
* gnulib/import/fd-safer-flag.c: Update.
* gnulib/import/fd-safer.c: Update.
* gnulib/import/fdopendir.c: Update.
* gnulib/import/filename.h: Update.
* gnulib/import/filenamecat-lgpl.c: Update.
* gnulib/import/filenamecat.h: Update.
* gnulib/import/flexmember.h: Update.
* gnulib/import/float+.h: Update.
* gnulib/import/float.c: Update.
* gnulib/import/float.in.h: Update.
* gnulib/import/fnmatch.c: Update.
* gnulib/import/fnmatch.in.h: Update.
* gnulib/import/fnmatch_loop.c: Update.
* gnulib/import/fpucw.h: Update.
* gnulib/import/frexp.c: Update.
* gnulib/import/frexpl.c: Update.
* gnulib/import/fstat.c: Update.
* gnulib/import/fstatat.c: Update.
* gnulib/import/getcwd-lgpl.c: Update.
* gnulib/import/getcwd.c: Update.
* gnulib/import/getdtablesize.c: Update.
* gnulib/import/getlogin_r.c: Update.
* gnulib/import/getprogname.c: Update.
* gnulib/import/getprogname.h: Update.
* gnulib/import/gettext.h: Update.
* gnulib/import/gettimeofday.c: Update.
* gnulib/import/glob-libc.h: Update.
* gnulib/import/glob.c: Update.
* gnulib/import/glob.in.h: Update.
* gnulib/import/glob_internal.h: Update.
* gnulib/import/glob_pattern_p.c: Update.
* gnulib/import/globfree.c: Update.
* gnulib/import/hard-locale.c: Update.
* gnulib/import/hard-locale.h: Update.
* gnulib/import/intprops.h: Update.
* gnulib/import/inttypes.in.h: Update.
* gnulib/import/isnan.c: Update.
* gnulib/import/isnand-nolibm.h: Update.
* gnulib/import/isnand.c: Update.
* gnulib/import/isnanl-nolibm.h: Update.
* gnulib/import/isnanl.c: Update.
* gnulib/import/itold.c: Update.
* gnulib/import/libc-config.h: Update.
* gnulib/import/limits.in.h: Update.
* gnulib/import/localcharset.c: Update.
* gnulib/import/localcharset.h: Update.
* gnulib/import/localtime-buffer.c: Update.
* gnulib/import/localtime-buffer.h: Update.
* gnulib/import/lstat.c: Update.
* gnulib/import/m4/00gnulib.m4: Update.
* gnulib/import/m4/__inline.m4: Update.
* gnulib/import/m4/absolute-header.m4: Update.
* gnulib/import/m4/alloca.m4: Update.
* gnulib/import/m4/builtin-expect.m4: Update.
* gnulib/import/m4/canonicalize.m4: Update.
* gnulib/import/m4/chdir-long.m4: Update.
* gnulib/import/m4/close.m4: Update.
* gnulib/import/m4/closedir.m4: Update.
* gnulib/import/m4/configmake.m4: Update.
* gnulib/import/m4/d-ino.m4: Update.
* gnulib/import/m4/d-type.m4: Update.
* gnulib/import/m4/dirent_h.m4: Update.
* gnulib/import/m4/dirfd.m4: Update.
* gnulib/import/m4/dirname.m4: Update.
* gnulib/import/m4/double-slash-root.m4: Update.
* gnulib/import/m4/dup.m4: Update.
* gnulib/import/m4/dup2.m4: Update.
* gnulib/import/m4/eealloc.m4: Update.
* gnulib/import/m4/environ.m4: Update.
* gnulib/import/m4/errno_h.m4: Update.
* gnulib/import/m4/error.m4: Update.
* gnulib/import/m4/exponentd.m4: Update.
* gnulib/import/m4/exponentl.m4: Update.
* gnulib/import/m4/extensions.m4: Update.
* gnulib/import/m4/extern-inline.m4: Update.
* gnulib/import/m4/fchdir.m4: Update.
* gnulib/import/m4/fcntl-o.m4: Update.
* gnulib/import/m4/fcntl.m4: Update.
* gnulib/import/m4/fcntl_h.m4: Update.
* gnulib/import/m4/fdopendir.m4: Update.
* gnulib/import/m4/filenamecat.m4: Update.
* gnulib/import/m4/flexmember.m4: Update.
* gnulib/import/m4/float_h.m4: Update.
* gnulib/import/m4/fnmatch.m4: Update.
* gnulib/import/m4/fnmatch_h.m4: Update.
* gnulib/import/m4/fpieee.m4: Update.
* gnulib/import/m4/frexp.m4: Update.
* gnulib/import/m4/frexpl.m4: Update.
* gnulib/import/m4/fstat.m4: Update.
* gnulib/import/m4/fstatat.m4: Update.
* gnulib/import/m4/getcwd-abort-bug.m4: Update.
* gnulib/import/m4/getcwd-path-max.m4: Update.
* gnulib/import/m4/getcwd.m4: Update.
* gnulib/import/m4/getdtablesize.m4: Update.
* gnulib/import/m4/getlogin.m4: Update.
* gnulib/import/m4/getlogin_r.m4: Update.
* gnulib/import/m4/getpagesize.m4: Update.
* gnulib/import/m4/getprogname.m4: Update.
* gnulib/import/m4/gettimeofday.m4: Update.
* gnulib/import/m4/glibc21.m4: Update.
* gnulib/import/m4/glob.m4: Update.
* gnulib/import/m4/glob_h.m4: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-common.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/gnulib-tool.m4: Update.
* gnulib/import/m4/hard-locale.m4: Update.
* gnulib/import/m4/include_next.m4: Update.
* gnulib/import/m4/inttypes-pri.m4: Update.
* gnulib/import/m4/inttypes.m4: Update.
* gnulib/import/m4/isnand.m4: Update.
* gnulib/import/m4/isnanl.m4: Update.
* gnulib/import/m4/largefile.m4: Update.
* gnulib/import/m4/limits-h.m4: Update.
* gnulib/import/m4/localcharset.m4: Update.
* gnulib/import/m4/locale-fr.m4: Update.
* gnulib/import/m4/locale-ja.m4: Update.
* gnulib/import/m4/locale-zh.m4: Update.
* gnulib/import/m4/localtime-buffer.m4: Update.
* gnulib/import/m4/longlong.m4: Update.
* gnulib/import/m4/lstat.m4: Update.
* gnulib/import/m4/malloc.m4: Update.
* gnulib/import/m4/malloca.m4: Update.
* gnulib/import/m4/math_h.m4: Update.
* gnulib/import/m4/mbrtowc.m4: Update.
* gnulib/import/m4/mbsinit.m4: Update.
* gnulib/import/m4/mbsrtowcs.m4: Update.
* gnulib/import/m4/mbstate_t.m4: Update.
* gnulib/import/m4/memchr.m4: Update.
* gnulib/import/m4/memmem.m4: Update.
* gnulib/import/m4/mempcpy.m4: Update.
* gnulib/import/m4/memrchr.m4: Update.
* gnulib/import/m4/mkdir.m4: Update.
* gnulib/import/m4/mkstemp.m4: Update.
* gnulib/import/m4/mmap-anon.m4: Update.
* gnulib/import/m4/mode_t.m4: Update.
* gnulib/import/m4/msvc-inval.m4: Update.
* gnulib/import/m4/msvc-nothrow.m4: Update.
* gnulib/import/m4/multiarch.m4: Update.
* gnulib/import/m4/nocrash.m4: Update.
* gnulib/import/m4/off_t.m4: Update.
* gnulib/import/m4/onceonly.m4: Update.
* gnulib/import/m4/open-cloexec.m4: Update.
* gnulib/import/m4/open.m4: Update.
* gnulib/import/m4/openat.m4: Update.
* gnulib/import/m4/opendir.m4: Update.
* gnulib/import/m4/pathmax.m4: Update.
* gnulib/import/m4/rawmemchr.m4: Update.
* gnulib/import/m4/readdir.m4: Update.
* gnulib/import/m4/readlink.m4: Update.
* gnulib/import/m4/realloc.m4: Update.
* gnulib/import/m4/rename.m4: Update.
* gnulib/import/m4/rewinddir.m4: Update.
* gnulib/import/m4/rmdir.m4: Update.
* gnulib/import/m4/save-cwd.m4: Update.
* gnulib/import/m4/secure_getenv.m4: Update.
* gnulib/import/m4/setenv.m4: Update.
* gnulib/import/m4/signal_h.m4: Update.
* gnulib/import/m4/ssize_t.m4: Update.
* gnulib/import/m4/stat-time.m4: Update.
* gnulib/import/m4/stat.m4: Update.
* gnulib/import/m4/std-gnu11.m4: Update.
* gnulib/import/m4/stdbool.m4: Update.
* gnulib/import/m4/stddef_h.m4: Update.
* gnulib/import/m4/stdint.m4: Update.
* gnulib/import/m4/stdio_h.m4: Update.
* gnulib/import/m4/stdlib_h.m4: Update.
* gnulib/import/m4/strchrnul.m4: Update.
* gnulib/import/m4/strdup.m4: Update.
* gnulib/import/m4/strerror.m4: Update.
* gnulib/import/m4/string_h.m4: Update.
* gnulib/import/m4/strstr.m4: Update.
* gnulib/import/m4/strtok_r.m4: Update.
* gnulib/import/m4/sys_socket_h.m4: Update.
* gnulib/import/m4/sys_stat_h.m4: Update.
* gnulib/import/m4/sys_time_h.m4: Update.
* gnulib/import/m4/sys_types_h.m4: Update.
* gnulib/import/m4/tempname.m4: Update.
* gnulib/import/m4/time_h.m4: Update.
* gnulib/import/m4/unistd-safer.m4: Update.
* gnulib/import/m4/unistd_h.m4: Update.
* gnulib/import/m4/warn-on-use.m4: Update.
* gnulib/import/m4/wchar_h.m4: Update.
* gnulib/import/m4/wchar_t.m4: Update.
* gnulib/import/m4/wctype_h.m4: Update.
* gnulib/import/m4/wint_t.m4: Update.
* gnulib/import/malloc.c: Update.
* gnulib/import/malloc/scratch_buffer.h: Update.
* gnulib/import/malloc/scratch_buffer_grow.c: Update.
* gnulib/import/malloc/scratch_buffer_grow_preserve.c: Update.
* gnulib/import/malloc/scratch_buffer_set_array_size.c: Update.
* gnulib/import/malloca.c: Update.
* gnulib/import/malloca.h: Update.
* gnulib/import/malloca.valgrind: Update.
* gnulib/import/math.in.h: Update.
* gnulib/import/mbrtowc.c: Update.
* gnulib/import/mbsinit.c: Update.
* gnulib/import/mbsrtowcs-impl.h: Update.
* gnulib/import/mbsrtowcs-state.c: Update.
* gnulib/import/mbsrtowcs.c: Update.
* gnulib/import/memchr.c: Update.
* gnulib/import/memmem.c: Update.
* gnulib/import/mempcpy.c: Update.
* gnulib/import/memrchr.c: Update.
* gnulib/import/mkdir.c: Update.
* gnulib/import/mkstemp.c: Update.
* gnulib/import/msvc-inval.c: Update.
* gnulib/import/msvc-inval.h: Update.
* gnulib/import/msvc-nothrow.c: Update.
* gnulib/import/msvc-nothrow.h: Update.
* gnulib/import/open.c: Update.
* gnulib/import/openat-die.c: Update.
* gnulib/import/openat-priv.h: Update.
* gnulib/import/openat-proc.c: Update.
* gnulib/import/openat.c: Update.
* gnulib/import/openat.h: Update.
* gnulib/import/opendir.c: Update.
* gnulib/import/pathmax.h: Update.
* gnulib/import/pipe-safer.c: Update.
* gnulib/import/rawmemchr.c: Update.
* gnulib/import/readdir.c: Update.
* gnulib/import/readlink.c: Update.
* gnulib/import/realloc.c: Update.
* gnulib/import/ref-add.sin: Update.
* gnulib/import/ref-del.sin: Update.
* gnulib/import/rename.c: Update.
* gnulib/import/rewinddir.c: Update.
* gnulib/import/rmdir.c: Update.
* gnulib/import/same-inode.h: Update.
* gnulib/import/save-cwd.c: Update.
* gnulib/import/save-cwd.h: Update.
* gnulib/import/scratch_buffer.h: Update.
* gnulib/import/secure_getenv.c: Update.
* gnulib/import/setenv.c: Update.
* gnulib/import/signal.in.h: Update.
* gnulib/import/stat-time.c: Update.
* gnulib/import/stat-time.h: Update.
* gnulib/import/stat-w32.c: Update.
* gnulib/import/stat-w32.h: Update.
* gnulib/import/stat.c: Update.
* gnulib/import/stdbool.in.h: Update.
* gnulib/import/stddef.in.h: Update.
* gnulib/import/stdint.in.h: Update.
* gnulib/import/stdio.in.h: Update.
* gnulib/import/stdlib.in.h: Update.
* gnulib/import/str-two-way.h: Update.
* gnulib/import/strchrnul.c: Update.
* gnulib/import/strdup.c: Update.
* gnulib/import/streq.h: Update.
* gnulib/import/strerror-override.c: Update.
* gnulib/import/strerror-override.h: Update.
* gnulib/import/strerror.c: Update.
* gnulib/import/string.in.h: Update.
* gnulib/import/stripslash.c: Update.
* gnulib/import/strnlen1.c: Update.
* gnulib/import/strnlen1.h: Update.
* gnulib/import/strstr.c: Update.
* gnulib/import/strtok_r.c: Update.
* gnulib/import/sys_stat.in.h: Update.
* gnulib/import/sys_time.in.h: Update.
* gnulib/import/sys_types.in.h: Update.
* gnulib/import/tempname.c: Update.
* gnulib/import/tempname.h: Update.
* gnulib/import/time.in.h: Update.
* gnulib/import/unistd--.h: Update.
* gnulib/import/unistd-safer.h: Update.
* gnulib/import/unistd.in.h: Update.
* gnulib/import/unsetenv.c: Update.
* gnulib/import/verify.h: Update.
* gnulib/import/extra/snippet/warn-on-use.h: Update.
* gnulib/import/wchar.in.h: Update.
* gnulib/import/wctype.in.h: Update.
* gnulib/import/xalloc-oversized.h: Update.
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
"53e2c179f26a890fa6685af4b6c1397ee370433b".
|
|
old_inferior_ptid is unused, this is caught by a gcc built from git
recently, not sure about previous versions:
/home/emaisin/src/binutils-gdb/gdb/record-btrace.c: In function ‘frame_info* get_thread_current_frame(thread_info*)’:
/home/emaisin/src/binutils-gdb/gdb/record-btrace.c:1974:10: error: unused variable ‘old_inferior_ptid’ [-Werror=unused-variable]
1974 | ptid_t old_inferior_ptid;
| ^~~~~~~~~~~~~~~~~
gdb/ChangeLog:
* record-btrace.c (get_thread_current_frame): Remove
old_inferior_ptid.
|
|
ada_value_struct_elt is used when displaying a component (say, 'N') of
a record object (say, 'Obj') of type, say, 't1'. Now if Obj is tagged
(Ada parlance: "tagged types" are what other object-oriented languages
call "classes"), then 'N' may not be visible in the current view and
we need to look for it in its actual type. We do that at the same time
as resolving variable-length fields. This would typically be done by
the following call to ada_value_struct_elt, with the last parameter
check_tag set to 1:
t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL,
address, NULL, 1);
This is the general logic, but recently we introduced a special case
to handle homonyms. Different components may have the same name in a
tagged type. For instance:
type Top_T is tagged record
N : Integer := 1;
end record;
type Middle_T is new Top.Top_T with record
N : Character := 'a';
end record;
Middle_T extends Top_T and both define a (different) component with
the same name ('N'). In such a case, using the actual type of a
Middle_T object would create a confusion, since we would have two
component 'N' in this actual type.
So, to handle homonyms, we convert t1 to the actual type *if
and only if* N cannot be found in the current view. For example, if Obj
has been created as a Middle_T but is seen as a Top_T'Class at our
point of execution, then "print Obj.N" will display the integer field
defined in Top_T's declaration.
Now, even if we find N in the current view, we still have to get a
fixed type: for instance, the record can be unconstrained and we still
need a fixed type to get the proper offset to each field. That is
to say, in this case:
type Dyn_Top_T (Disc : Natural) is tagged record
S : Integer_Array (1 .. Disc) := (others => Disc);
N : Integer := 1;
end record;
type Dyn_Middle_T is new Dyn_Top.Dyn_Top_T with record
N : Character := 'a';
U : Integer := 42;
end record;
If we have an object Obj of type Dyn_Middle_T and we want to display
U, we don't need to build, from its tag, a real type with all its real
fields. In other words, we don't need to add the parent components:
Disc, S, and the integer N. We only need to access U and it is
directly visible in Dyn_Middle_T. So no tag handling. However, we do
need to build a fixed-size type to have the proper offset to U (since
this offset to U depends on the size of Obj.S, which itself is dynamic
and depends on the value of Obj.Disc).
We accidentally lost some of this treatment when we introduced the
resolution of homonyms. This patch re-install this part by uncoupling
the tag resolution from the "fixing" of variable-length components.
This change also slightly simplifies the non-tagged case: in the
non-tagged case, no need to set check_tag to 1, since we already know
that there is no tag.
gdb/ChangeLog:
* ada-lang.c (ada_value_struct_elt): Call ada_to_fixed_type
with check_tag to 1 if and only if the type is tagged and the
component being searched cannot been found in the current
view. Otherwise, always call ada_to_fixed_type with
check_tag to 0.
gdb/testsuite/ChangeLog:
* gdb.ada/same_component_name: Add test for case of tagged record
with variable-length fields.
|
|
This patch just avoids code duplication by using a function we
introduced recently (ada_is_access_to_unconstrained_array).
gdb/ChangeLog:
* ada-lang.c (ada_is_access_to_unconstrained_array): Remove static
declaration.
* ada-lang.h: add ada_is_access_to_unconstrained_array prototype.
* ada-varobj.c (ada_varobj_get_number_of_children,
ada_varobj_describe_child, ada_value_is_changeable_p): Cleanup code.
Tested on x86_64-linux.
No new testcase provided, as this is just a refactoring.
|
|
Using this Ada code:
type String_Access is access String;
type Array_Of_String is array (1 .. 2) of String_Access;
Aos : Array_Of_String := (new String'("ab"), new String'("cd"));
When debugging with GDB, printing each Aos element displays:
(gdb) print Aos(1)
$2 = "ab"
(gdb) print Aos(2)
$3 = "cd"
Whereas it should display:
(gdb) print Aos(1)
$2 = (foo_r118_024.string_access) 0x635018
(gdb) print Aos(2)
$3 = (foo_r118_024.string_access) 0x635038
Notice that printing the entire array works:
(gdb) print Aos
$1 = (0x635018, 0x635038)
The problem was located in ada_value_print function and due to the fact
that the value_type used in this function was based on
value_enclosing_type rather than value_type itself.
In our example, the difference between the value_type and the
value_enclosing_type of the value is that the value_type contains an
additional typedef layer which is not present in the value_enclosing_type.
This typedef layer is GNAT's way to specify that the element is, at the
source level, an access to the unconstrained array, rather than the
unconstrained array.
Moreover, the value_enclosing_type is not really needed in that case and
the value_type can be used instead in this function, and this patch fixes
this.
gdb/ChangeLog:
* ada-valprint.c (ada_value_print): Use type instead of
enclosing type.
testsuite/ChangeLog:
* gdb.ada/access_to_unbounded_array.exp: New testcase.
* gdb.ada/access_to_unbounded_array/foo.adb: New file.
* gdb.ada/access_to_unbounded_array/pack.adb: New file.
* gdb.ada/access_to_unbounded_array/pack.ads: New file.
Tested: x86_64-linux
|
|
Using this Ada code:
type String_Access is access String;
type Array_Of_String is array (1 .. 2) of String_Access;
Aos : Array_Of_String := (new String'("ab"), new String'("cd"));
In GDB/MI mode, create a variable which type is Aos, evaluate it:
(gdb) -var-create var1 * Aos
^done,name="var1",numchild="2",value="[2]",type="bar.array_of_string",thread-id="1",has_more="0"
Now print it:
(gdb) -var-list-children 1 var1
^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="[2] \"ab\"", type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="[2] \"cd\"", type="bar.string_access",thread-id="1"}],has_more="0"
But printed fields "value" are wrong, since it should be:
^done,numchild="2",children=[child={name="var1.1",exp="1",numchild="1",value="0x634018",type="bar.string_access",thread-id="1"},child={name="var1.2",exp="2",numchild="1",value="0x634038",type="bar.string_access",thread-id="1"}],has_more="0"^M
Print each child of var1:
(gdb) -var-evaluate-expression var1.1
^done,value="[2] \"ab\""
(gdb) -var-evaluate-expression var1.2
^done,value="[2] \"cd\""
Whereas it should be
(gdb) -var-evaluate-expression var1.1
^done,value="0x635018"
(gdb) -var-evaluate-expression var1.2
^done,value="0x635038"
This patch fixes this.
gdb/ChangeLog:
* ada-lang.c (ada_value_subscript): Handle case when parameter is
an array of access to unconstrained array.
testsuite/ChangeLog
* gdb.ada/mi_string_access.exp: New testcase.
* gdb.ada/mi_string_access/bar.adb: New file.
* gdb.ada/mi_string_access/pck.adb: New file.
* gdb.ada/mi_string_access/pck.asd: New file.
Tested on x86_64-linux.
|
|
Add a new function to check if a given type is an access to an
unconstrained array. This function contains code that is present only
once in the current sources but will be used in a future patch.
gdb/ChangeLog:
* ada-lang.c (ada_is_access_to_unconstrained_array): New function.
(ada_check_typedef): Use it.
Tested on x86_64-linux.
|
|
Using this Ada code:
type Union_Type (A : Boolean := False) is record
case A is
when True => B : Integer;
when False => C : Float;
end case;
end record;
pragma Unchecked_Union (Union_Type);
Ut : Union_Type := (A => True, B => 3);
In GDB/MI mode, once creating a varobj from variable "Ut" as follow:
(gdb) -var-create var1 * ut
^done,name="var1",numchild="2",value="{...}",type="foo.union_type",thread-id="1",has_more="0"
Printing the list of its children displays:
(gdb) -var-list-children 1 var1
^error,msg="Duplicate variable object name"
Whereas it should be
(gdb) -var-list-children 1 var1
^done,numchild="2",children=[child={name="var1.b",exp="b",numchild="0",value="3",type="integer",thread-id="1"},child={name="var1.c",exp="c",numchild="0",value="4.20389539e-45",type="float",thread-id="1"}],has_more="0"
The problem occurs because ada_varobj_describe_struct_child wasn't
handling unions. This patch fixes this.
gdb/ChangeLog:
* ada-varobj.c (ada_varobj_describe_struct_child)
(ada_varobj_describe_child): Handle union case like struct one.
testsuite/ChangeLog
* gdb.ada/mi_var_union.exp: New testcase.
* gdb.ada/mi_var_union/bar.adb: New file.
* gdb.ada/mi_var_union/pck.adb: New file.
* gdb.ada/mi_var_union/pck.asd: New file.
Tested on x86_64-linux.
|
|
PR python/18380 points out that the example in the "help python" text
will only work in Python 2. This changes the example to be valid
syntax for both Python 2 and Python 3.
gdb/ChangeLog
2018-09-10 Tom Tromey <tom@tromey.com>
PR python/18380:
* python/python.c (_initialize_python): Make example in "python"
help work in Python 3.
|
|
gdb/ChangeLog:
2018-09-10 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (transformed_name): Use INSTALL_SCRIPT instead of
INSTALL_PROGRAM to install gdb-add-index.sh. Don't append
$(EXEEXT) to the script, as it is not a program.
|
|
I noticed that we release a gdbpy_ref in pretty_print_one_value only to
create it again later. This patch fills the gap by returning a
gdbpy_ref all the way.
gdb/ChangeLog:
* python/py-prettyprint.c (pretty_print_one_value): Return
gdbpy_ref<>.
(print_string_repr): Adjust.
(apply_varobj_pretty_printer): Return gdbpy_ref<>.
* python/python-internal.h (apply_varobj_pretty_printer): Return
gdbpy_ref<>.
* varobj.c (varobj_value_get_print_value): Adjust.
|
|
PR python/16047 points out that, while the documentation says that the
to_string method is optional for a pretty-printer, the code disagrees
and throws an exception. This patch fixes the problem. varobj is
already ok here.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-09-08 Tom Tromey <tom@tromey.com>
PR python/16047:
* python/py-prettyprint.c (pretty_print_one_value): Check for
to_string method.
gdb/testsuite/ChangeLog
2018-09-08 Tom Tromey <tom@tromey.com>
PR python/16047:
* gdb.python/py-prettyprint.py (pp_int_typedef3): New class.
(register_pretty_printers): Register new printer.
* gdb.python/py-prettyprint.exp (run_lang_tests): Add int_type3
test.
* gdb.python/py-prettyprint.c (int_type3): New typedef.
(an_int_type3): New global.
|
|
Consider the following function, which takes no parameter and returns
an integer:
function Something return Integer;
For the purpose of this discussion, our function has been implemented
to always return 124:
function Something return Integer is
begin
return 124;
end Something;
In Ada, such function can been called without using the parentheses.
For instance, in the statement below, variable My_Value is assigned
the returned value from the call to Something:
My_Value := Something;
The Ada expression interpeter in GDB supports this case, as we can
see below:
(gdb) print something
$1 = 124
However, we get fairly strange results when trying to use this feature
as part of a larger expression. For instance:
(gdb) print something + 1
$2 = 248
The problem occurs while doing the resolution pass of the expression.
After prefixying the expression, we obtain the following expression:
0 BINOP_ADD
1 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
5 OP_LONG Type @0x1e3c170 (int), value 1 (0x1)
The resolution pass is then expected to remove the OP_VAR_VALUE
entry, and replace it with an OP_FUNCALL. This is what the call
to replace_operator_with_call in ada-lang.c::resolve_subexp is
expected to do:
if (deprocedure_p
&& (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol))
== TYPE_CODE_FUNC))
{
replace_operator_with_call (expp, pc, 0, 0,
exp->elts[pc + 2].symbol,
exp->elts[pc + 1].block);
exp = expp->get ();
}
The problem is that we're passing OPLEN (zero -- 4th parameter in
the call), and so replace_operator_with_call ends up removing zero
element from our expression, and inserting the corresponding OP_FUNCALL
instead. As a result, instead of having the OP_LONG (1) as the second
argument of the BINOP_ADD, it is now the OP_VAR_VALUE that we were
meant to replace. That OP_VAR_VALUE then itself gets transformed into
an OP_FUNCALL, with the same issue, and eventually, the resolved
expression now looks like this:
0 BINOP_ADD
1 OP_FUNCALL Number of args: 0
4 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
8 OP_FUNCALL Number of args: 0
11 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
15 OP_VAR_VALUE Block @0x2021550, symbol @0x20213a0 (pck.something)
19 OP_LONG Type @0x1e3c170 (int), value 1 (0x1)
This explains why we get twice the result of the function call
instead of its value plus one. The extra entries in the expression
at the end are just ignored.
This patch fixes the issue by calling replace_operator_with_call
with the correct OPLEN equal to the size of an OP_VAR_VALUE (4).
gdb/ChangeLog:
* ada-lang.c (resolve_subexp): Pass correct OPLEN in call to
replace_operator_with_call.
gdb/testsuite/ChangeLog:
* gdb.ada/expr_with_funcall: New testcase.
|
|
No other code change.
gdb/ChangeLog:
* ada-lang.c (ada_value_cast): Remove unnecessary parentheses.
|
|
Consider the following code:
type Enumerated is (Enum_A, Enum_B, Enum_C, Enum_Last);
type Table is array (Enumerated) of Integer;
-- Declare a variable of type Table to make sure the compiler
-- does emit the debugging information for that type.
V : Table := (others => 1);
Trying to print the type description of type Table, or of variable V
yields:
(gdb) ptype v
type = array (0 .. 3) of integer
(gdb) ptype example.table
type = array (0 .. 3) of integer
The compiler generates an XA type for the bounds...
<1><cf6>: Abbrev Number: 13 (DW_TAG_structure_type)
<cf7> DW_AT_name : example__table___XA
... whose member is described as being as:
<2><cfe>: Abbrev Number: 14 (DW_TAG_member)
<cff> DW_AT_name : example__enumerated
<d05> DW_AT_type : <0xc69>
This leads us to DIE 0xc69, which is our enumeration type:
<2><c69>: Abbrev Number: 4 (DW_TAG_enumeration_type)
<c6a> DW_AT_name : example__enumerated
Normally, for arrays, we expect a range type, rather than an enumerated
type. However, for a situation like this, where the range of the array
index is the full enumeration type, it seems like a waste to require
an extra range layer.
Instead, looking at print_range, we see that we print the bounds
of our range using the target type:
target_type = TYPE_TARGET_TYPE (type);
if (target_type == NULL)
target_type = type;
[...]
ada_print_scalar (target_type, lo, stream);
fprintf_filtered (stream, " .. ");
ada_print_scalar (target_type, hi, stream);
In this case, this causes us to use the enumerated type's subtype,
which is a plain integer type, hence the output we get. However,
there is no reason for using the target type, even in the TYPE_CODE_RANGE
situation. So this patch fixes the issue by simply printing the bounds
using the type being given, instead of its target type.
gdb/ChangeLog:
* ada-typeprint.c (print_range): Print the bounds using TYPE
rather than its TYPE_TARGET_TYPE.
A new test for this isn't necessary, as existing tests will demonstrate
this issue once a change in the compiler triggering the generation of
this type of debugging info gets pushed.
|
|
The arguments in the call to ada_to_fixed_value_create where
improperly aligned. But I also noticed that all the arguments
do fit on a single-line (up to 79 characters). So this patch
just fixes the code by putting everything on that same line.
gdb/ChangeLog:
* ada-lang.c (ada_to_fixed_value): Minor reformatting in
call to ada_to_fixed_value_create.
|
|
On PPC64, the entry point of the function "FN" is ".FN" when a function
descriptor is used. One of the consequences of this is that GDB then
presents the name of the function to the user (eg: in backtraces) with
the leading dot, which is a low-level internal detail that the user
should not be seeing. The Ada decoding should strip it.
gdb/ChangeLog:
* ada-lang.c (ada_decode): strip dot prefix in symbol name.
No testcase added, as a number of existing testcases should already
demonstrate that problem.
|
|
We noticed while debugging a program compiled without assertions
enabled and using an older compiler that inserting a catchpoint
on failed assertions would cause an internal error:
(gdb) catch assert
../../src/gdb/ada-lang.c:13321: internal-error: ada_exception_sal:
Assertion`sym != NULL' failed.
A problem internal to GDB has been detected,
This is due to a combination of factors:
1. With older versions of the compiler, the function used as a hook
was provided by a unit that's different from the unit which
provides the hooks for the other exception catchpoints.
2. The program either does not use any assertion, or is compiled
without the assertions enabled.
With newer versions of the compiler, all such functions are provided
by the same unit, so should normally always be available. However,
there can still be reasons why this is not the case. Consider, for
instance, the case of a runtime compiled with -ffunction-sections,
in which case the hook might be eliminated unless assertions are
used and enabled.
So this patch transforms the internal error into a simple error.
gdb/ChangeLog:
* ada-lang.c (ada_exception_sal): Replace gdb_assert calls
by calls to error.
No testcase added, as the existing testcase gdb.ada/catch_ex.exp
should trigger it when using an older version of GNAT as the Ada
compiler.
|
|
When debugging a program compiled with an older version of GNAT,
hitting a catchpoint on unhandled exceptions can caused GDB to
got into an infinite loop. This happens while trying to find
the name of the exception that was raised. For that, it searches
for a frame corresponding to a specific function we know gets
called during the exeption handling.
In our particular case, the compiler was too old, and so GDB never
found that frame, and eventually got past the "main" subprogram,
all the way to system frames, where no symbol was available.
As a result, the code addresses could not be resolved into
a function name, leading to the infinite loop because of
a misplaced update of our loop variable "fi":
while (fi != NULL)
{
char *func_name;
enum language func_lang;
find_frame_funname (fi, &func_name, &func_lang, NULL);
if (func_name != NULL)
{
make_cleanup (xfree, func_name);
if (strcmp (func_name,
data->exception_info->catch_exception_sym) == 0)
break; /* We found the frame we were looking for... */
fi = get_prev_frame (fi);
}
}
If FUNC_NAME is NULL, then FI never gets updated ever after!
gdb/ChangeLog:
* ada-lang.c (ada_unhandled_exception_name_addr_from_raise):
Move update of loop variable "fi".
No testcase added, as the existing testcase gdb.ada/catch_ex.exp
should trigger it when using an older version of GNAT as the Ada
compiler.
|
|
Consider a variable "PRA" defined as a packed array of packed
records as follow:
subtype Int is Integer range 0 .. 7;
type Packed_Rec is record
X, Y : Int;
W : Integer;
end record;
pragma Pack (Packed_Rec);
type Packed_RecArr is array (Integer range <>) of Packed_Rec;
pragma Pack (Packed_RecArr);
PRA : Packed_RecArr (1 .. 3);
Consider also a variable "PR", which is a Packed_Rec record,
declared as follow:
PR : Packed_Rec := (2, 2, 2);
Trying to assign a new value to PRA using an aggregate expression
where one of the components is our variable PR yields the wrong
result on big-endian machines (e.g. on ppc-linux):
(gdb) p pra := (pr, (2,2,2), (2,2,2))
$6 = ((x => 1, y => 0, w => 8), [...]
On the other hand, replacing "pr" by "(2,2,2)" does work.
I tracked the issue down to the bit offset we use to extract
the value of "PR" and copy it inside PRA. in value_assign_to_component,
we have:
if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
move_bits ([target buffer], [bit offset in target buffer],
[source buffer where PR is stored],
TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits,
bits, 1);
The issue is with the third-to-last argument, which provides the bit
offset where the value of PR is stored relative to its start address,
and therefore the bit offset relative to the start of the source
buffer passed as the previous argument.
In our case, component is a 38bit packed record whose TYPE_LENGTH
is 5 bytes, so the bit-offset that gets calculated is 2 (bits).
However, that formula only really applies to scalars, whereas
in our case, we have a record (struct). The offset in the non-scalar
case should be zero.
gdb/ChangeLog:
* ada-lang.c (value_assign_to_component): In the case of
big-endian targets, extract the bits of the given VAL
using an src_offset of zero if container is not a scalar.
gdb/testsuite/ChangeLog:
* gdb.ada/packed_array_assign: New testcase.
|
|
gcore generates NT_AUXV and NT_FILE notes for Linux targets. On
FreeBSD auxv is stored in a NT_PROCSTAT_AUXV section, virtual memory
mappings are stored in a NT_PROCSTAT_VMMAP, and both are prefixed with
the struct size. In addition, store a NT_PROCSTAT_PS_STRINGS note
saving the initial location of the argv[] and environment[] arrays.
gdb/ChangeLog:
PR gdb/23105
* fbsd-nat.c (fbsd_nat_target::xfer_partial): Add support for
TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
* fbsd-tdep.c (fbsd_make_note_desc): New.
(fbsd_make_corefile_notes): Write NT_PROCSTAT_AUXV,
NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes.
* target.h (enum target_object) Add FreeBSD-specific
TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
|
|
As mentioned here:
https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Avoid_non-const_reference_parameters.2C_use_pointers_instead
we prefer to avoid non-const references. This patch changes the
non-const references I could find in the compile/ directory, either by
making them rvalue-reference (&&) or changing them to pointers.
I'd say all the changes are pretty obvious, except the one in
compile_cplus_instance::enter_scope which might require more attention.
gdb/ChangeLog:
* compile/compile-c.h (generate_c_for_variable_locations):
Change reference to pointer.
* compile/compile-c-support.c (compile_program) <compute>:
Likewise.
* compile/compile-c-symbols.c (generate_vla_size): Likewise.
(generate_c_for_for_one_variable): Likewise
(generate_c_for_variable_locations): Likewise
* compile/compile-c-types.c (compile_c_instance::convert_type):
Likewise
* compile/compile-cplus-symbols.c (convert_one_symbol):
std::move the scope passed to enter_scope.
* compile/compile-cplus-types.c
(compile_cplus_instance::enter_scope): Make parameter
rvalue-reference.
(compile_cplus_instance::new_scope): Change reference to
pointer.
(compile_cplus_instance::convert_type): Likewise
(compile_cplus_convert_typedef): std::move the scope passed to
enter_scope.
(compile_cplus_convert_struct_or_union): Likewise.
(compile_cplus_convert_enum): Likewise.
(compile_cplus_convert_namespace): Likewise.
* compile/compile-cplus.h (compile_cplus_instance)
<enter_scope>: Make parameter rvalue-reference.
* compile/compile-internal.h (compile_instance)
<get_cached_type>: Likewise
* compile/compile-loc2c.c (push): Likewise
(pushf): Likewise
(unary): Likewise
(binary): Likewise
(print_label): Likewise
(pushf_register_address): Likewise
(pushf_register): Likewise
(do_compile_dwarf_expr_to_c): Likewise
(compile_dwarf_expr_to_c): Likewise
(compile_dwarf_bounds_to_c): Likewise
* compile/compile.c (compile_instance::get_cached_type):
Likewise
* compile/compile.h (compile_dwarf_expr_to_c): Likewise.
(compile_dwarf_bounds_to_c): Likewise
* dwarf2loc.c (locexpr_generate_c_location): Likewise.
(dwarf2_compile_property_to_c): Likewise
* dwarf2loc.h (dwarf2_compile_property_to_c): Likewise
* symtab.h (struct symbol_computed_ops) <generate_c_location>:
Likewise
|
|
gdb/ChangeLog:
* tui/tui-data.h (struct tui_win_element) <highlight>: Remove.
* tui/tui-data.c (init_content_element): Don't initialize it.
|
|
gdb/ChangeLog:
* tui/tui-data.h (struct tui_win_info)
<detail::opaque>: Remove.
* tui/tui-data.c (init_win_info): Remove assignment.
|
|
After looking into why the build failed for Simon but not for me, we
found that the underlying cause was due to how gcc treats
-Wformat-nonliteral. gcc requires -Wformat to be given first; but
warning.m4 was not doing this, so -Wformat-nonliteral was not being
used.
This patch changes warning.m4 to account gcc's requirement.
This then showed that the target-float.c build change in the earlier
Makefile patch was also incorrect. Simon didn't see this in his
build, but gcc now points it out. So, this patch fixes this problem
as well.
2018-09-05 Tom Tromey <tom@tromey.com>
* warning.m4 (AM_GDB_WARNINGS): Add -Wformat when testing
-Wformat-nonliteral.
* target-float.c (host_float_ops<T>::to_string)
(host_float_ops<T>::from_string): Use
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL.
* configure: Rebuild.
gdb/gdbserver/ChangeLog
2018-09-05 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
|
|
commit 3322c5d9a1 ("Remove unneeded explicit .o targets") broke the
build with clang, because -Wno-format-nonliteral was in fact needed.
This patch fixes the problem by introducing
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL and using it in printcmd.c. This
seems preferable to reverting the patch because now the warning
suppression is more targeted.
gdb/ChangeLog
2018-09-05 Simon Marchi <simon.marchi@ericsson.com>
* printcmd.c (printf_c_string): Use
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL.
(printf_wide_c_string, printf_pointer, ui_printf): Likewise.
include/ChangeLog
2018-09-05 Simon Marchi <simon.marchi@ericsson.com>
* diagnostics.h (DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL): New macro.
|
|
I noticed a couple of unnecessary casts in cli-cmds.c. This patch
removes them.
Tested by rebuilding. I'm checking this in.
gdb/ChangeLog
2018-09-05 Tom Tromey <tom@tromey.com>
* cli/cli-cmds.c (shell_escape, edit_command): Remove cast.
|
|
Consider a vla variable 'a' in function f1:
...
<2><1a7>: Abbrev Number: 11 (DW_TAG_variable)
<1a8> DW_AT_description : a
<1aa> DW_AT_abstract_origin: <0x311>
...
with abstract origin 'a':
...
<2><311>: Abbrev Number: 3 (DW_TAG_variable)
<312> DW_AT_name : a
<317> DW_AT_type : <0x325>
...
and inherited abstract vla type:
...
<1><325>: Abbrev Number: 9 (DW_TAG_array_type)
<326> DW_AT_type : <0x33a>
<2><32e>: Abbrev Number: 10 (DW_TAG_subrange_type)
<32f> DW_AT_type : <0x2ea>
<333> DW_AT_upper_bound : 5 byte block: fd 1b 3 0 0
(DW_OP_GNU_variable_value: <0x31b>)
...
where the upper bound refers to this artificial variable D.1922 without location
attribute:
...
<2><31b>: Abbrev Number: 8 (DW_TAG_variable)
<31c> DW_AT_description : (indirect string, offset: 0x39a): D.1922
<320> DW_AT_type : <0x2ea>
<324> DW_AT_artificial : 1
...
Currently, when we execute "p sizeof (a)" in f1, the upper bound is calculated
by evaluating the DW_OP_GNU_variable_value expression referring to D.1922, but
since that die doesn't have a location attribute, we get:
...
value has been optimized out
...
However, there's also artificial variable D.4283 that is sibling of vla
variable 'a', has artificial variable D.1922 as abstract origin, and has a
location attribute:
...
<2><1ae>: Abbrev Number: 12 (DW_TAG_variable)
<1af> DW_AT_description : (indirect string, offset: 0x1f8): D.4283
<1b3> DW_AT_abstract_origin: <0x31b>
<1b7> DW_AT_location : 11 byte block: 75 1 8 20 24 8 20 26 31 1c 9f
(DW_OP_breg5 (rdi):1; DW_OP_const1u: 32;
DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra;
DW_OP_lit1; DW_OP_minus; DW_OP_stack_value)
...
The intended behaviour for DW_OP_GNU_variable_value is to find a die that
refers to D.1922 as abstract origin, has a location attribute and is
'in scope', so the expected behaviour is:
...
$1 = 6
...
The 'in scope' concept can be thought of as variable D.1922 having name
attribute "D.1922", and variable D.4283 inheriting that attribute, resulting
in D.4283 being declared with name "D.1922" alongside vla a in f1, and when we
lookup "DW_OP_GNU_variable_value D.1922", it should work as if we try to find
the value of a variable named "D.1922" on the gdb command line using
"p D.1922", and we should return the value of D.4283.
This patch fixes the case described above, by:
- adding a field abstract_to_concrete to struct dwarf2_per_objfile,
- using that field to keep track of which concrete dies are instances of an
abstract die, and
- using that information when getting the value DW_OP_GNU_variable_value.
Build and reg-tested on x86_64-linux.
2018-09-05 Tom de Vries <tdevries@suse.de>
* dwarf2loc.c (sect_variable_value): Call indirect_synthetic_pointer
with resolve_abstract_p == true.
(indirect_synthetic_pointer): Add resolve_abstract_p parameter,
defaulting to false. Propagate resolve_abstract_p to
dwarf2_fetch_die_loc_sect_off.
* dwarf2loc.h (dwarf2_fetch_die_loc_sect_off): Add resolve_abstract_p
parameter, defaulting to false.
* dwarf2read.c (read_variable): Add variable to abstract_to_concrete.
(dwarf2_fetch_die_loc_sect_off): Add and handle resolve_abstract_p
parameter.
* dwarf2read.h (struct die_info): Forward-declare.
(die_info_ptr): New typedef.
(struct dwarf2_per_objfile): Add abstract_to_concrete field.
* gdb.dwarf2/varval.exp: Add test.
|
|
gdb/ChangeLog:
GDB 8.2 released.
|
|
When we update gnulib using our "update-gnulib.sh" tool, it doesn't
automatically update the list of M4 files present at
gnulib/Makefile.in:aclocal_m4_deps. This patch extends the tool to do
that. It also puts "aclocal_m4_deps" in its own file (a Makefile
fragment), so that it's easier to update it programatically.
Tested by generating the file and diff'ing the results against the
current version of "aclocal_m4_deps".
gdb/ChangeLog:
2018-09-04 Sergio Durigan Junior <sergiodj@redhat.com>
Pedro Alves <palves@redhat.com>
* gnulib/Makefile.in (aclocal_m4_deps): Move to
"aclocal-m4-deps.mk". Include file here.
$(srcdir)/aclocal.m4: Add "configure.ac".
* gnulib/aclocal-m4-deps.mk: New file.
* gnulib/update-gnulib.sh: Automatically update
"aclocal-m4-deps.mk".
|
|
gdb's configure script accepts --enable-multi-ice, but the code this
refers to is long gone. This patch removes the option entirely.
gdb/ChangeLog
2018-09-04 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Remove multi-ice code.
|
|
The ada-exp.o rule no longer needs to pass -Wno-old-style-definition
to the compiler, as this option has no meaning in C++. So, This patch
simplifies the explicit ada-exp.o rule in the Makefile. The rule is
still needed because, according to the comment, ada-exp.c may appear
in the srcdir.
gdb/ChangeLog
2018-09-04 Tom Tromey <tom@tromey.com>
* Makefile.in (GDB_WARN_CFLAGS_NO_DEFS): Remove.
(ada-exp.o): Update.
|
|
Makefile.in had special cases to compile printcmd.o and target-float.o
with a different set of warnings. However, this is no longer
required, so this patch removes those rules.
gdb/ChangeLog
2018-09-04 Tom Tromey <tom@tromey.com>
* Makefile.in (printcmd.o, target-float.o): Remove.
(GDB_WARN_CFLAGS_NO_FORMAT): Remove.
|
|
This removes an obsolete comment from Makefile.in. This was copied
into gnulib/Makefile.in, so this removes that comment as well.
gdb/ChangeLog
2018-09-04 Tom Tromey <tom@tromey.com>
* gnulib/Makefile.in: Remove obsolete comment.
* Makefile.in: Remove obsolete comment.
|
|
This patch fixes an ARI violation in riscv-tdep.c (line ends with
'+').
gdb/ChangeLog:
* riscv-tdep.c (riscv_frame_cache): Fix ARI warning, don't end a
line with '+'.
|
|
Collects information during the prologue scan and uses this to unwind
registers when no DWARF information is available.
This patch has been tested by disabling the DWARF stack unwinders, and
running the complete GDB testsuite against a range of RISC-V targets.
The results are comparable to running with the DWARF unwinders in
place.
gdb/ChangeLog:
* riscv-tdep.c: Add 'prologue-value.h' include.
(struct riscv_unwind_cache): New struct.
(riscv_debug_unwinder): New global.
(riscv_scan_prologue): Update arguments, capture register details
from prologue scan.
(riscv_skip_prologue): Reformat arguments line, move end of
prologue calculation into riscv_scan_prologue.
(riscv_frame_cache): Update return type, create
riscv_unwind_cache, scan the prologue, and fill in remaining cache
details.
(riscv_frame_this_id): Use frame id computed in riscv_frame_cache.
(riscv_frame_prev_register): Use the trad_frame within the
riscv_unwind_cache.
(_initialize_riscv_tdep): Add 'set/show debug riscv unwinder'
flag.
|
|
Adds two new functions to the trad-frame API and update the internals
of trad-frame to use the new functions. These functions will be used
in later commits.
gdb/ChangeLog:
* trad-frame.h (trad_frame_set_realreg): Declare.
(trad_frame_set_addr): Declare.
* trad-frame.c (trad_frame_set_realreg): Define new function.
(trad_frame_set_addr): Define new function.
(trad_frame_set_reg_realreg): Use new function.
(trad_frame_set_reg_addr): Use new function.
|
|
This patch fixes two violations of the ARI (use of ATTRIBUTE_UNUSED and
"%ll").
gdb/ChangeLog
* compile/compile-cplus-types.c (compile_cplus_debug_output_1): Use
pulongest instead of "%lld".
* compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol): Remove
ATTRIBUTE_UNUSED.
|
|
gdb represents a DW_TAG_variant_part as a union. While normally DWARF
would not set the size of a DW_TAG_variant_part, gdb's representation
requires the TYPE_LENGTH to be set.
This patch arranges to set the TYPE_LENGTH of a variant part if it has
not already been set.
This fixes some Rust regressions when testing against a version of
rustc that emits DW_TAG_variant_part.
gdb/ChangeLog
2018-08-31 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_add_field): Set the TYPE_LENGTH of the
variant part type.
|
|
The previous commit included a stale gdbarch.h from an earlier version
of that patch by mistake.
gdb/ChangeLog:
2018-08-31 Pedro Alves <palves@redhat.com>
* gdbarch.h: Regenerate.
|
|
These weren't described anywhere in the sources.
gdb/ChangeLog:
2018-08-31 Pedro Alves <palves@redhat.com>
* gdbarch.sh (have_nonsteppable_watchpoint): Add comment.
* target.h (Hardware watchpoint interfaces): Describe
continuable/steppable/non-steppable watchpoints.
* gdbarch.h, gdbarch.c: Regenerate.
|
|
target_have_continuable_watchpoint isn't used anywhere so remove it.
The property isn't necessary because checking for "continuable" is the
same as checking for "!steppable && !non-steppable".
gdb/ChangeLog:
2018-08-31 Pedro Alves <palves@redhat.com>
* nto-procfs.c (nto_procfs_target::have_continuable_watchpoint):
Delete.
* s390-linux-nat.c
(s390_linux_nat_target::have_continuable_watchpoint): Delete.
* target.h (target_ops::have_continuable_watchpoint): Delete.
(target_have_continuable_watchpoint): Delete.
* x86-nat.h (x86_nat_target::have_continuable_watchpoint): Delete.
* target-delegates.c: Regenerate.
|
|
It was pointed by Pedro that gnulib/Makefile.in should be updated
accordingly after our local gnulib is also updated. The specific part
that needs to be refreshed is the "aclocal_m4_deps" variable, which
lists the .m4 files present under the "gnulib/import/m4/" directory.
This patch does that.
No regressions introduced.
gdb/ChangeLog:
2018-08-31 Sergio Durigan Junior <sergiodj@redhat.com>
* gnulib/Makefile.in (aclocal_m4_deps): Update according to
the files present in "gnulib/import/m4/".
|
|
Extends the instruction decoder used during prologue scan and software
single step to cover more instructions. These instructions are
encountered when running the current GDB testsuite with the DWARF
stack unwinders turned off.
gdb/ChangeLog:
* riscv-tdep.c (riscv_insn::decode): Decode c.addi4spn, c.sd,
c.sw, c.swsp, and c.sdsp.
|
|
The RISC-V had a mechanism in place to cache the contents of the misa
register per-inferior, the original intention behind this was to
reduce the number of times the misa register had to be read (as the
contents should be constant), but it was pointed out on the mailing
list[1] that the register cache will mean the register is only
accessed once each time GDB stops, and any additional caching is
probably just unneeded extra complexity.
As such, until it can be shown that there's a real need for additional
caching, this commit removes all of the additional caching of the misa
register, and just accesses the misa register like a normal register.
[1] https://sourceware.org/ml/gdb-patches/2018-03/msg00136.html
gdb/ChangeLog:
* riscv-tdep.c (struct riscv_inferior_data): Delete.
(riscv_read_misa_reg): Don't cache value read into inferior data.
(riscv_new_inferior_data): Delete.
(riscv_inferior_data_cleanup): Delete.
(riscv_inferior_data): Delete.
(riscv_invalidate_inferior_data): Delete.
(_initialize_riscv_tdep): Remove initialisation of inferior data.
|
|
I see these errors when building with clang:
CXX compile/compile-cplus-types.o
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:306:56: error: cannot pass non-trivial object of type 'compile_scope' to variadic function; expected type from format string was 'void *' [-Wnon-pod-varargs]
fprintf_unfiltered (gdb_stdlog, "leaving scope %p\n", current);
~~ ^~~~~~~
/home/emaisin/src/binutils-gdb/gdb/compile/compile-cplus-types.c:1058:13: error: comparison of two values with different enumeration types ('enum_flags<gcc_cp_qualifiers>::enum_type' (aka 'gcc_cp_qualifiers') and 'gcc_cp_ref_qualifiers') [-Werror,-Wenum-compare]
if (quals != GCC_CP_REF_QUAL_NONE)
~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
Fix the first one by using host_address_to_string.
Fix the second one by comparing to 0 instead. I think the current
comparison simply uses the wrong enum type. Comparing to 0 seems like
the right thing to do, because we want to check whether any flags are
specified.
gdb/ChangeLog:
* compile/compile-cplus-types.c
(compile_cplus_instance::leave_scope): Take the address of scope
object.
(compile_cplus_instance::convert_qualified_base): Compare quals
to 0.
|