atom feed13 messages in org.freebsd.freebsd-hackersRe: GSoC'11: DWARF2 call frame inform...
FromSent OnAttachments
Xingxing PanMar 19, 2011 9:36 am 
Chagin DmitryMar 19, 2011 10:40 am 
Xingxing PanMar 19, 2011 8:07 pm 
Chagin DmitryMar 20, 2011 12:18 am 
Xingxing PanMar 20, 2011 8:23 am 
Chagin DmitryMar 20, 2011 11:18 am 
Xingxing PanMar 21, 2011 2:35 am 
Chagin DmitryMar 21, 2011 10:31 am 
Kostik BelousovMar 21, 2011 1:00 pm 
Xingxing PanMar 22, 2011 8:15 am 
Xingxing PanMar 22, 2011 8:39 am 
per...@pluto.rain.comMar 22, 2011 10:28 am 
Kostik BelousovMar 22, 2011 11:19 am 
Subject:Re: GSoC'11: DWARF2 call frame information
From:Chagin Dmitry (dcha@freebsd.org)
Date:Mar 21, 2011 10:31:41 am
List:org.freebsd.freebsd-hackers

On Mon, Mar 21, 2011 at 05:36:13PM +0800, Xingxing Pan wrote:

2011/3/21 Chagin Dmitry <dcha@freebsd.org>:

powerfull script.

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?

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 2011-03-21 14:35:56.111973722 +0800 +++ asm.h 2011-03-21 15:25:31.564636162 +0800 @@ -71,7 +71,7 @@

#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

#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; \

--- 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

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!