Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Mar 2011 23:15:25 +0800
From:      Xingxing Pan <panxingxing@mprc.pku.edu.cn>
To:        Chagin Dmitry <dchagin@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: GSoC'11: DWARF2 call frame information
Message-ID:  <AANLkTindWYpEKEYXVOC5YTEM2ySTpSTC9c9jPSGPe=Yq@mail.gmail.com>
In-Reply-To: <20110321173204.GA7575@dchagin.static.corbina.ru>
References:  <AANLkTinz6B7fsG7Cjc3ZTZ0OAmsOG8x1P25EfOE7Bt4J@mail.gmail.com> <20110319174115.GA33282@dchagin.static.corbina.ru> <AANLkTimp9qoOFr0VfK1F_r1nE3n_5d7W2-q_vSK_UzgW@mail.gmail.com> <20110320071847.GA10579@dchagin.static.corbina.ru> <AANLkTinxVYZcfvpj4mn7kd%2BfiJ83p7430JSsqxatHCeZ@mail.gmail.com> <20110320181911.GA79862@dchagin.static.corbina.ru> <AANLkTinx%2Bv5ZRr7zq%2BP8gW=umX3PNvhfXpgW8bmUZdtw@mail.gmail.com> <20110321173204.GA7575@dchagin.static.corbina.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/3/22 Chagin Dmitry <dchagin@freebsd.org>:
> On Mon, Mar 21, 2011 at 05:36:13PM +0800, Xingxing Pan wrote:
>> 2011/3/21 Chagin Dmitry <dchagin@freebsd.org>:
>> >> 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
>> >
>>
>> Hi Chargin,
>>
>> Thank you for your reply.
>> The followings shows how I try to add DWARF for bcopy.
>>
>> --- ../8.2.0/sys/i386/include/asm.h =A0 =A0 2011-03-21 14:35:56.11197372=
2 +0800
>> +++ asm.h =A0 =A0 =A0 2011-03-21 15:25:31.564636162 +0800
>> @@ -71,7 +71,7 @@
>>
>> =A0#define _ENTRY(x) =A0 =A0 =A0_START_ENTRY; \
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .globl CNAME(x); .type C=
NAME(x),@function; CNAME(x):
>> -#define =A0 =A0 =A0 =A0END(x) =A0 =A0 =A0 =A0 =A0.size x, . - x
>> +#define =A0 =A0 =A0 =A0END(x) =A0 =A0 =A0 =A0 =A0.cfi_endproc; .size x,=
 . - x
>>
>> =A0#ifdef PROF
>> =A0#define =A0 =A0 =A0 =A0ALTENTRY(x) =A0 =A0 _ENTRY(x); \
>> @@ -80,9 +80,10 @@
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 popl %ebp; \
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 jmp 9f
>> =A0#define =A0 =A0 =A0 =A0ENTRY(x) =A0 =A0 =A0 =A0_ENTRY(x); \
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pushl %ebp; movl %esp,%ebp=
; \
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .cfi_startproc; \
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pushl %ebp; .cfi_adjust_cf=
a_offset 4; movl
>> %esp,%ebp; .cfi_def_cfa_register %ebp; \
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 call PIC_PLT(HIDENAME(mc=
ount)); \
>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 popl %ebp; \
>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 popl %ebp; .cfi_def_cfa %e=
sp, 4; \
>>
>> --- bcopy.S =A0 =A0 2011-03-21 15:51:26.804203809 +0800
>> +++ ../8.2.0/lib/libc/i386/string/bcopy.S =A0 =A0 =A0 2011-03-21
>> 14:28:15.023069890 +0800
>> @@ -51,9 +51,7 @@ ENTRY(bcopy)
>> =A0#endif
>> =A0#endif
>> =A0 =A0 =A0 =A0 pushl =A0 %esi
>> - =A0 =A0 =A0 .cfi_adjust_cfa_offset 4;
>> =A0 =A0 =A0 =A0 pushl =A0 %edi
>> - =A0 =A0 =A0 .cfi_adjust_cfa_offset 4;
>> =A0#if defined(MEMCOPY) || defined(MEMMOVE)
>> =A0 =A0 =A0 =A0 movl =A0 =A012(%esp),%edi
>> =A0 =A0 =A0 =A0 movl =A0 =A016(%esp),%esi
>> @@ -77,9 +75,7 @@ ENTRY(bcopy)
>> =A0 =A0 =A0 =A0 rep
>> =A0 =A0 =A0 =A0 movsb
>> =A0 =A0 =A0 =A0 popl =A0 =A0%edi
>> - =A0 =A0 =A0 .cfi_adjust_cfa_offset -4;
>> =A0 =A0 =A0 =A0 popl =A0 =A0%esi
>> - =A0 =A0 =A0 .cfi_adjust_cfa_offset -4;
>> =A0 =A0 =A0 =A0 ret
>> =A01:
>> =A0 =A0 =A0 =A0 addl =A0 =A0%ecx,%edi =A0 =A0 =A0 /* copy backwards. */
>> @@ -98,9 +94,7 @@ ENTRY(bcopy)
>> =A0 =A0 =A0 =A0 rep
>> =A0 =A0 =A0 =A0 movsl
>> =A0 =A0 =A0 =A0 popl =A0 =A0%edi
>> - =A0 =A0 =A0 .cfi_adjust_cfa_offset -4;
>> =A0 =A0 =A0 =A0 popl =A0 =A0%esi
>> - =A0 =A0 =A0 .cfi_adjust_cfa_offset -4;
>> =A0 =A0 =A0 =A0 cld
>> =A0 =A0 =A0 =A0 ret
>> =A0#ifdef MEMCOPY
>>
>> 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?
>>
>> 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!
>
>
> --
> Have fun!
> chd
>

I think the plan is ok for me.
Thank you.

Xingxing Pan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTindWYpEKEYXVOC5YTEM2ySTpSTC9c9jPSGPe=Yq>