This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/19912] New: When debugging a program built with Clang, gdb says: amd64_push_arguments: Assertion `!"Unexpected register class."' failed.


https://sourceware.org/bugzilla/show_bug.cgi?id=19912

            Bug ID: 19912
           Summary: When debugging a program built with Clang, gdb says:
                    amd64_push_arguments: Assertion `!"Unexpected register
                    class."' failed.
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: rymg19 at gmail dot com
  Target Milestone: ---

My OS (sorry, couldn't find the OS field): Ubuntu 14.04.

What happens:

Take the following very simple source file:


#include <string>

struct T {
    std::string s;
    int i;
    bool operator==(T rhs) { return true; }
};

int main() {
    T a, b;
    return a == b;
}


If I build this under GCC 4.9 (via `g++ -g -o bug bug.cpp`), gdb behaves
normally:

ryan@DevPC-LX:~/langtest/gdb$ gdb ./bug
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bug...done.
(gdb) break bug.cpp:11
Breakpoint 1 at 0x4007f7: file bug.cpp, line 11.
(gdb) run
Starting program: /home/ryan/langtest/gdb/bug 

Breakpoint 1, main () at bug.cpp:11
11          return a == b;
(gdb) # NOTE THIS!!!!!
(gdb) p a == b
$1 = true
(gdb) quit
A debugging session is active.

        Inferior 1 [process 9607] will be killed.

Quit anyway? (y or n) y
ryan@DevPC-LX:~/langtest/gdb$ 


It works. HOWEVER, say I build with Clang 3.8 instead (`clang -g -o bug
bug.cpp`). This happens:


ryan@DevPC-LX:~/langtest/gdb$ gdb ./bug
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bug...done.
(gdb) break bug.cpp:11
Breakpoint 1 at 0x400896: file bug.cpp, line 11.
(gdb) run
Starting program: /home/ryan/langtest/gdb/bug 

Breakpoint 1, main () at bug.cpp:11
11          return a == b;
(gdb) # NOTE THIS!!!!!
(gdb) p a == b
/build/buildd/gdb-7.7.1/gdb/amd64-tdep.c:859: internal-error:
amd64_push_arguments: Assertion `!"Unexpected register class."' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

/build/buildd/gdb-7.7.1/gdb/amd64-tdep.c:859: internal-error:
amd64_push_arguments: Assertion `!"Unexpected register class."' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Command aborted.


I attached the resulting core dump. Note that the test case is as minimal as I
can get it. If I remove any fields from the `T` struct, `gdb` will behave
normally.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]