[llvm-bugs] [Bug 46052] New: Cannot print type or set gdb breakpoint after 159a9f7e76

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 23 11:08:14 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46052

            Bug ID: 46052
           Summary: Cannot print type or set gdb breakpoint after
                    159a9f7e76
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

We run the GDB test suite internally, and we noticed a failure with one of the
tests that I bisected back to this change. The test attempts to print the type
of a function as well as set a breakpoint at the function in GDB. Prior to
commit 159a9f7e76307734bcdcae3357640e42e0733194 this worked correctly.

The test is cpexprs.cc in the GDB test suite, and here is a reduced version of
the test that shows the problem:

/* cpexprs.cc */
template <class T>
struct operation_1
{
  static void function (void) { } // operation_1<T>::function
};

template <class T, class Policy = operation_1<T> >
class policyd : public Policy
{
public:
  policyd (T obj) : obj_ (obj) { } // policyd<T, Policy>::policyd
  ~policyd (void) { } // policyd<T, Policy>::~policyd

private:
  T obj_;
};

typedef policyd<int> policyd1;

int
main (int argc, char* argv[])
{
  policyd1 pd1 (5);

  return 0;
}
/* cpexprs.cc */

The source file above is then compiled with "clang++ -g -o cpexprs cpexprs.cc"
and then the resulting binary is run using GDB with the following commands to
the debugger:

1. Set a breakpoint at main (break main)
2. Run to main (run)
3. Print information on policyd1::~policyd (print policyd1::~policyd)
4. Set a breakpoint at policyd1::~policyd (break policyd1::~policyd)

Using GDB 9.1 on my machine with a compiler built from 63249125 (the previous
commit), it produces the following output:

(gdb) b main
Breakpoint 1 at 0x400526: file cpexprs.cc, line 24.
(gdb) r
Starting program: /home/dyung/sandbox/cpexprs/cpexprs.old.elf

Breakpoint 1, main (argc=1, argv=0x7fffffffe448) at cpexprs.cc:24
24        policyd1 pd1 (5);
(gdb) print policyd1::~policyd
$1 = {void (policyd<int, operation_1<int> > * const)} 0x400570 <policyd<int,
operation_1<int> >::~policyd()>
(gdb) b policyd1::~policyd
Breakpoint 2 at 0x400578: file cpexprs.cc, line 13.


But if I repeat the same sequence of commands with a binary built from the
compiler built from 159a9f7e76, I get the following output:

(gdb) b main
Breakpoint 1 at 0x400526: file cpexprs.cc, line 24.
(gdb) r
Starting program: /home/dyung/sandbox/cpexprs/cpexprs.new.elf

Breakpoint 1, main (argc=1, argv=0x7fffffffe448) at cpexprs.cc:24
24        policyd1 pd1 (5);
(gdb) print policyd1::~policyd
There is no field named ~policyd
(gdb) b policyd1::~policyd
Function "policyd1::~policyd" not defined.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200523/c93a1b3b/attachment-0001.html>


More information about the llvm-bugs mailing list