public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH v2 5/5] [gdb/symtab] Trust epilogue unwind info for unknown or non-gcc producer
Date: Mon, 13 Feb 2023 15:23:09 +0100	[thread overview]
Message-ID: <20230213142309.24366-6-tdevries@suse.de> (raw)
In-Reply-To: <20230213142309.24366-1-tdevries@suse.de>

Currently we only trust epilogue unwind info only for gcc >= 4.5.0.

This has the effect that we don't trust epilogue unwind info for:
- unknown producers (CU without DW_AT_producer attribute)
- non-gcc producers (say, clang).

Instead, only distrust epilogue unwind info only for gcc < 4.5.0.
---
 gdb/dwarf2/read.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ce6c01ac771..46792bd9162 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8451,7 +8451,13 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
       if (cu->has_loclist && gcc_4_minor >= 5)
 	cust->set_locations_valid (true);
 
-      if (gcc_4_minor >= 5)
+      int major, minor;
+      if (cu->producer != nullptr
+	  && producer_is_gcc (cu->producer, &major, &minor)
+	  && (major < 4 || (major == 4 && minor < 5)))
+	/* Don't trust gcc < 4.5.x.  */
+	cust->set_epilogue_unwind_valid (false);
+      else
 	cust->set_epilogue_unwind_valid (true);
 
       cust->set_call_site_htab (cu->call_site_htab);
-- 
2.35.3


      parent reply	other threads:[~2023-02-13 14:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 14:23 [PATCH v2 0/5] [gdb/symtab] Assume epilogue unwind info is valid unless gcc < 4.5.0 Tom de Vries
2023-02-13 14:23 ` [PATCH v2 1/5] [gdb/symtab] Factor out compunit_epilogue_unwind_valid Tom de Vries
2023-02-14 15:56   ` Tom Tromey
2023-02-14 22:36     ` Tom de Vries
2023-02-20 10:27       ` Tom de Vries
2023-02-13 14:23 ` [PATCH v2 2/5] [gdb/tdep] Fix amd64/i386_stack_frame_destroyed_p Tom de Vries
2023-02-13 14:23 ` [PATCH v2 3/5] [gdb/tdep] Add amd64/i386 epilogue override unwinders Tom de Vries
2023-02-13 14:23 ` [PATCH v2 4/5] [gdb/symtab] Trust epilogue unwind info for unknown producer (-g0 case) Tom de Vries
2023-02-13 14:23 ` Tom de Vries [this message]

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=20230213142309.24366-6-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).