harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Chow" <simon.harm...@gmail.com>
Subject Re: [drlvm][gc] initialization of global var: tm_self_tls
Date Mon, 03 Dec 2007 02:17:57 GMT
I see!
Thank you every much

On 01/12/2007, Chen Yang <chen.c.yang@gmail.com> wrote:
> hi, Simon:
> It's because of tm_self_tls is a thread local variable, the assembly part is
> the routine to get the address of the thread local variable. And since it's
> in /lib/ld-linux.so.2, no debug information available, it can only display
> assembly code.
> --
>  Chen
>
>
> On 11/30/07, Simon Chow <simon.harmony@gmail.com> wrote:
> >
> > Thanks for that, I considered it as a global variable as well
> > but when I step into
> > hy_inline hythread_t VMCALL hythread_self() {
> >     return tm_self_tls;
> > }
> > I found this
> >
> >
> > gc_get_tls () at
> >
> > /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/gc_gen/src/thread/gc_thread.h:35
> > 35        void* tls_base = vm_thread_local();
> > (gdb) s
> > vm_thread_local () at
> >
> > /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/gc_gen/src/thread/../common/gc_platform.h:107
> > 107     {  return hythread_self();  }
> > (gdb) s
> > hythread_self () at
> >
> > /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/include/open/hythread.h:515
> > 515         return tm_self_tls;
> > (gdb) display /i $pc // I do not know where the asm codes below come from
> > 1: x/i $pc  0xb679a513 <hythread_self+15>:      lea
> > 0xffffff80(,%ebx,1),%eax
> > (gdb) si
> > 0xb679a51a      515         return tm_self_tls;
> > 1: x/i $pc  0xb679a51a <hythread_self+22>:      call   0xb677985c
> > <___tls_get_addr@plt>
> > (gdb)
> > 0xb677985c in ___tls_get_addr@plt () from
> >
> > /home/zhouxun/workspace/Harmony/trunk/working_vm/build/deploy/jdk/jre/bin/default/libgc_gen.so
> > 1: x/i $pc  0xb677985c <___tls_get_addr@plt>:   jmp    *0xb0(%ebx)
> > (gdb)
> > 0xb7fb1e50 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e50 <___tls_get_addr>:       push   %ebp
> > (gdb)
> > 0xb7fb1e51 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e51 <___tls_get_addr+1>:     mov    %esp,%ebp
> > (gdb)
> > 0xb7fb1e53 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e53 <___tls_get_addr+3>:     sub    $0x28,%esp
> > (gdb)
> > 0xb7fb1e56 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e56 <___tls_get_addr+6>:
> > mov    %ebx,0xfffffff4(%ebp)
> > (gdb)
> > 0xb7fb1e59 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e59 <___tls_get_addr+9>:
> > mov    %esi,0xfffffff8(%ebp)
> > (gdb)
> > 0xb7fb1e5c in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e5c
> > <___tls_get_addr+12>:    mov    %edi,0xfffffffc(%ebp)
> > (gdb)
> > 0xb7fb1e5f in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e5f <___tls_get_addr+15>:    call   0xb7fb6cfb
> > <icudt34_dat+23157435>
> > (gdb)
> > 0xb7fb6cfb in ?? () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb6cfb <icudt34_dat+23157435>:  mov    (%esp),%ebx
> > (gdb)
> > 0xb7fb6cfe in ?? () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb6cfe <icudt34_dat+23157438>:  ret
> > (gdb)
> > 0xb7fb1e64 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e64 <___tls_get_addr+20>:    add    $0xa190,%ebx
> > (gdb)
> > 0xb7fb1e6a in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e6a
> > <___tls_get_addr+26>:    mov    %eax,0xffffffe4(%ebp)
> > (gdb)
> > 0xb7fb1e6d in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e6d <___tls_get_addr+29>:    mov    %gs:0x4,%esi
> > (gdb)
> > 0xb7fb1e74 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e74 <___tls_get_addr+36>:    mov    (%esi),%eax
> > (gdb)
> > 0xb7fb1e76 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e76 <___tls_get_addr+38>:    cmp    0x628(%ebx),%eax
> > (gdb)
> > 0xb7fb1e7c in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e7c <___tls_get_addr+44>:    movl
> > $0x0,0xffffffec(%ebp)
> > (gdb)
> > 0xb7fb1e83 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e83 <___tls_get_addr+51>:    jne    0xb7fb1eac
> > <___tls_get_addr+92>
> > (gdb)
> > 0xb7fb1e85 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e85
> > <___tls_get_addr+53>:    mov    0xffffffe4(%ebp),%eax
> > (gdb)
> > 0xb7fb1e88 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e88 <___tls_get_addr+56>:    mov    (%eax),%edx
> > (gdb)
> > 0xb7fb1e8a in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e8a <___tls_get_addr+58>:    lea    (%esi,%edx,8),%eax
> > (gdb)
> > 0xb7fb1e8d in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e8d
> > <___tls_get_addr+61>:    mov    %eax,0xffffffe8(%ebp)
> > (gdb)
> > 0xb7fb1e90 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e90 <___tls_get_addr+64>:    mov    (%eax),%edi
> > (gdb)
> > 0xb7fb1e92 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e92 <___tls_get_addr+66>:    cmp    $0xffffffff,%edi
> > (gdb)
> > 0xb7fb1e95 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e95 <___tls_get_addr+69>:    je     0xb7fb1ebe
> > <___tls_get_addr+110>
> > (gdb)
> > 0xb7fb1e97 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e97
> > <___tls_get_addr+71>:    mov    0xffffffe4(%ebp),%eax
> > (gdb)
> > 0xb7fb1e9a in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e9a
> > <___tls_get_addr+74>:    mov    0xfffffff4(%ebp),%ebx
> > (gdb)
> > 0xb7fb1e9d in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1e9d
> > <___tls_get_addr+77>:    mov    0xfffffff8(%ebp),%esi
> > (gdb)
> > 0xb7fb1ea0 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1ea0 <___tls_get_addr+80>:    add    0x4(%eax),%edi
> > (gdb)
> > 0xb7fb1ea3 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1ea3 <___tls_get_addr+83>:    mov    %edi,%eax
> > (gdb)
> > 0xb7fb1ea5 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1ea5
> > <___tls_get_addr+85>:    mov    0xfffffffc(%ebp),%edi
> > (gdb)
> > 0xb7fb1ea8 in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1ea8 <___tls_get_addr+88>:    mov    %ebp,%esp
> > (gdb)
> > 0xb7fb1eaa in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1eaa <___tls_get_addr+90>:    pop    %ebp
> > (gdb)
> > 0xb7fb1eab in ___tls_get_addr () from /lib/ld-linux.so.2
> > 1: x/i $pc  0xb7fb1eab <___tls_get_addr+91>:    ret //until here, the
> > function hythread_self() in vm/include/open/hythread.h finishes
> > (gdb)
> > 0xb679a51f in hythread_self () at
> >
> > /home/zhouxun/workspace/Harmony/trunk/working_vm/vm/include/open/hythread.h:515
> > 515         return tm_self_tls;
> > 1: x/i $pc  0xb679a51f <hythread_self+27>:      mov    (%eax),%eax
> > (gdb)
> >
> >
> >
> > On 30 Nov 2007 13:06:18 +0300, Egor Pasko <egor.pasko@gmail.com> wrote:
> > >
> > > On the 0x39E day of Apache Harmony Simon Chow wrote:
> > > > I am studying Harmony DRLVM code as a beginner.
> > > > When I was debugging the gc module,
> > > > This method:
> > > > hy_inline hythread_t VMCALL hythread_self() {
> > > >     return tm_self_tls;
> > > > }
> > > > in hythread.h:515 is called frequenctly
> > > >
> > > > But I am not sure whether tm_self_tls is a global var or a macro
> > defined
> > > in
> > > > other file.
> > >
> > > I see only one file, where tm_self_tls is defined --
> > > vm/include/open/hythread.h And it is defined to be a variable that
> > > resides in Thread Local Storage. AFAIR, it stores a pointer to a
> > > structure HyThread_public that stores thread state.
> > >
> > > > I tried to use "si" of gdb before this method returned, but it seem go
> > > to
> > > > some asm code without source information.
> > > >
> > > > I am confused here.
> > > >
> > > > --
> > > > From : Simon.Chow@Software School of Fudan University
> > >
> > > --
> > > Egor Pasko
> > >
> > >
> >
> >
> > --
> > From : Simon.Chow@Software School of Fudan University
> >
>
>
>
> --
> Chen
>
> chen.c.yang@gmail.com
>


-- 
>From : Simon.Chow@Software School of Fudan University

Mime
View raw message