[gdb/symtab] Trust epilogue unwind info for unknown or non-gcc producer
authorTom de Vries <tdevries@suse.de>
Mon, 20 Feb 2023 11:20:14 +0000 (12:20 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 20 Feb 2023 11:20:14 +0000 (12:20 +0100)
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

index 11a2d3e7c9a53e45fa3f98eb5c6c5d067a8cca15..a5bc1d89a2d203281a9fcc5d010441a24cf00f3e 100644 (file)
@@ -6460,7 +6460,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);