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
Cc: Daniel Jacobowitz <drow@false.org>,
	Jim Blandy <jimb@codesourcery.com>,
	        Vladimir Prus <ghost@cs.msu.su>
Subject: [patch] Removal of the FIND_PC_SECT_PSYMTAB search  [Re: [patch] 	Discontiguous PSYMTABs]
Date: Mon, 10 Dec 2007 00:21:00 -0000	[thread overview]
Message-ID: <20071209204003.GB23339@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20071209203138.GA23339@host0.dyn.jankratochvil.net>

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

On Sun, 09 Dec 2007 21:31:38 +0100, Jan Kratochvil wrote:
...
> Attaching the fix for discontiguous psymtabs based on the addrmap framework.
...
> #2 My folowup mail will offer a future removal of FIND_PC_SECT_PSYMTAB_IS_VALID.

This is the promised simplification.  It has no testsuite regressions on x86_64
GNU/Linux but I feel such test is not sufficient.

I guess the heuristic complicated search there was just to deal with
overlapping PSYMTABs - these are now solved the clean way by ADDRMAP.

But some compilers may not produce the right CU DW_AT_ranges and/or the debug
info formats may not support it, I do not know.


Regards,
Jan

[-- Attachment #2: gdb-cvs-psymtab-ranges-radical.patch --]
[-- Type: text/plain, Size: 4445 bytes --]

2007-12-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* symtab.c (find_pc_sect_psymtab_is_valid): Remoev the function.
	(find_pc_sect_psymtab): Remove the FIND_PC_SECT_PSYMTAB_IS_VALID call,
	assume the found PSYMTAB is always valid.

diff -u -rup gdb-addrmap-conservative/symtab.c gdb/symtab.c
--- ./gdb-addrmap-conservative/symtab.c	2007-12-09 17:59:30.000000000 +0100
+++ ./gdb/symtab.c	2007-12-09 20:42:33.000000000 +0100
@@ -760,83 +760,6 @@ matching_bfd_sections (asection *first, 
   return 0;
 }
 
-/* Find which partial symtab contains PC and SECTION starting at psymtab PST.
-   We may find a different psymtab than PST.  See FIND_PC_SECT_PSYMTAB.  */
-
-struct partial_symtab *
-find_pc_sect_psymtab_is_valid (CORE_ADDR pc, asection *section,
-			       struct partial_symtab *pst,
-			       struct minimal_symbol *msymbol)
-{
-  struct objfile *objfile = pst->objfile;
-  struct partial_symtab *tpst;
-  struct partial_symtab *best_pst = pst;
-  CORE_ADDR best_addr = pst->textlow;
-
-  /* An objfile that has its functions reordered might have
-     many partial symbol tables containing the PC, but
-     we want the partial symbol table that contains the
-     function containing the PC.  */
-  if (!(objfile->flags & OBJF_REORDERED) &&
-      section == 0)	/* can't validate section this way */
-    return pst;
-
-  if (msymbol == NULL)
-    return (pst);
-
-  /* The code range of partial symtabs sometimes overlap, so, in
-     the loop below, we need to check all partial symtabs and
-     find the one that fits better for the given PC address. We
-     select the partial symtab that contains a symbol whose
-     address is closest to the PC address.  By closest we mean
-     that find_pc_sect_symbol returns the symbol with address
-     that is closest and still less than the given PC.  */
-  for (tpst = pst; tpst != NULL; tpst = tpst->next)
-    {
-      if (pc >= tpst->textlow && pc < tpst->texthigh)
-	{
-	  struct partial_symbol *p;
-	  CORE_ADDR this_addr;
-
-	  /* NOTE: This assumes that every psymbol has a
-	     corresponding msymbol, which is not necessarily
-	     true; the debug info might be much richer than the
-	     object's symbol table.  */
-	  p = find_pc_sect_psymbol (tpst, pc, section);
-	  if (p != NULL
-	      && SYMBOL_VALUE_ADDRESS (p)
-	      == SYMBOL_VALUE_ADDRESS (msymbol))
-	    return tpst;
-
-	  /* Also accept the textlow value of a psymtab as a
-	     "symbol", to provide some support for partial
-	     symbol tables with line information but no debug
-	     symbols (e.g. those produced by an assembler).  */
-	  if (p != NULL)
-	    this_addr = SYMBOL_VALUE_ADDRESS (p);
-	  else
-	    this_addr = tpst->textlow;
-
-	  /* Check whether it is closer than our current
-	     BEST_ADDR.  Since this symbol address is
-	     necessarily lower or equal to PC, the symbol closer
-	     to PC is the symbol which address is the highest.
-	     This way we return the psymtab which contains such
-	     best match symbol. This can help in cases where the
-	     symbol information/debuginfo is not complete, like
-	     for instance on IRIX6 with gcc, where no debug info
-	     is emitted for statics. (See also the nodebug.exp
-	     testcase.) */
-	  if (this_addr > best_addr)
-	    {
-	      best_addr = this_addr;
-	      best_pst = tpst;
-	    }
-	}
-    }
-  return best_pst;
-}
-
 /* Find which partial symtab contains PC and SECTION.  Return 0 if
    none.  We return the psymtab that contains a symbol whose address
    exactly matches PC, or, if we cannot find an exact match, the
@@ -867,14 +790,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, asec
 
 	  pst = addrmap_find (objfile->psymtabs_addrmap, pc);
 	  if (pst != NULL)
-	    {
-	      struct partial_symtab *best_pst;
-
-	      best_pst = find_pc_sect_psymtab_is_valid (pc, section, pst,
-							msymbol);
-	      if (best_pst != NULL)
-		return best_pst;
-	    }
+	    return pst;
 	  /* Existing PSYMTABS_ADDRMAP should cover all the PSYMTABS of
 	     OBJFILE, there is no need to scan the remaining ones by hand.  */
 	}
@@ -884,14 +800,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, asec
 
 	  ALL_OBJFILE_PSYMTABS (objfile, pst)
 	    if (pc >= pst->textlow && pc < pst->texthigh)
-	      {
-		struct partial_symtab *best_pst;
-
-	        best_pst = find_pc_sect_psymtab_is_valid (pc, section, pst,
-							  msymbol);
-		if (best_pst != NULL)
-		  return best_pst;
-	      }
+	      return pst;
 	}
     }
 

  reply	other threads:[~2007-12-09 20:40 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                 ` Jan Kratochvil [this message]
2007-12-17  1:02                 ` 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                     ` [patch] [1/2] Discontiguous PSYMTABs (partial DIEs base address) Jan Kratochvil
2008-05-01 19:43                       ` 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=20071209204003.GB23339@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    --cc=jimb@codesourcery.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