diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-11-02 00:05:34 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-11-02 00:05:34 +0000 |
commit | b86a1b3baa014c5fdb3ba8db34c8991fd4e768e1 (patch) | |
tree | 2ccf05c177a1ff062dafaf727d3849df74dee0ca /gdb/symtab.c | |
parent | f2e945df056230b8cd1354e28f415d4aea08a918 (diff) | |
download | gdb-b86a1b3baa014c5fdb3ba8db34c8991fd4e768e1.zip gdb-b86a1b3baa014c5fdb3ba8db34c8991fd4e768e1.tar.gz gdb-b86a1b3baa014c5fdb3ba8db34c8991fd4e768e1.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 49 |
1 files changed, 28 insertions, 21 deletions
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 |