Created attachment 8583 [details] Patch I think i found a bug gdb-7.10/gdb/cp-valprint.c:316 struct value *v = NULL; TRY { v = value_static_field (type, i); } CATCH ... END_CATCH cp_print_static_field (TYPE_FIELD_TYPE (type, i), v, stream, recurse + 1, options); Assume that throw happend in value_static_field, then "v" would still be NULL, but cp_print_static_field expects "v" to be non-zero. This situation would lead to SEGFAULT Propose to place "v" and cp_print_static_field call into TRY block Digging in git history, I found out that, if v == NULL before cp_print_static_field call, then val_print_optimized_out happend (commit 686d4defdf4a343d4b700b8b544cd40c4f16b0d1). But in my case variable was not optimized out, and value_static_field throws. P.S.: I was debugging remote linux application from windows host. Patch to 7.10 attached
Created attachment 8584 [details] PatchFixed
Confirming. I independently reached the same conclusion after seeing gdb segfaulting reproducibly when printing values from a binary compiled with -fvisibility=hidden. I was going to submit exactly the same patch, so I would be glad if this fix could be included in next gdb's release. Without it, gdb crashes almost in every session, especially when using it in concert with an IDE which attempts to print all local variables.
Good catch, Anton! I think you should send it to gdb-patches directly.
(In reply to Ales Novak from comment #3) > Good catch, Anton! I think you should send it to gdb-patches directly. I would if you can tell me how =). I know only Bugzilla for patch proposal
On Mon, 21 Mar 2016, anton_nix at mail dot ru wrote: > https://sourceware.org/bugzilla/show_bug.cgi?id=18929 > > --- Comment #4 from Anton Mamontov <anton_nix at mail dot ru> --- > (In reply to Ales Novak from comment #3) > > Good catch, Anton! I think you should send it to gdb-patches directly. > > I would if you can tell me how =). I know only Bugzilla for patch proposal Send it as mail to gdb@sourceware.org together with a ChangeLog entry.
Duplicate of PR20020 *** This bug has been marked as a duplicate of bug 20020 ***