aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-08-26 11:11:43 +0000
committerNick Clifton <nickc@redhat.com>1999-08-26 11:11:43 +0000
commite1c05f12ca540a443f91f3eee91dfb6903cedac5 (patch)
tree63dcf1b016d29eaef45ef897468fe2394a4ca03b
parent75d74c48272da679fec925ad7f60c62b998f8185 (diff)
downloadgdb-e1c05f12ca540a443f91f3eee91dfb6903cedac5.zip
gdb-e1c05f12ca540a443f91f3eee91dfb6903cedac5.tar.gz
gdb-e1c05f12ca540a443f91f3eee91dfb6903cedac5.tar.bz2
Applied patch from Jim Wilson to fix several bugs in line table generation.
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/dwarf2dbg.c16
2 files changed, 19 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 052d746..495eb49 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+1999-08-26 Jim Wilson <wilson@cygnus.com>
+
+ * dwarf2dbg.c (out_end_sequence): Correct comments. Set last to
+ ls.last_filename if last is less than zero. Set ls.last_filename
+ when allocating new entry.
+ (dwarf2_gen_line_info): Save seg and subseg info before subseg_new
+ call.
+
1999-08-20 Alan Modra <alan@spri.levels.unisa.edu.au>
* config/tc-i386.c (i386_index_check): Fix the displacement size
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 5e447ab..230e189 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -359,7 +359,7 @@ out_end_sequence ()
/* Look up a filenumber either by filename or by filenumber. If both
a filenumber and a filename are specified, lookup by filename takes
precedence. If the filename cannot be found, it is added to the
- filetable the filenumber for the new entry is returned. */
+ filetable and the filenumber for the new entry is returned. */
static int
get_filenum (filenum, file)
int filenum;
@@ -368,10 +368,12 @@ get_filenum (filenum, file)
int i, last = filenum - 1;
char char0 = file[0];
- if (last >= ls.num_filenames)
+ /* If filenum is out of range of the filename table, then try using the
+ table entry returned from the previous call. */
+ if (last >= ls.num_filenames || last < 0)
last = ls.last_filename;
- /* do a quick check against the previously used filename: */
+ /* Do a quick check against the specified or previously used filenum. */
if (ls.num_filenames > 0 && ls.file[last].name[0] == char0
&& strcmp (ls.file[last].name + 1, file + 1) == 0)
return last + 1;
@@ -395,6 +397,7 @@ get_filenum (filenum, file)
}
ls.file[ls.num_filenames].dir = 0;
ls.file[ls.num_filenames].name = file;
+ ls.last_filename = ls.num_filenames;
return ++ls.num_filenames;
}
@@ -425,6 +428,11 @@ dwarf2_gen_line_info (addr, l)
else
return; /* no filename, no filnum => no play */
+ /* Must save these before the subseg_new call, as that call will change
+ them. */
+ saved_seg = now_seg;
+ saved_subseg = now_subseg;
+
if (!ls.line_seg)
{
#ifdef BFD_ASSEMBLER
@@ -445,8 +453,6 @@ dwarf2_gen_line_info (addr, l)
#endif
}
- saved_seg = now_seg;
- saved_subseg = now_subseg;
subseg_set (ls.line_seg, DL_BODY);
if (ls.text_seg != saved_seg || ls.text_subseg != saved_subseg)