From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 6 23:49:57 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 647BAD1; Fri, 6 Sep 2013 23:49:57 +0000 (UTC) (envelope-from shrikanth07@gmail.com) Received: from mail-vc0-x22c.google.com (mail-vc0-x22c.google.com [IPv6:2607:f8b0:400c:c03::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1808327E7; Fri, 6 Sep 2013 23:49:57 +0000 (UTC) Received: by mail-vc0-f172.google.com with SMTP id m17so2616780vca.17 for ; Fri, 06 Sep 2013 16:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nx9j1tPvNPZKopY+Lr9A0v33BXahgpY9iygPVsigij0=; b=znnNyS1LzAP8pQfiPYrqbQRfsq/cnHAXzpjziqo3V5L4OFF2L+Iy+QYpi+pX+8gLQH sGWomN9OSaCSSxXOZ7BtrJd0BkPokXT+MrnavjYACAhdB/9/suyw0rzO1I3NXURxHdFL TJYeHn5BqdCK5K1WIw2W6KTdQZUhYmzPhCBsLKx3TZZzzq1y7rcZ2TM2hztTey4jkqJx Xl7RLerwkaUd8M/KgYBvVZnPdukcjquJ5gbWOV/IHSgeXWRm0Lgx0AW7gvcPiQhFSdQk poZdBwk82nk5EfdcQlcvTEceQnZJg4fFGFcWlit2P+izLD87F+nN+0FoiI5pMbBeztti PSng== MIME-Version: 1.0 X-Received: by 10.58.198.13 with SMTP id iy13mr4799048vec.11.1378511396144; Fri, 06 Sep 2013 16:49:56 -0700 (PDT) Received: by 10.59.1.70 with HTTP; Fri, 6 Sep 2013 16:49:56 -0700 (PDT) Date: Fri, 6 Sep 2013 16:49:56 -0700 Message-ID: Subject: Glitch in ctfconvert From: Shrikanth Kamath To: freebsd-hackers@freebsd.org, freebsd-dtrace@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2013 23:49:57 -0000 There is a glitch with ctfconvert builds the .SUNW_ctf section. It affects debugging the kernel modules with FBT provider of DTrace. I observe that the CTF sections built for the kernel modules have a problem if module symtab stripped or if the symbol table has symbols reordered. This messes up the FBT probes and shows wrong function name against a set of arguments. I presume the ctf mapping of a function to its arguments is done this way after looking at ctfdump code. func_name from symtab arguments dump from ctf_data_t ^ ^ |___symidx____ctfdump_____________| The detais are fetched from two different places. So when ctfconvert is run the function arguments are mapped with a particular symbol order. Post the linker stage the symbols may get reordered. Or if a strip utility is run the symtab may be removed completely. When first ctfconvert is run on module.kld symbol_X (idx 1) <-> [args set a in ctf_data_t] symbol_Y (idx 2) <-> [args set b in ctf_data_t] if symbols get re-arranged post the linker stage symbol_Y (idx 1) <-> [args set a in ctf_data_t] symbol_X (idx 2) <-> [args set b in ctf_data_t] which means symbol_Y now has args set of symbol_X Or if 'strip' is run it has totally junk shown against symbol_Y and symbol_X. Overall this affects when we do a Function Boundary Tracing on the functions to inspect arguments.