[PATCH][gdb/symtab] Support DW_AT_main_subprogram with -readnow.

Tom de Vries tdevries@suse.de
Sun May 5 10:25:00 GMT 2019


Hi,

DW_AT_main_subprogram is supported in normal mode in read_partial_die, but not
in -readnow mode.

Fix this by adding support for DW_AT_main_subprogram in read_func_scope.

Tested on x86_64-linux with native and RFC target board readnow (
https://sourceware.org/ml/gdb-patches/2019-05/msg00073.html ).

OK for trunk?

Thanks,
- Tom

[gdb/symtab] Support DW_AT_main_subprogram with -readnow.

gdb/ChangeLog:

2019-05-05  Tom de Vries  <tdevries@suse.de>

	PR symtab/16264
	PR symtab/24517
	* dwarf2read.c (read_func_scope): Handle DW_AT_main_subprogram.

---
 gdb/dwarf2read.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b5ea9e3cc0..3e611b0842 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -13741,6 +13741,10 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
   newobj->name = new_symbol (die, read_type_die (die, cu), cu,
 			     (struct symbol *) templ_func);
 
+  if (dwarf2_flag_true_p (die, DW_AT_main_subprogram, cu))
+    set_objfile_main_name (objfile, SYMBOL_LINKAGE_NAME (newobj->name),
+			   cu->language);
+
   /* If there is a location expression for DW_AT_frame_base, record
      it.  */
   attr = dwarf2_attr (die, DW_AT_frame_base, cu);



More information about the Gdb-patches mailing list