Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Earl Chew <earl_chew@agilent.com>
To: "H. J. Lu" <hjl@lucon.org>
Cc: gdb@sources.redhat.com, drow@mvista.com, jimb@redhat.com
Subject: Re: Mystified by "Internal error: pc 0x89f21e10 read in psymtab, but not in symtab
Date: Sun, 15 Sep 2002 21:42:00 -0000	[thread overview]
Message-ID: <3D85614B.8010701@agilent.com> (raw)
In-Reply-To: <20020915133938.B19112@lucon.org>

H. J. Lu wrote:
> That patch is broken. See
> 
> http://sources.redhat.com/ml/gdb/2002-03/msg00197.html
> http://sources.redhat.com/ml/gdb/2002-03/msg00202.html
> 
> Unfortunately, no one seems to care.

I care, I care!

How eerie. I wrote a set of changes this morning, and now comparing
with your changes --- it's uncanny how close they are.

I enclose my patches below for you to peruse. I have some questions
regarding some minor differences:

a. I figured it was better in general to invoke the relocation function
    pointer with the section offset structure, and let each
    implementation figure out what relocations are required. I
    thought that some implementations (in the future) might cache
    things other than text locations (eg data locations).

b. In dbxread.c, I initialise the relocate_symtab pointer in
    start_psymtab _and_ end_psymtab (where the code loops and allocates
    new psymtabs and copies values across).

    Your patch doesn't initialise the function pointer here, and I
    believe that this will result in an uninitialised field.

Earl
-- 
--- ../../gdb-5.2.1-orig/gdb/dbxread.c	2002-04-04 13:33:50.000000000 -0800
+++ dbxread.c	2002-09-15 08:52:53.000000000 -0700
@@ -277,6 +277,9 @@

  static void read_ofile_symtab (struct partial_symtab *);

+static void dbx_relocate_psymtab (struct partial_symtab *,
+                                  struct section_offsets *delta);
+
  static void dbx_psymtab_to_symtab (struct partial_symtab *);

  static void dbx_psymtab_to_symtab_1 (struct partial_symtab *);
@@ -2193,6 +2196,7 @@
    TEXTHIGH (result) = result->texthigh;
    LDSYMOFF (result) = ldsymoff;
    result->read_symtab = dbx_psymtab_to_symtab;
+  result->relocate_symtab  = dbx_relocate_psymtab;
    SYMBOL_SIZE (result) = symbol_size;
    SYMBOL_OFFSET (result) = symbol_table_offset;
    STRING_OFFSET (result) = string_table_offset;
@@ -2351,6 +2355,7 @@
        subpst->readin = 0;
        subpst->symtab = 0;
        subpst->read_symtab = pst->read_symtab;
+      subpst->relocate_symtab = pst->relocate_symtab;
      }

    sort_pst_symbols (pst);
@@ -2436,6 +2441,15 @@
    pst->readin = 1;
  }

+/* Relocate the cached text offsets for this psymtab. */
+
+static void
+dbx_relocate_psymtab (struct partial_symtab *pst, struct 
section_offsets *delta)
+{
+    TEXTLOW (pst) += ANOFFSET (delta, SECT_OFF_TEXT (pst->objfile));
+    TEXTHIGH (pst) += ANOFFSET (delta, SECT_OFF_TEXT (pst->objfile));
+}
+
  /* Read in all of the symbols for a given psymtab for real.
     Be verbose about it if the user wants that.  */


--- ../../gdb-5.2.1-orig/gdb/objfiles.c	2001-12-06 11:59:12.000000000 -0800
+++ objfiles.c	2002-09-15 09:01:35.000000000 -0700
@@ -603,6 +603,9 @@
      {
        p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
        p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+
+      if (p->relocate_symtab)
+        (*p->relocate_symtab) (p, delta);
      }
    }


--- ../../gdb-5.2.1-orig/gdb/symfile.c	2002-06-22 09:49:34.000000000 -0700
+++ symfile.c	2002-09-15 21:28:55.000000000 -0700
@@ -2338,6 +2338,7 @@
    psymtab->section_offsets = section_offsets;
    psymtab->textlow = textlow;
    psymtab->texthigh = psymtab->textlow;		/* default */
+  psymtab->relocate_symtab = 0;
    psymtab->globals_offset = global_syms - objfile->global_psymbols.list;
    psymtab->statics_offset = static_syms - objfile->static_psymbols.list;
    return (psymtab);

--- ../../gdb-5.2.1-orig/gdb/symtab.h	2002-06-28 15:05:48.000000000 -0700
+++ symtab.h	2002-09-15 09:00:32.000000000 -0700
@@ -1029,6 +1029,11 @@

      void (*read_symtab) (struct partial_symtab *);

+    /* Pointer to function which will relocate the symtab corresponding to
+       this psymtab. May be 0 if no relocations are required. */
+
+    void (*relocate_symtab) (struct partial_symtab *, struct 
section_offsets *);
+
      /* Information that lets read_symtab() locate the part of the 
symbol table
         that this psymtab corresponds to.  This information is private 
to the
         format-dependent symbol reading routines.  For further detail 
examine


  parent reply	other threads:[~2002-09-16  4:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-13 14:42 Earl Chew
2002-09-13 15:01 ` Daniel Jacobowitz
2002-09-13 15:42   ` Earl Chew
2002-09-13 15:51     ` Daniel Jacobowitz
2002-09-13 16:13       ` Earl Chew
2002-09-13 18:32         ` Daniel Jacobowitz
2002-09-15  8:43           ` Earl Chew
2002-09-15  9:02             ` Daniel Jacobowitz
2002-09-15  9:11               ` Earl Chew
2002-09-15 13:39               ` H. J. Lu
2002-09-15 13:43                 ` Daniel Jacobowitz
2002-09-15 21:42                 ` Earl Chew [this message]
2002-09-16  7:03                   ` H. J. Lu
2002-09-16 12:26                     ` Jim Blandy
2002-09-16 13:01                       ` Earl Chew

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=3D85614B.8010701@agilent.com \
    --to=earl_chew@agilent.com \
    --cc=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=hjl@lucon.org \
    --cc=jimb@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