Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [patch] [1/2] Discontiguous PSYMTABs (partial DIEs base address)
Date: Wed, 23 Apr 2008 22:18:00 -0000	[thread overview]
Message-ID: <20080423213055.GB11894@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20071217010217.GB14690@caradoc.them.org>

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

Hi,

It fixes this testcase run (when `complaints' is on):

-Reading symbols from /home/jkratoch/redhat/sources/gdb/testsuite/gdb.cp/m-static...Invalid .debug_ranges data (no base address)...done.
+Reading symbols from /home/jkratoch/redhat/sources/gdb/testsuite/gdb.cp/m-static...done.

Currently the base address required for the CU DW_AT_ranges resolution is set
only during full symbols reading which is too late for the secondary patch
which uses OBJFILE->PSYMTABS_ADDRMAP built from these ranges to find which
psymtabs expand to the full symtabs (chicken-egg problem).

It has no real benefits but it is a non-regression standalone patch required by
the next patch [2/2].

Going to post the results of some more verifications, posting as Doug Evans has
asked.


Regards,
Jan

[-- Attachment #2: gdb-cvs-psymtab-base_address.patch --]
[-- Type: text/plain, Size: 2138 bytes --]

2008-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Set CU BASE_ADDRESS already from partial DIEs.
	* dwarf2read.c (read_partial_die): New variables BASE_ADDRESS and
	BASE_ADDRESS_TYPE.  Set these variables from DW_AT_LOW_PC and
	DW_AT_ENTRY_PC.  Set CU->HEADER.BASE_KNOWN and CU->HEADER.BASE_ADDRESS
	from these variables if it was still unset.

--- ./gdb/dwarf2read.c	19 Apr 2008 05:06:54 -0000	1.255
+++ ./gdb/dwarf2read.c	21 Apr 2008 13:49:11 -0000
@@ -5808,6 +5851,15 @@ read_partial_die (struct partial_die_inf
   struct attribute attr;
   int has_low_pc_attr = 0;
   int has_high_pc_attr = 0;
+  CORE_ADDR base_address;
+  enum
+    {
+      base_address_none,
+      base_address_low_pc,
+      /* Overrides BASE_ADDRESS_LOW_PC.  */
+      base_address_entry_pc
+    }
+  base_address_type = base_address_none;
 
   memset (part_die, 0, sizeof (struct partial_die_info));
 
@@ -5845,11 +5897,25 @@ read_partial_die (struct partial_die_inf
 	case DW_AT_low_pc:
 	  has_low_pc_attr = 1;
 	  part_die->lowpc = DW_ADDR (&attr);
+	  if (part_die->tag == DW_TAG_compile_unit
+	      && base_address_type < base_address_low_pc)
+	    {
+	      base_address = DW_ADDR (&attr);
+	      base_address_type = base_address_low_pc;
+	    }
 	  break;
 	case DW_AT_high_pc:
 	  has_high_pc_attr = 1;
 	  part_die->highpc = DW_ADDR (&attr);
 	  break;
+	case DW_AT_entry_pc:
+	  if (part_die->tag == DW_TAG_compile_unit
+	      && base_address_type < base_address_entry_pc)
+	    {
+	      base_address = DW_ADDR (&attr);
+	      base_address_type = base_address_entry_pc;
+	    }
+	  break;
 	case DW_AT_ranges:
 	  if (dwarf2_ranges_read (DW_UNSND (&attr), &part_die->lowpc,
 				  &part_die->highpc, cu))
@@ -5942,6 +6010,14 @@ read_partial_die (struct partial_die_inf
       && (part_die->lowpc != 0
 	  || dwarf2_per_objfile->has_section_at_zero))
     part_die->has_pc_info = 1;
+
+  if (base_address_type != base_address_none && !cu->header.base_known)
+    {
+      gdb_assert (part_die->tag == DW_TAG_compile_unit);
+      cu->header.base_known = 1;
+      cu->header.base_address = base_address;
+    }
+
   return info_ptr;
 }
 

  parent reply	other threads:[~2008-04-23 21:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09 18:17 [patch] Parse DW_AT_ranges into PSYMTABS (for childless CU, for vDSO32) Jan Kratochvil
2007-10-09 18:22 ` Daniel Jacobowitz
2007-10-09 18:59   ` Jan Kratochvil
2007-10-09 19:13     ` Daniel Jacobowitz
2007-11-24 15:43       ` Jan Kratochvil
2007-11-25 14:48         ` Daniel Jacobowitz
2007-11-30  7:42         ` Vladimir Prus
2007-11-30 11:10           ` Jan Kratochvil
2007-11-30 14:56             ` Daniel Jacobowitz
2007-11-30 15:09               ` Jan Kratochvil
2007-12-01  0:55               ` Jim Blandy
2007-12-01 17:30                 ` Joel Brobecker
2007-12-09 20:40               ` [patch] Discontiguous PSYMTABs [Re: [patch] Parse DW_AT_ranges into PSYMTABS (for childless CU, for vDSO32)] Jan Kratochvil
2007-12-10  0:21                 ` [patch] Removal of the FIND_PC_SECT_PSYMTAB search [Re: [patch] Discontiguous PSYMTABs] Jan Kratochvil
2007-12-17  1:02                 ` [patch] Discontiguous PSYMTABs [Re: [patch] Parse DW_AT_ranges into PSYMTABS (for childless CU, for vDSO32)] Daniel Jacobowitz
2007-12-17  1:03                   ` Daniel Jacobowitz
2007-12-17  2:41                     ` [patch] Discontiguous PSYMTABs Jan Kratochvil
2007-12-17  3:41                       ` Daniel Jacobowitz
2008-04-23 22:15                     ` [patch] [0/2] " Jan Kratochvil
2008-04-23 22:18                     ` Jan Kratochvil [this message]
2008-05-01 19:43                       ` [patch] [1/2] Discontiguous PSYMTABs (partial DIEs base address) Daniel Jacobowitz
2008-04-23 22:24                     ` [patch] [2/2] Discontiguous PSYMTABs (psymtabs->symtabs by addrmap) Jan Kratochvil
2008-05-01 19:46                       ` Daniel Jacobowitz
2008-05-04 17:38                         ` Jan Kratochvil
2008-05-12 22:24                       ` Overlay support broken (Re: [patch] [2/2] Discontiguous PSYMTABs (psymtabs->symtabs by addrmap)) Ulrich Weigand
2008-05-12 22:37                         ` Michael Snyder
2008-05-13  1:39                           ` Daniel Jacobowitz
2008-05-13  3:17                             ` Jan Kratochvil
2008-05-13 15:37                             ` Doug Evans
2008-05-13 15:42                             ` Michael Snyder
2008-05-13 15:31                           ` Doug Evans
2008-05-12 23:52                         ` Jan Kratochvil
2008-05-13 18:45                           ` Ulrich Weigand
2008-05-13 19:08                             ` Pedro Alves
2008-05-13 19:01                               ` Pedro Alves
2008-05-13 19:11                               ` Michael Snyder
2008-05-15 16:39                             ` Jan Kratochvil
2008-05-15 18:16                               ` Ulrich Weigand
2008-05-15 18:44                                 ` Daniel Jacobowitz
2008-05-15 19:06                                   ` Ulrich Weigand
2008-05-16 18:32                                   ` Ulrich Weigand
2008-05-15 19:18                               ` Michael Snyder
2008-04-23 21:31                 ` [patch] Discontiguous PSYMTABs [Re: [patch] Parse DW_AT_ranges into PSYMTABS (for childless CU, for vDSO32)] Doug Evans
2008-04-23 21:31                   ` Jan Kratochvil

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=20080423213055.GB11894@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sources.redhat.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