On Linux, compiled with _GLIBCXX_DEBUG: (gdb) info os hello /usr/include/c++/8.2.1/debug/vector:447: Error: attempt to access an element in an empty container. Objects involved in the operation: sequence "this" @ 0x0x7ffd63c42660 { type = std::__debug::vector<char, gdb::default_init_allocator<char, std::allocator<char> > >; } [2] 31964 abort (core dumped) gdb -q
This bug has been introduced (by me, most likely) in 8.2, so I suggest we fix it in 8.2.1. It should be quite easy to fix, I plan to look at it with a colleague to introduce him to gdb and c++ development.
The master branch has been updated by Simon Marchi <simark@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d00a27c5addfb6b7350a39215b48f4aaffa5960c commit d00a27c5addfb6b7350a39215b48f4aaffa5960c Author: Paul Marechal <paul.marechal@ericsson.com> Date: Fri Dec 21 12:02:33 2018 -0500 gdb: Fix "info os <unknown>" command Running `info os someUnknownOsType` is crashing when gdb is built with -D_GLIBCXX_DEBUG: /usr/include/c++/5/debug/vector:439:error: attempt to access an element in an empty container. In target_read_stralloc from target.c, the call to target_read_alloc_1 can return an empty vector, we then call vector::back on this vector, which is invalid. This commit adds a check for emptiness before trying to call vector::back on it. It also adds test to check for `info os <unknown>` to return the proper error message. This is a regression in gdb 8.2 and this patch restores the behavior of previous versions. gdb/ChangeLog: PR gdb/23974 * target.c (target_read_stralloc): Check for empty vector. gdb/testsuite/ChangeLog: PR gdb/23974 * gdb.base/info-os.exp: Check return for unknown "info os" type.
The gdb-8.2-branch branch has been updated by Simon Marchi <simark@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6ef08cc9a8e7ce3f64ebbb67ea7b628129d3dc4f commit 6ef08cc9a8e7ce3f64ebbb67ea7b628129d3dc4f Author: Paul Marechal <paul.marechal@ericsson.com> Date: Fri Dec 21 12:02:33 2018 -0500 gdb: Fix "info os <unknown>" command Running `info os someUnknownOsType` is crashing when gdb is built with -D_GLIBCXX_DEBUG: /usr/include/c++/5/debug/vector:439:error: attempt to access an element in an empty container. In target_read_stralloc from target.c, the call to target_read_alloc_1 can return an empty vector, we then call vector::back on this vector, which is invalid. This commit adds a check for emptiness before trying to call vector::back on it. It also adds test to check for `info os <unknown>` to return the proper error message. This is a regression in gdb 8.2 and this patch restores the behavior of previous versions. gdb/ChangeLog: PR gdb/23974 * target.c (target_read_stralloc): Check for empty vector. gdb/testsuite/ChangeLog: PR gdb/23974 * gdb.base/info-os.exp: Check return for unknown "info os" type.
Fixed by the above.