Summary: | internal-error: Register "eax" has an unknown type "int32" | ||
---|---|---|---|
Product: | gdb | Reporter: | Hannes Domani <ssbssa> |
Component: | win32 | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | critical | CC: | jeremip11, pedro, qiyao, simark, ssbssa |
Priority: | P2 | ||
Version: | 8.1 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Hannes Domani
2018-01-28 18:07:37 UTC
I tried both gdb snapshot (gdb-8.0.91.20180128) and gdb trunk on x86_linux, but can't reproduce it. $ file ../../../native-i686-w64-mingw32/gdb/gdb.exe ../../../native-i686-w64-mingw32/gdb/gdb.exe: PE32 executable (console) Intel 80386, for MS Windows $ ./gdb ../../../native-i686-w64-mingw32/gdb/gdb.exe GNU gdb (GDB) 8.1.50.20180128-git Copyright (C) 2018 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 "--host=x86_64-pc-linux-gnu --target=i686-w64-mingw32". 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 ../../../native-i686-w64-mingw32/gdb/gdb.exe...done. The only difference is that my host is Linux, and your host is Windows. Seems to be a problem on my side. It looks like this variable initialization doesn't work: > static tdesc_type_builtin tdesc_predefined_types[] = > { > { "bool", TDESC_TYPE_BOOL }, > { "int8", TDESC_TYPE_INT8 }, > { "int16", TDESC_TYPE_INT16 }, > { "int32", TDESC_TYPE_INT32 }, > { "int64", TDESC_TYPE_INT64 }, > { "int128", TDESC_TYPE_INT128 }, > { "uint8", TDESC_TYPE_UINT8 }, > { "uint16", TDESC_TYPE_UINT16 }, > { "uint32", TDESC_TYPE_UINT32 }, > { "uint64", TDESC_TYPE_UINT64 }, > { "uint128", TDESC_TYPE_UINT128 }, > { "code_ptr", TDESC_TYPE_CODE_PTR }, > { "data_ptr", TDESC_TYPE_DATA_PTR }, > { "ieee_single", TDESC_TYPE_IEEE_SINGLE }, > { "ieee_double", TDESC_TYPE_IEEE_DOUBLE }, > { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT }, > { "i387_ext", TDESC_TYPE_I387_EXT } > }; It's empty in runtime: > (gdb) p tdesc_predefined_types[0]@10 > $6 = {{<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}, > {<tdesc_type> = {<tdesc_element> = {_vptr.tdesc_element = 0x0}, name = {static npos = 4294967295, > _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}, _M_string_length = 0, > {_M_local_buf = '\000' <repeats 15 times>, _M_allocated_capacity = 0}}, kind = TDESC_TYPE_BOOL}, <No data fields>}} I'm not sure how I broke this. It seems like the constructor of tdesc_type_builtin doesn't get called for the elements of this array. Can you confirm this, maybe by gdb'ing gdb and sticking a breakpoint on the constructor, or just putting a printf in it? (In reply to Simon Marchi from comment #3) > It seems like the constructor of tdesc_type_builtin doesn't get called for > the elements of this array. Can you confirm this, maybe by gdb'ing gdb and > sticking a breakpoint on the constructor, or just putting a printf in it? Yes, I can confirm this, the constructor is never called. Did you make a clean build? I recall somebody on IRC a while ago that had the same problem, and it went away when they did a "make clean; make". Otherwise, that would be either a compiler/linker problem, or us exploiting an undefined behavior. You would need to look into the generated code to see what happens (though if the calls to the constructor are not generated, it's hard to look for something that isn't there). But if it's indeed a compiler/linker problem, maybe you could make a small reproducer and file a bug with gcc or ld (I assume you are using gcc). As a workaround, you could try calling the constructor by hand for each element in _initialize_target_descriptions at the bottom of the file (this function is ran at startup): new (&tdesc_predefined_types[0]) tdesc_type_builtin ("bool", TDESC_TYPE_BOOL); new (&tdesc_predefined_types[1]) tdesc_type_builtin ("int8", TDESC_TYPE_INT8); ... etc (In reply to Simon Marchi from comment #5) > Did you make a clean build? I recall somebody on IRC a while ago that had > the same problem, and it went away when they did a "make clean; make". Yes, I even started from scratch again today, same result. > Otherwise, that would be either a compiler/linker problem, or us exploiting > an undefined behavior. You would need to look into the generated code to > see what happens (though if the calls to the constructor are not generated, > it's hard to look for something that isn't there). But if it's indeed a > compiler/linker problem, maybe you could make a small reproducer and file a > bug with gcc or ld (I assume you are using gcc). I will see if I can make a small reproducer. > As a workaround, you could try calling the constructor by hand for each > element in _initialize_target_descriptions at the bottom of the file (this > function is ran at startup): > > new (&tdesc_predefined_types[0]) tdesc_type_builtin ("bool", > TDESC_TYPE_BOOL); > new (&tdesc_predefined_types[1]) tdesc_type_builtin ("int8", > TDESC_TYPE_INT8); > ... > etc Interesting idea, I might try that (tomorrow). (In reply to Simon Marchi from comment #5) > Did you make a clean build? I recall somebody on IRC a while ago that had > the same problem, and it went away when they did a "make clean; make". > I think it went away by using an older linker: [January 12, 2018] <user> https://paste.ubuntu.com/26373570/ [January 12, 2018] <user> Oh, I know what my problem is [January 12, 2018] <user> I accidentally left the latest binutils as a /usr/bin/ld [January 12, 2018] <user> and changing it back works :) Yes, an older binutils works. I've opened a ld bug: https://sourceware.org/bugzilla/show_bug.cgi?id=22762 |