aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-07-19 06:45:19 +0000
committerJohn Gilmore <gnu@cygnus>1991-07-19 06:45:19 +0000
commitc3a218018052de5bfcda2ebd6e1f1f930fe19fc8 (patch)
tree0bc9508958b05bb37d315e92e593b79dcfb4c00a /gdb
parent3d6c6501891ab37f334c209e065ad0e7a2cd5a74 (diff)
downloadgdb-c3a218018052de5bfcda2ebd6e1f1f930fe19fc8.zip
gdb-c3a218018052de5bfcda2ebd6e1f1f930fe19fc8.tar.gz
gdb-c3a218018052de5bfcda2ebd6e1f1f930fe19fc8.tar.bz2
Eliminate LOC_EXTERNAL. Improve select_source_symtab. Bug fixes.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/core.c2
-rw-r--r--gdb/dbxread.c30
-rwxr-xr-xgdb/expread.y1
-rw-r--r--gdb/values.c16
4 files changed, 21 insertions, 28 deletions
diff --git a/gdb/core.c b/gdb/core.c
index 3a6a071..842e712 100644
--- a/gdb/core.c
+++ b/gdb/core.c
@@ -78,7 +78,7 @@ core_open (filename, from_tty)
char *filename;
int from_tty;
{
- char *p;
+ const char *p;
int siggy;
struct cleanup *old_chain;
char *temp;
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 4644fef..619c471 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -3,19 +3,19 @@
This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Symbol read-in occurs in two phases:
1. A scan (read_dbx_symtab()) of the entire executable, whose sole
@@ -28,16 +28,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
when a symbol in a file for which symbols have not yet been
read in is referenced. */
-/* There used to be some PROFILE_TYPES code in this file which counted
- the number of occurances of various symbols. I'd suggest instead:
- nm -ap foo | awk 'print $5' | sort | uniq -c
- to print how many of each n_type, or something like
- nm -ap foo | awk '$5 == "LSYM" {print $6 $7 $8 $9 $10 $11}' | \
- awk 'BEGIN {FS=":"}
- {print substr($2,1,1)}' | sort | uniq -c
- to print the number of each kind of symbol descriptor (i.e. the letter
- after ':'). */
-
#include <stdio.h>
#include <string.h>
#include "defs.h"
@@ -1325,10 +1315,6 @@ dbx_symfile_read (sf, addr, mainline)
free (info);
sf->sym_private = 0; /* Zap pointer to our (now gone) info struct */
- /* Call to select_source_symtab used to be here; it was using too
- much time. I'll make sure that list_sources can handle the lack
- of current_source_symtab */
-
if (!partial_symtab_list)
printf_filtered ("\n(no debugging symbols found)...");
}
@@ -2200,8 +2186,10 @@ read_dbx_symtab (symfile_name, addr,
continue;
case 'G':
bufp->n_value += addr; /* Relocate */
+ /* The addresses in these entries are reported to be
+ wrong. See the code that reads 'G's for symtabs. */
ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
- VAR_NAMESPACE, LOC_EXTERNAL,
+ VAR_NAMESPACE, LOC_STATIC,
global_psymbols, bufp->n_value);
continue;
diff --git a/gdb/expread.y b/gdb/expread.y
index 597b424..d05383f 100755
--- a/gdb/expread.y
+++ b/gdb/expread.y
@@ -667,7 +667,6 @@ variable: name_not_typename
case LOC_TYPEDEF:
case LOC_LABEL:
case LOC_BLOCK:
- case LOC_EXTERNAL:
case LOC_CONST_BYTES:
/* In this case the expression can
diff --git a/gdb/values.c b/gdb/values.c
index c86ecc9..1c11d4e 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -1352,7 +1352,8 @@ unpack_field_as_long (type, valaddr, fieldno)
val = val >> (bitpos % 8);
#endif
- val &= (1 << bitsize) - 1;
+ if (bitsize < 8 * sizeof (val))
+ val &= (((unsigned long)1) << bitsize) - 1;
return val;
}
@@ -1369,9 +1370,10 @@ modify_field (addr, fieldval, bitpos, bitsize)
{
long oword;
- /* Reject values too big to fit in the field in question.
- Otherwise adjoining fields may be corrupted. */
- if (fieldval & ~((1<<bitsize)-1))
+ /* Reject values too big to fit in the field in question,
+ otherwise adjoining fields may be corrupted. */
+ if ((0 != fieldval & ~((1<<bitsize)-1))
+ && bitsize < 8 * sizeof (fieldval))
error ("Value %d does not fit in %d bits.", fieldval, bitsize);
bcopy (addr, &oword, sizeof oword);
@@ -1382,7 +1384,11 @@ modify_field (addr, fieldval, bitpos, bitsize)
bitpos = sizeof (oword) * 8 - bitpos - bitsize;
#endif
- oword &= ~(((1 << bitsize) - 1) << bitpos);
+ /* Mask out old value, while avoiding shifts >= longword size */
+ if (bitsize < 8 * sizeof (oword))
+ oword &= ~(((((unsigned long)1) << bitsize) - 1) << bitpos);
+ else
+ oword &= ~((-1) << bitpos);
oword |= fieldval << bitpos;
SWAP_TARGET_AND_HOST (&oword, sizeof oword); /* To target format */