Add the needed binary search to find line numbers.

This commit is contained in:
Danila Fedorin 2019-04-04 20:37:40 -07:00
parent b0880daaa3
commit 8ef5e2f810
1 changed files with 6 additions and 0 deletions

View File

@ -180,6 +180,12 @@ debuginfo_eip(uintptr_t addr, struct Eipdebuginfo *info)
// Look at the STABS documentation and <inc/stab.h> to find
// which one.
// Your code here.
stab_binsearch(stabs, &lline, &rline, N_SLINE, addr);
if(lline <= rline) {
info->eip_line = stabs[lline].n_desc;
} else {
info->eip_line = -1;
}
// Search backwards from the line number for the relevant filename