Discussion:
[Bug python/23730] New: gdb.base/catch-follow-exec.exp incorrectly loads system gdb Python scripts (wrong data-directory)
palves at redhat dot com
2018-09-30 14:51:36 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

Bug ID: 23730
Summary: gdb.base/catch-follow-exec.exp incorrectly loads
system gdb Python scripts (wrong data-directory)
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: palves at redhat dot com
Target Milestone: ---

I noticed this in gdb.log:

~~~~~
process 3038 is executing new program: /usr/bin/ls
[New inferior 2]
[New process 3038]

Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), 0x00007ffff7dd8ed0 in
_start () from /lib64/ld-linux-x86-64.so.2
Traceback (most recent call last):
File "/opt/gdb/share/gdb/python/gdb/__init__.py", line 88, in
execute_unwinders
for objfile in _gdb.objfiles():
AttributeError: 'module' object has no attribute 'objfiles'
No selected thread.
PASS: gdb.base/catch-follow-exec.exp: catch-follow-exec
~~~~~

Note the Python error pointing at "/opt/gdb/share/gdb/". That path is the
configured datadir:

~~~~
This GDB was configured as follows:
configure --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-auto-load-dir=$debugdir:$datadir/auto-load
--with-auto-load-safe-path=$debugdir:$datadir/auto-load
--with-expat
--with-gdb-datadir=/opt/gdb/share/gdb (relocatable)
--with-jit-reader-dir=/opt/gdb/lib/gdb (relocatable)
~~~~

But, however, I am testing a build of 8.2.50.20180917-git and have not typed
"make install" in this directory in a long while, so the scripts installed in
that data directory are for whatever I had last installed there, which happens
to be a one year older 8.0.50.20170906-git GDB.

Normally testcases make sure to use the data directory in the build directory,
by passing --data-directory=DIR explicitly to GDB. See INTERNAL_GDBFLAGS in
gdb.exp.

However, this testcase spawns GDB manually and does not override the data
directory (does not pass INTERNAL_GDBFLAGS).

The testcase also uses "exec" directly instead of "remote_exec host", which
won't work correctly in remote host testing.

The checks for "remote_file target" at the top are ineffective too, since it's
not the "target" that runs bash, the host does.

Why check for ls? Doesn't appear used?

Also, gdb.base/catch-follow-exec.c is missing a copyright header.

Can the manual exec be replaced with gdb_spawn_with_cmdline_opts ?
--
You are receiving this mail because:
You are on the CC list for the bug.
palves at redhat dot com
2018-09-30 14:52:26 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

Pedro Alves <palves at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org
--
You are receiving this mail because:
You are on the CC list for the bug.
vries at gcc dot gnu.org
2018-10-04 21:24:27 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

Tom de Vries <vries at gcc dot gnu.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |vries at gcc dot gnu.org
--
You are receiving this mail because:
You are on the CC list for the bug.
vries at gcc dot gnu.org
2018-10-04 21:59:35 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Pedro Alves from comment #0)
Post by palves at redhat dot com
Why check for ls? Doesn't appear used?
The testcase contains:
...
char *exec_args[] = { "/bin/ls", "ppp", NULL };
...
--
You are receiving this mail because:
You are on the CC list for the bug.
vries at gcc dot gnu.org
2018-10-05 10:12:03 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/ml/gdb-patches/2018-10/msg00126.html
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-10-16 20:42:25 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c4b90788516fd431c86c22deac5001d6c4648227

commit c4b90788516fd431c86c22deac5001d6c4648227
Author: Tom de Vries <***@suse.de>
Date: Fri Oct 5 00:04:27 2018 +0200

[gdb/testsuite] Rewrite catch-follow-exec.exp

There are two problems with the current catch-follow-exec.exp:
- INTERNAL_GDBFLAGS (containing the datadir setting) is not used
- remote host testing doesn't work

Fix the former by using gdb_spawn_with_cmdline_opts. Fix the latter by
requiring gdb-native.

Build on x86_64-linux with and without ubsan, and tested.

2018-10-16 Tom de Vries <***@suse.de>

PR gdb/23730
* gdb.base/catch-follow-exec.c: Add copyright notice.
* gdb.base/catch-follow-exec.exp: Rewrite to use
gdb_spawn_with_cmdline_opts. Require gdb-native.
--
You are receiving this mail because:
You are on the CC list for the bug.
vries at gcc dot gnu.org
2018-10-16 20:47:50 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23730

Tom de Vries <vries at gcc dot gnu.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Component|python |testsuite
Version|unknown |HEAD
Resolution|--- |FIXED
Target Milestone|--- |8.3

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch updating test-case fixed, marking resolved-fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...