diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/symtab.c | 49 | ||||
-rw-r--r-- | gdb/symtab.h | 21 |
3 files changed, 46 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a3b59d6..bd6ac80 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ Mon Nov 1 09:40:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + * symtab.c, symtab.h, source.c: Change find_line_pc_range to take + a struct symtab_and_line argument, rather than a symtab and a line. + Re-write it to be based on the address rather than bogusly adding + one to the line number and hoping that has something to do with the + end of the line. + * config/m88k/m88k.mh (NATDEPFILES): Remove exec.o. * paread.c (pa_symtab_read): Change comments to say ignoring diff --git a/gdb/symtab.c b/gdb/symtab.c index 43fb383..ae91118 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1280,37 +1280,44 @@ find_line_pc (symtab, line) Returns 0 if could not find the specified line. */ int -find_line_pc_range (symtab, thisline, startptr, endptr) - struct symtab *symtab; - int thisline; +find_line_pc_range (sal, startptr, endptr) + struct symtab_and_line sal; CORE_ADDR *startptr, *endptr; { struct linetable *l; int ind; int exact_match; /* did we get an exact linenumber match */ + CORE_ADDR startaddr; + struct symtab_and_line found_sal; - if (symtab == 0) + startaddr = sal.pc; + if (startaddr == 0) + { + startaddr = find_line_pc (sal.symtab, sal.line); + } + if (startaddr == 0) return 0; - if (find_line_symtab (symtab, thisline, &l, &ind, &exact_match)) + /* This whole function is based on address. For example, if line 10 has + two parts, one from 0x100 to 0x200 and one from 0x300 to 0x400, then + "info line *0x123" should say the line goes from 0x100 to 0x200 + and "info line *0x355" should say the line goes from 0x300 to 0x400. + This also insures that we never give a range like "starts at 0x134 + and ends at 0x12c". */ + + found_sal = find_pc_line (startaddr, 0); + if (found_sal.line != sal.line) { - *startptr = l->item[ind].pc; - /* If we have not seen an entry for the specified line, - assume that means the specified line has zero bytes. */ - if (!exact_match || ind == l->nitems-1) - *endptr = *startptr; - else - /* Perhaps the following entry is for the following line. - It's worth a try. */ - if (ind+1 < l->nitems - && l->item[ind+1].line == thisline + 1) - *endptr = l->item[ind+1].pc; - else - *endptr = find_line_pc (symtab, thisline+1); - return 1; + /* The specified line (sal) has zero bytes. */ + *startptr = found_sal.pc; + *endptr = found_sal.pc; } - - return 0; + else + { + *startptr = found_sal.pc; + *endptr = found_sal.end; + } + return 1; } /* Given a line table and a line number, return the index into the line diff --git a/gdb/symtab.h b/gdb/symtab.h index b215168..69a83a8 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -85,8 +85,9 @@ struct general_symbol_info /* Which section is this symbol in? This is an index into section_offsets for this objfile. Negative means that the symbol does not get relocated relative to a section. - Disclaimer: currently this is just used for xcoff, so don't expect - all symbol-reading code to set it correctly. */ + Disclaimer: currently this is just used for xcoff, so don't + expect all symbol-reading code to set it correctly (the ELF code + also tries to set it correctly). */ int section; }; @@ -680,7 +681,7 @@ struct section_offsets #define ANOFFSET(secoff, whichone) (secoff->offsets[whichone]) -/* Each source file is represented by a struct symtab. +/* Each source file or header is represented by a struct symtab. These objects are chained through the `next' field. */ struct symtab @@ -690,12 +691,14 @@ struct symtab struct symtab *next; - /* List of all symbol scope blocks for this symtab. */ + /* List of all symbol scope blocks for this symtab. May be shared + between different symtabs (and normally is for all the symtabs + in a given compilation unit). */ struct blockvector *blockvector; /* Table mapping core addresses to line numbers for this file. - Can be NULL if none. */ + Can be NULL if none. Never shared between different symtabs. */ struct linetable *linetable; @@ -722,7 +725,8 @@ struct symtab free_contents => do a tree walk and free each object. free_nothing => do nothing; some other symtab will free the data this one uses. - free_linetable => free just the linetable. */ + free_linetable => free just the linetable. FIXME: Is this redundant + with the primary field? */ enum free_code { @@ -992,8 +996,6 @@ lookup_minimal_symbol PARAMS ((const char *, struct objfile *)); extern struct minimal_symbol * lookup_minimal_symbol_by_pc PARAMS ((CORE_ADDR)); -extern struct minimal_symbol *lookup_next_minimal_symbol PARAMS ((CORE_ADDR)); - extern void init_minimal_symbol_collection PARAMS ((void)); @@ -1034,7 +1036,8 @@ extern CORE_ADDR find_line_pc PARAMS ((struct symtab *, int)); extern int -find_line_pc_range PARAMS ((struct symtab *, int, CORE_ADDR *, CORE_ADDR *)); +find_line_pc_range PARAMS ((struct symtab_and_line, int, + CORE_ADDR *, CORE_ADDR *)); extern void resolve_sal_pc PARAMS ((struct symtab_and_line *)); |