X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fdwarfread.c;h=bd92ad15be4a2533fc2bc8ea7ea550b0bd9e73ab;hb=987622b523bff105af2ebdfb33ef7c4c99b03def;hp=8c13087095f1b032e8c287a19584cbec01ccd0e4;hpb=f133a597e48d6c22b57a5c90f0c6f6059b2e3bc3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 8c13087095..bd92ad15be 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1,5 +1,5 @@ /* DWARF debugging format support for GDB. - Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. Portions based on dbxread.c, mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port. @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* @@ -51,17 +51,12 @@ other things to work on, if you get bored. :-) #include "complaints.h" #include -#include +#include "gdb_string.h" #ifndef NO_SYS_FILE #include #endif -/* FIXME -- convert this to SEEK_SET a la POSIX, move to config files. */ -#ifndef L_SET -#define L_SET 0 -#endif - /* Some macros to provide DIE info for complaints. */ #define DIE_ID (curdie!=NULL ? curdie->die_ref : 0) @@ -327,6 +322,7 @@ static int dbsize; /* Size of dwarf info in bytes */ static int dbroff; /* Relative offset from start of .debug section */ static char *lnbase; /* Base pointer to line section */ static int isreg; /* Kludge to identify register variables */ +static int optimized_out; /* Kludge to identify optimized out variables */ /* Kludge to identify basereg references. Nonzero if we have an offset relative to a basereg. */ static int offreg; @@ -730,7 +726,7 @@ dwarf_build_psymtabs (objfile, section_offsets, mainline, dbfoff, dbfsize, dbsize = dbfsize; dbbase = xmalloc (dbsize); dbroff = 0; - if ((bfd_seek (abfd, dbfoff, L_SET) != 0) || + if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) || (bfd_read (dbbase, dbsize, 1, abfd) != dbsize)) { free (dbbase); @@ -2151,6 +2147,9 @@ DESCRIPTION Given pointer to a string of bytes that define a location, compute the location and return the value. + A location description containing no atoms indicates that the + object is optimized out. The global optimized_out flag is set for + those, the return value is meaningless. When computing values involving the current value of the frame pointer, the value zero is used, which results in a value relative to the frame @@ -2189,9 +2188,11 @@ locval (loc) stack[stacki] = 0; isreg = 0; offreg = 0; + optimized_out = 1; loc_value_size = TARGET_FT_LONG_SIZE (current_objfile); while (loc < end) { + optimized_out = 0; loc_atom_code = target_to_host (loc, SIZEOF_LOC_ATOM_CODE, GET_UNSIGNED, current_objfile); loc += SIZEOF_LOC_ATOM_CODE; @@ -2290,7 +2291,7 @@ read_ofile_symtab (pst) foffset = DBFOFF(pst) + dbroff; base_section_offsets = pst->section_offsets; baseaddr = ANOFFSET (pst->section_offsets, 0); - if (bfd_seek (abfd, foffset, L_SET) || + if (bfd_seek (abfd, foffset, SEEK_SET) || (bfd_read (dbbase, dbsize, 1, abfd) != dbsize)) { free (dbbase); @@ -2306,7 +2307,7 @@ read_ofile_symtab (pst) lnbase = NULL; if (LNFOFF (pst)) { - if (bfd_seek (abfd, LNFOFF (pst), L_SET) || + if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) || (bfd_read ((PTR) lnsizedata, sizeof (lnsizedata), 1, abfd) != sizeof (lnsizedata))) { @@ -2315,7 +2316,7 @@ read_ofile_symtab (pst) lnsize = target_to_host (lnsizedata, SIZEOF_LINETBL_LENGTH, GET_UNSIGNED, pst -> objfile); lnbase = xmalloc (lnsize); - if (bfd_seek (abfd, LNFOFF (pst), L_SET) || + if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) || (bfd_read (lnbase, lnsize, 1, abfd) != lnsize)) { free (lnbase); @@ -2934,7 +2935,11 @@ new_symbol (dip, objfile) { SYMBOL_VALUE (sym) = locval (dip -> at_location); add_symbol_to_list (sym, list_in_scope); - if (isreg) + if (optimized_out) + { + SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; + } + else if (isreg) { SYMBOL_CLASS (sym) = LOC_REGISTER; }