Date: Sun, 21 Nov 1999 01:14:03 -0500 (EST) From: vns@delta.odessa.ua To: FreeBSD-gnats-submit@freebsd.org Subject: kern/15014: DDB can't find symbol for address in kernel loadable modules. Message-ID: <199911210614.BAA00543@mindspring.com>
next in thread | raw e-mail | index | archive | help
>Number: 15014 >Category: kern >Synopsis: DDB can't find symbol for address in kernel loadable modules. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 20 22:20:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Vladimir N. Silyaev >Release: FreeBSD 4.0-CURRENT i386 >Organization: >Environment: FreeBSD 4.0-CURRENT i386 ELF kernel ELF KLD >Description: DDB can't locate names to stack frame, when frames include pointer from kernel loadable module >How-To-Repeat: - Build kernel with DDB support. - Load linux KLD (launch linux command). Throw to DDB, then db> b linux_open db> c Run any linux command, for example: > /compat/linux/bin/bash Breakpoint at linux_open: pushl %ebp db> trace _end(c4324280,c45f3f80,28051dc6,3,28054a10) at 0xc06ef344 syscall(2f,2f,2f,28054a10,3) at syscall+0x119 Xint0x80_syscall() at Xint0x80_syscall+0x26 db> c >Fix: Apply the following patch. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --- /sys/kern/link_elf.c.orig Fri Oct 29 18:12:02 1999 +++ /sys/kern/link_elf.c Sat Nov 20 17:51:16 1999 @@ -958,17 +958,19 @@ 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; } } -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- After applying this patch, in the same circumstance, trace will be printing: db> trace linux_open(c4324280,c45f3f80,28051dc6,3,28054a10) at linux_open syscall(2f,2f,2f,28054a10,3) at syscall+0x119 Xint0x80_syscall() at Xint0x80_syscall+0x26 P.S. It's looks like that the /sys/kern/link_aout.c have the same kind of problem. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911210614.BAA00543>