From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D20823853C1C; Tue, 17 Aug 2021 14:45:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D20823853C1C From: "xuxing5 at huawei dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/28238] trying to run gdb on the core file(clang compile), But gdb coredump Date: Tue, 17 Aug 2021 14:45:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: xuxing5 at huawei dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 14:45:02 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28238 --- Comment #4 from xuxing5 at huawei dot com --- (In reply to Simon Marchi from comment #3) > Unfortunately, there won't be any more releases of GDB 9 (nor 10). But if > you really need it, you are free to backport the appropriate patches loca= lly > for your own use. we also find this commit cause the bug: please help me commit 5c281dbb2458be9d58355e865f527e96b40bcd8c Author: Tom Tromey Date: Thu Aug 1 09:17:14 2019 -0600 Don't call decode_line_with_current_source from select_source_symtab select_source_symtab currently calls decode_line_with_current_source. However, this function iterates over all program spaces, and so it is possible that it will return a "main" from some other program space. This patch changes select_source_symtab to simply use the symbol it already found in the current program space. gdb/ChangeLog 2019-10-02 Tom Tromey * source.c (select_source_symtab): Don't call decode_line_with_current_source. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c2417cfd371..d419fdfdae3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-10-02 Tom Tromey + + * source.c (select_source_symtab): Don't call + decode_line_with_current_source. + 2019-10-02 Andrew Burgess * symtab.c (lookup_global_symbol): Search global block. diff --git a/gdb/source.c b/gdb/source.c index ff218189495..9222df15050 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -252,17 +252,14 @@ select_source_symtab (struct symtab *s) /* Make the default place to list be the function `main' if one exists. */ - if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0).symbol) + block_symbol bsym =3D lookup_symbol (main_name (), 0, VAR_DOMAIN, 0); + if (bsym.symbol !=3D nullptr && SYMBOL_CLASS (bsym.symbol) =3D=3D LOC_BL= OCK) { - std::vector sals - =3D decode_line_with_current_source (main_name (), - DECODE_LINE_FUNFIRSTLINE); - const symtab_and_line &sal =3D sals[0]; + symtab_and_line sal =3D find_function_start_sal (bsym.symbol, true); current_source_pspace =3D sal.pspace; current_source_symtab =3D sal.symtab; current_source_line =3D std::max (sal.line - (lines_to_list - 1), 1); - if (current_source_symtab) - return; + return; } /* Alright; find the last file in the symtab list (ignoring .h's --=20 You are receiving this mail because: You are on the CC list for the bug.=