From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 21 17:32:27 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AE0C106566B for ; Mon, 21 Mar 2011 17:32:27 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.corbina.net (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id DA2128FC16 for ; Mon, 21 Mar 2011 17:32:26 +0000 (UTC) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.corbina.net (Postfix) with ESMTP id 76AABCBADF; Mon, 21 Mar 2011 20:32:18 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.22.99] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 310184608; Mon, 21 Mar 2011 20:32:18 +0300 Received: from dchagin.static.corbina.ru (localhost [127.0.0.1]) by dchagin.static.corbina.ru (8.14.4/8.14.4) with ESMTP id p2LHWAHj007705; Mon, 21 Mar 2011 20:32:10 +0300 (MSK) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.4/8.14.4/Submit) id p2LHW4Sn007704; Mon, 21 Mar 2011 20:32:04 +0300 (MSK) (envelope-from dchagin) Date: Mon, 21 Mar 2011 20:32:04 +0300 From: Chagin Dmitry To: Xingxing Pan Message-ID: <20110321173204.GA7575@dchagin.static.corbina.ru> References: <20110319174115.GA33282@dchagin.static.corbina.ru> <20110320071847.GA10579@dchagin.static.corbina.ru> <20110320181911.GA79862@dchagin.static.corbina.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org Subject: Re: GSoC'11: DWARF2 call frame information X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 17:32:27 -0000 --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 21, 2011 at 05:36:13PM +0800, Xingxing Pan wrote: > 2011/3/21 Chagin Dmitry : > >> powerfull script. > >> > >> Xingxing Pan > > > > hmm, which script? I think enough amd64, i386 and amd64/ia32. > > > > I suggest to write a example before continuing the conversation > > about the GSoC. For example (bcopy || bzero) && cpu_switch. > > Is it ok for you? > > > > -- > > Have fun! > > chd > > >=20 > Hi Chargin, >=20 > Thank you for your reply. > The followings shows how I try to add DWARF for bcopy. >=20 > --- ../8.2.0/sys/i386/include/asm.h 2011-03-21 14:35:56.111973722 +08= 00 > +++ asm.h 2011-03-21 15:25:31.564636162 +0800 > @@ -71,7 +71,7 @@ >=20 > #define _ENTRY(x) _START_ENTRY; \ > .globl CNAME(x); .type CNAME(x),@function; CNAME(= x): > -#define END(x) .size x, . - x > +#define END(x) .cfi_endproc; .size x, . - x >=20 > #ifdef PROF > #define ALTENTRY(x) _ENTRY(x); \ > @@ -80,9 +80,10 @@ > popl %ebp; \ > jmp 9f > #define ENTRY(x) _ENTRY(x); \ > - pushl %ebp; movl %esp,%ebp; \ > + .cfi_startproc; \ > + pushl %ebp; .cfi_adjust_cfa_offset 4; movl > %esp,%ebp; .cfi_def_cfa_register %ebp; \ > call PIC_PLT(HIDENAME(mcount)); \ > - popl %ebp; \ > + popl %ebp; .cfi_def_cfa %esp, 4; \ >=20 > --- bcopy.S 2011-03-21 15:51:26.804203809 +0800 > +++ ../8.2.0/lib/libc/i386/string/bcopy.S 2011-03-21 > 14:28:15.023069890 +0800 > @@ -51,9 +51,7 @@ ENTRY(bcopy) > #endif > #endif > pushl %esi > - .cfi_adjust_cfa_offset 4; > pushl %edi > - .cfi_adjust_cfa_offset 4; > #if defined(MEMCOPY) || defined(MEMMOVE) > movl 12(%esp),%edi > movl 16(%esp),%esi > @@ -77,9 +75,7 @@ ENTRY(bcopy) > rep > movsb > popl %edi > - .cfi_adjust_cfa_offset -4; > popl %esi > - .cfi_adjust_cfa_offset -4; > ret > 1: > addl %ecx,%edi /* copy backwards. */ > @@ -98,9 +94,7 @@ ENTRY(bcopy) > rep > movsl > popl %edi > - .cfi_adjust_cfa_offset -4; > popl %esi > - .cfi_adjust_cfa_offset -4; > cld > ret > #ifdef MEMCOPY >=20 > But I don't know how to add DWARF for cpu_switch, because I have no > idea about the circumstance when we need to backtrace through this > function. Suppose there's a cpu switch like this, > threadA->kernel->threadB. Then should the expected backtrace has the > following result? >=20 > threadB's stack > kernel's stack > threadA's stack hmm, ok. good, avoid cpu_switch. First of all, please, read style(9) man page. In the second, evaluate the proposed plan (discussed with kib@): 1) Annotate libc, msun, rtld, libthr (you) 2) vdso (I'm) 3) Annotate signal trampolines (you, after vdso) And i'm going to understand what I need to do to start GSoC for you. Thanks! --=20 Have fun! chd --wRRV7LY7NUeQGEoC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAk2Hi5MACgkQ0t2Tb3OO/O3rTACg0XJGhmPRSfhehoO7uwQKaD+R qxIAoKzWWBBtMUZIW5vH29ArSc4O/OOz =iV/9 -----END PGP SIGNATURE----- --wRRV7LY7NUeQGEoC--