aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffread.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-03-12 23:12:59 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-03-12 23:12:59 +0000
commit2aefe6e4ae94d53cb92cedc371f3602853945e68 (patch)
tree7334fafa88c5a1d6025840d794f3917b57ea7757 /gdb/xcoffread.c
parent2e0e34505d83ac0495f71d14d5d0abaf94b2f1f7 (diff)
downloadgdb-2aefe6e4ae94d53cb92cedc371f3602853945e68.zip
gdb-2aefe6e4ae94d53cb92cedc371f3602853945e68.tar.gz
gdb-2aefe6e4ae94d53cb92cedc371f3602853945e68.tar.bz2
Fri Mar 12 09:33:23 1993 Jim Kingdon (kingdon@cygnus.com)
* xcoffread.c (retrieve_tracebackinfo): Move assignment out of while condition. * xcoffread.c (enter_line_range): complain() on bad endoffset. xcoffread.c: Doc fixes. Tue Mar 9 09:56:12 1993 Jim Kingdon (kingdon@cygnus.com) * tm-rs6000.h (CORE_NEEDS_RELOCATION): Just call xcoff_relocate_core. xcoffexec.c (xcoff_relocate_core): New function. (text_adjustment): Removed. (add_vmap): Return the vmap. rs6000-tdep.c (add_text_to_loadinfo): No longer static. Fri Mar 5 05:22:46 1993 Jim Kingdon (kingdon@cygnus.com) * xcoffsolib.h: Add objfile member to struct vmap. xcoff{exec,solib}.c: Use it, not lookup_objfile_bfd. xcoffexec.c (add_vmap): Allocate objfiles here.
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r--gdb/xcoffread.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 147b45f..77cf835 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -438,7 +438,11 @@ static unsigned first_fun_bf;
typedef struct _inclTable {
char *name; /* include filename */
- int begin, end; /* offsets to the line table */
+
+ /* Offsets to the line table. end points to the last entry which is
+ part of this include file. */
+ int begin, end;
+
struct subfile *subfile;
unsigned funStartLine; /* start line # of its function */
} InclTable;
@@ -670,7 +674,10 @@ aix_process_linenos ()
/* Enter a given range of lines into the line vector.
can be called in the following two ways:
enter_line_range (subfile, beginoffset, endoffset, startaddr, 0, firstLine) or
- enter_line_range (subfile, beginoffset, 0, startaddr, endaddr, firstLine) */
+ enter_line_range (subfile, beginoffset, 0, startaddr, endaddr, firstLine)
+
+ endoffset points to the last line table entry that we should pay
+ attention to. */
static void
enter_line_range (subfile, beginoffset, endoffset, startaddr, endaddr, firstLine)
@@ -688,6 +695,13 @@ enter_line_range (subfile, beginoffset, endoffset, startaddr, endaddr, firstLine
#define P_LINESYM(PP) (*(long*)((struct external_lineno*)(PP))->l_addr.l_symndx)
pp = &linetab [beginoffset - linetab_offset];
+ if (endoffset != 0 && endoffset - linetab_offset >= linetab_size)
+ {
+ static struct complaint msg =
+ {"Bad line table offset in C_EINCL directive", 0, 0};
+ complain (&msg);
+ return;
+ }
limit = endoffset ? &linetab [endoffset - linetab_offset]
: &linetab [linetab_size -1];
@@ -732,9 +746,10 @@ retrieve_tracebackinfo (abfd, textsec, cs)
struct coff_symbol *cs;
{
#define TBTABLE_BUFSIZ 2000
-#define MIN_TBTABSIZ 50 /* minimum buffer size to hold a
- traceback table. */
+ /* Minimum buffer size to hold a traceback table. */
+#define MIN_TBTABSIZ 50
+
static TracebackInfo tbInfo;
struct tbtable *ptb;
@@ -751,13 +766,16 @@ retrieve_tracebackinfo (abfd, textsec, cs)
/* keep reading blocks of data from the text section, until finding a zero
word and a traceback table. */
- while (
- bufferbytes = (
- (TBTABLE_BUFSIZ < (textsec->_raw_size - functionstart - bytesread)) ?
- TBTABLE_BUFSIZ : (textsec->_raw_size - functionstart - bytesread))
-
- && bfd_get_section_contents (abfd, textsec, buffer,
- (file_ptr)(functionstart + bytesread), bufferbytes))
+ /* Note: The logical thing way to write this code would be to assign
+ to bufferbytes within the while condition. But that triggers a
+ compiler (xlc in AIX 3.2) bug, so simplify it... */
+ bufferbytes =
+ (TBTABLE_BUFSIZ < (textsec->_raw_size - functionstart - bytesread) ?
+ TBTABLE_BUFSIZ : (textsec->_raw_size - functionstart - bytesread));
+ while (bufferbytes
+ && (bfd_get_section_contents
+ (abfd, textsec, buffer,
+ (file_ptr)(functionstart + bytesread), bufferbytes)))
{
bytesread += bufferbytes;
pinsn = (int*) buffer;
@@ -796,6 +814,7 @@ retrieve_tracebackinfo (abfd, textsec, cs)
if (!tbInfo.framesize)
return NULL;
+
}
/* look for a zero word. */
@@ -839,6 +858,9 @@ retrieve_tracebackinfo (abfd, textsec, cs)
tbInfo.parminfo = ptb->tb_ext.parminfo;
return &tbInfo;
}
+ bufferbytes =
+ (TBTABLE_BUFSIZ < (textsec->_raw_size - functionstart - bytesread) ?
+ TBTABLE_BUFSIZ : (textsec->_raw_size - functionstart - bytesread));
}
return NULL;
}
@@ -1918,7 +1940,9 @@ process_xcoff_symbol (cs, objfile)
return sym2;
}
-
+/* FIXME: Somewhere in here we should check to see that symno is a
+ valid number, so that we can print an error message on corrupt input
+ files rather than dumping core. */
static int
read_symbol_nvalue (symtable, symno)
char *symtable;