[Bug python/23730] New: gdb.base/catch-follow-exec.exp incorrectly loads system gdb Python scripts (wrong data-directory)

palves at redhat dot com sourceware-bugzilla@sourceware.org
Sun Sep 30 14:51:00 GMT 2018


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.


More information about the Gdb-prs mailing list