From owner-freebsd-bugs Sat Nov 20 22:20: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 6B3531509E for ; Sat, 20 Nov 1999 22:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA65227; Sat, 20 Nov 1999 22:20:00 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from smtp10.atl.mindspring.net (smtp10.atl.mindspring.net [207.69.200.246]) by hub.freebsd.org (Postfix) with ESMTP id EE52414F2F for ; Sat, 20 Nov 1999 22:14:14 -0800 (PST) (envelope-from vsilyaev@mindspring.com) Received: from mindspring.com (user-2ivebbs.dialup.mindspring.com [165.247.45.124]) by smtp10.atl.mindspring.net (8.9.3/8.8.5) with ESMTP id BAA22308 for ; Sun, 21 Nov 1999 01:14:05 -0500 (EST) Received: (from vsilyaev@localhost) by mindspring.com (8.9.3/8.9.3) id BAA00543; Sun, 21 Nov 1999 01:14:03 -0500 (EST) (envelope-from vsilyaev) Message-Id: <199911210614.BAA00543@mindspring.com> Date: Sun, 21 Nov 1999 01:14:03 -0500 (EST) From: vns@delta.odessa.ua Reply-To: vns@delta.odessa.ua To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/15014: DDB can't find symbol for address in kernel loadable modules. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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