Discussion:
[Bug gdb/21473] New: wrong type info for extern inline function when debugging Emacs
eggert at gnu dot org
2017-05-08 18:09:49 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21473

Bug ID: 21473
Summary: wrong type info for extern inline function when
debugging Emacs
Product: gdb
Version: 7.12.1
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: eggert at gnu dot org
Target Milestone: ---

Created attachment 10042
--> https://sourceware.org/bugzilla/attachment.cgi?id=10042&action=edit
gzipped tarball of three source files illustrating the bug

On x86-64, GDB Fedora 7.12.1-48.fc25 has problems decoding debugging
information generated by GCC 6.3.1 20161221 (Red Hat 6.3.1-1). The problem does
not occur when I use GCC 4.8.5 20150623 (Red Hat 4.8.5-11) to compile. Although
I originally reported this as a GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80646>, Richard Biener starts to
believe that it is a GDB bug.

I ran into the problem while attempting to debug GNU Emacs, and constructed a
small test case to illustrate it. To reproduce it on Fedora 25 x86-64, extract
the files lisp.h, t.c and u.c from the attached tarball, and compile them by
running the shell command:

gcc -g3 -O2 t.c u.c

Then use GDB as follows:

$ gdb a.out
...
(gdb) ptype make_number
type = int ()
(gdb) ptype make_natnum
type = struct {
long i;
} (long)
(gdb) ptype XIL
type = struct {
long i;
} (long)
(gdb)

The reported type of 'make_number' is incorrect: it should be the same type as
that of make_natnum and XIL, but instead is a function returning 'int'. This
incorrect type can cause GDB to print incorrect results in expressions
involving make_number.
--
You are receiving this mail because:
You are on the CC list for the bug.
eggert at cs dot ucla.edu
2018-10-28 19:48:24 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21473

eggert at cs dot ucla.edu changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |eggert at cs dot ucla.edu
Version|7.12.1 |8.1.1

--- Comment #1 from eggert at cs dot ucla.edu ---
(In reply to Paul Eggert from comment #0)

I tried the same test case on x86-64 GDB Fedora 8.1.1-3.fc28, with the test
program compiled with GCC 8.2.1 20181011 (Red Hat 8.2.1-4), and got different
(though still incorrect) results:

(gdb) ptype make_number
type = struct {
long i;
} (long)
(gdb) ptype make_natnum
type = <unknown return type> ()
(gdb) ptype XIL
type = struct {
long i;
} (long)
(gdb)

Now, make_number and XIL are done right, but make_natnum's return type is not
known. I will update the version number of this bug report to GDB 8.1.1.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...