diff options
author | peter <peter@FreeBSD.org> | 1999-11-28 11:59:18 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-11-28 11:59:18 +0000 |
commit | 348a0952c02bda458f18c33d2836f297f2979c6a (patch) | |
tree | 2c87237c19fffad9cfdd7f00e3a7ca98078d6a4c /sys | |
parent | fa90e16b7d97621b55c84e4203a37877b598876f (diff) | |
download | FreeBSD-src-348a0952c02bda458f18c33d2836f297f2979c6a.zip FreeBSD-src-348a0952c02bda458f18c33d2836f297f2979c6a.tar.gz |
Fix an embarresing mistake in the kld symbol lookup for DDB. It should
now correctly do a traceback when crashing inside a KLD module.
PR: 15014
Submitted by: Vladimir N. Silyaev <vns@delta.odessa.ua>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/link_elf.c | 10 | ||||
-rw-r--r-- | sys/kern/link_elf_obj.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 8c12566..ab4abf8 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -958,17 +958,19 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value, const Elf_Sym* es; const Elf_Sym* best = 0; int i; + u_long st_value; for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) { if (es->st_name == 0) continue; - if (off >= es->st_value) { - if (off - es->st_value < diff) { - diff = off - es->st_value; + st_value = es->st_value + (u_long)ef->address; + if (off >= st_value) { + if (off - st_value < diff) { + diff = off - st_value; best = es; if (diff == 0) break; - } else if (off - es->st_value == diff) { + } else if (off - st_value == diff) { best = es; } } diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 8c12566..ab4abf8 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -958,17 +958,19 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value, const Elf_Sym* es; const Elf_Sym* best = 0; int i; + u_long st_value; for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) { if (es->st_name == 0) continue; - if (off >= es->st_value) { - if (off - es->st_value < diff) { - diff = off - es->st_value; + st_value = es->st_value + (u_long)ef->address; + if (off >= st_value) { + if (off - st_value < diff) { + diff = off - st_value; best = es; if (diff == 0) break; - } else if (off - es->st_value == diff) { + } else if (off - st_value == diff) { best = es; } } |