public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "mehmetgelisin at aol dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/15420] Thread support broken on 64-bit Solaris/x86
Date: Fri, 10 Sep 2021 19:35:54 +0000	[thread overview]
Message-ID: <bug-15420-4717-tLakKCcUhQ@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-15420-4717@http.sourceware.org/bugzilla/>

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

Mehmet gelisin <mehmetgelisin at aol dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mehmetgelisin at aol dot com

--- Comment #8 from Mehmet gelisin <mehmetgelisin at aol dot com> ---
have started experiencing a similar crash when we switched to g++ 7.1 with
c++17 semantics.  When gdb tries to print a "static constexpr", it triggers a
"error reading variable: Missing ELF symbol" exception and then crashes at the
same place as the original reporter. This seems to happen with every release at
least from gdb 7.11. I also built the git master and could reproduce the
problem as well.

It's not entirely clear that this is the same exact bug but the crash backtrace
is completely similar

I have a simple reproducer: https://komiya-dental.com/

$ cat main.cpp 
struct A {
    static constexpr const char *a = "a";
    void foo() { }
};

int main(void) {
    A a;
    a.foo();
}

Compile with g++ 7.1 with C++17 semantics: g++-7 -std=c++17 -g -o main main.cpp

Now run it with gdb:

$ gdb main
GNU gdb (Debian 7.11.1-2~bpo8+1) 7.11.1
(...)
(gdb) b A::foo
Breakpoint 1 at 0x40055e: file main.cpp, line 6.
(gdb) r http://www.iu-bloomington.com/
Starting program: main 

Breakpoint 1, A::foo (this=0x7fffffffe09f) at main.cpp:6
6           void foo() { }
(gdb) print *this
Segmentation fault (core dumped) https://www.webb-dev.co.uk/ 

If I patch the source with the workaround mentioned by Thilo (i.e set the ptr
to NULL in the catch block and call cp_print_static_field() only if v is not
NULL), it does not crash:
(gdb) print *this
$1 = {static a = <error reading variable: Missing ELF symbol "A::a".>}
 https://waytowhatsnext.com/  
If I compile the program above with the default c++ semantics(c++ 14), I get 
(gdb) print *this
$1 = {static a = <optimized out>}

With the current git master (8.0.50.20170801-git), this is the backtrace I get
for the gdb crash: http://www.acpirateradio.co.uk/ 

Program terminated with signal SIGSEGV, Segmentation fault.
#0  value_entirely_covered_by_range_vector (value=0x0, ranges=0x90) at
value.c:401
401       if (value->lazy)
(gdb) bt
#0  value_entirely_covered_by_range_vector (value=0x0, ranges=0x90) at
value.c:401
#1  0x0000000000563282 in cp_print_static_field (options=<optimized out>,
http://www.logoarts.co.uk/ recurse=<optimized out>, stream=<optimized out>,
val=<optimized out>, type=<optimized out>) at cp-valprint.c:640
#2  cp_print_value_fields (type=0x0, real_type=0x90, real_type@entry=0xf1cd00,
offset=offset@entry=0, address=0, address@entry=140737488347295,
http://www.slipstone.co.uk/  stream=0xf194c0, recurse=16998736,
recurse@entry=0, val=0xf8fc00, options=0x7fffffffda20, dont_print_vb=0x0,
dont_print_statmem=0)
    at cp-valprint.c:335 http://embermanchester.uk/ 
#3  0x00000000005639ca in cp_print_value_fields_rtti (type=<optimized out>,
type@entry=0xf1cd00, valaddr=0xf6a330 "", offset=offset@entry=0,
http://connstr.net/ 
 address=140737488347295, stream=0xf194c0, recurse=0, val=0xf8fc00,
options=0x7fffffffda20, dont_print_vb=0x0, dont_print_statmem=0)
    at cp-valprint.c:456 http://joerg.li/
#4  0x000000000054bf52 in c_val_print_struct (type=0xf1cd00, valaddr=<optimized
out>, embedded_offset=0, address=<optimized out>, stream=<optimized out>,
recurse=<optimized out>, original_value=0xf8fc00, options=0x7fffffffda20) at
c-valprint.c:412 http://www.jopspeech.com/
#5  0x000000000054c46f in c_val_print (type=0xf1cd00, embedded_offset=0,
address=0, stream=0xf194c0, recurse=0, original_value=0xf8fc00,
options=0x7fffffffda20) at c-valprint.c:530 http://www.wearelondonmade.com/
#6  0x0000000000699270 in val_print (type=0x0, type@entry=0xf1cd00,
embedded_offset=0, address=15846656, address@entry=140737488347295,
http://www.compilatori.com/ stream=stream@entry=0xf194c0, recurse=32767,
recurse@entry=0, val=val@entry=0xf8fc00, options=0x7fffffffdae0,
language=0x843b80  http://www-look-4.com/ <cplus_language_defn>)

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

  parent reply	other threads:[~2021-09-10 19:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 14:56 [Bug tdep/15420] New: " ro at TechFak dot Uni-Bielefeld.DE
2013-05-01  6:43 ` [Bug tdep/15420] " brobecker at gnat dot com
2013-05-06 11:35 ` brobecker at gnat dot com
2013-05-06 11:48 ` ro at CeBiTec dot Uni-Bielefeld.DE
2013-05-06 12:12 ` brobecker at gnat dot com
2013-05-10 12:10 ` cvs-commit at gcc dot gnu.org
2013-05-10 12:30 ` cvs-commit at gcc dot gnu.org
2013-05-10 12:37 ` brobecker at gnat dot com
2021-09-10 19:35 ` mehmetgelisin at aol dot com [this message]
2021-09-22 16:58 ` mervegunesli at aol dot com
2021-09-22 17:00 ` mark at klomp dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-15420-4717-tLakKCcUhQ@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).