Gdb debugging --- what is the first Latch held during update?

Source: Internet
Author: User
Reprinted please indicate the source: blog. csdn. netguoyjoearticledetails184425371. Find the system process number corresponding to the current session: SPID7376. the following statement (executed in the first window) gyj @ OCMselectspidfromv $ sessions, v $ processpwheres. paddrp. addrandsidin (selectdisti

Reprinted please indicate the source: http://blog.csdn.net/guoyjoe/article/details/18456937 1, find the current session corresponding to the system process number: SPID = 7376, the following statement (executed in the first window) gyj @ OCM select spid from v $ session s, v $ process p where s. paddr = p. addr and sid in (select disti

Reprinted please indicate the source: Http://blog.csdn.net/guoyjoe/article/details/18456937

1. Find the system process number corresponding to the current session: SPID = 7376, the following statement (executed in the first window)

gyj@OCM> select spid from v$session s,v$process p where s.paddr=p.addr and sid in(select distinct sid from v$mystat);SPID------------------------7376
[oracle@mydb ~]$ gdb $ORACLE_HOME/bin/oracle 7376GNU gdb Fedora (6.8-27.el5)Copyright (C) 2008 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later 
 
  This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.  Type "show copying"and "show warranty" for details.This GDB was configured as "x86_64-redhat-linux-gnu"...(no debugging symbols found)Attaching to program: /u01/app/oracle/product/11.2.0/bin/oracle, process 7376Reading symbols from /u01/app/oracle/product/11.2.0/lib/libodm11.so...(no debugging symbols found)...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libodm11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libcell11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libcell11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libskgxp11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libskgxp11.soReading symbols from /lib64/librt.so.1...done.Loaded symbols for /lib64/librt.so.1Reading symbols from /u01/app/oracle/product/11.2.0/lib/libnnz11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libnnz11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libclsra11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libclsra11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libdbcfg11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libdbcfg11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libhasgen11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libhasgen11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libskgxn2.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libskgxn2.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libocr11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocr11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libocrb11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocrb11.soReading symbols from /u01/app/oracle/product/11.2.0/lib/libocrutl11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocrutl11.soReading symbols from /usr/lib64/libaio.so.1...done.Loaded symbols for /usr/lib64/libaio.so.1Reading symbols from /lib64/libdl.so.2...done.Loaded symbols for /lib64/libdl.so.2Reading symbols from /lib64/libm.so.6...done.Loaded symbols for /lib64/libm.so.6Reading symbols from /lib64/libpthread.so.0...done.[Thread debugging using libthread_db enabled][New Thread 0x2b0b8fef0910 (LWP 7376)]Loaded symbols for /lib64/libpthread.so.0Reading symbols from /lib64/libnsl.so.1...done.Loaded symbols for /lib64/libnsl.so.1Reading symbols from /lib64/libc.so.6...done.Loaded symbols for /lib64/libc.so.6Reading symbols from /lib64/ld-linux-x86-64.so.2...done.Loaded symbols for /lib64/ld-linux-x86-64.so.2Reading symbols from /usr/lib64/libnuma.so.1...done.Loaded symbols for /usr/lib64/libnuma.so.1Reading symbols from /lib64/libnss_files.so.2...done.Loaded symbols for /lib64/libnss_files.so.2Reading symbols from /u01/app/oracle/product/11.2.0/lib/libnque11.so...done.Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libnque11.so0x0000003f0d40d290 in __read_nocancel () from /lib64/libpthread.so.0(gdb)  
 

3. Set a breakpoint, hold the first Latch Lock (the kslgetl function is the function that holds Latch in advance), and run (c command, I .e., continue) (executed in the second window)

(gdb) b kslgetlBreakpoint 1 at 0x8f96376(gdb) cContinuing.

4. Execute an update statement to trigger the breakpoint operation. update is blocked (executed in the first window)

gyj@OCM> update gyj_test set name='AAAAA' where id=1;

5. When the updater operation is executed, the breakpoint stops here (in the second window)

Breakpoint 1, 0x0000000008f96376 in kslgetl ()(gdb) 

6. Let's first look at the first parameter of the function kslgetl () corresponding to the first Latch Lock held during update? Run the info all-register command to display the register (executed in the second window)

(gdb) info all-registerrax            0x0      0rbx            0x2000   8192rcx            0xf27    3879rdx            0x0      0rsi            0x1      1rdi            0x601082f0       1611694832rbp            0x7fff1c5754d0   0x7fff1c5754d0rsp            0x7fff1c5754d0   0x7fff1c5754d0r8             0xf27    3879r9             0xbaf3fa0        196034464r10            0x0      0r11            0xf27    3879r12            0x927db800       2457712640r13            0x601082f0       1611694832r14            0x1      1r15            0x1      1rip            0x8f96376        0x8f96376 
 
  eflags         0x246    [ PF ZF IF ]cs             0x33     51ss             0x2b     43ds             0x0      0es             0x0      0fs             0x0      0gs             0x0      0st0            0        (raw 0x00000000000000000000)---Type 
  
    to continue, or q 
   
     to quit---st1            0        (raw 0x00000000000000000000)st2            0        (raw 0x00000000000000000000)st3            0        (raw 0x00000000000000000000)st4            0        (raw 0x00000000000000000000)st5            0        (raw 0x00000000000000000000)st6            333296   (raw 0x4011a2be000000000000)st7            300384   (raw 0x401192ac000000000000)fctrl          0x27f    639fstat          0x0      0ftag           0xffff   65535fiseg          0x0      0fioff          0x9394e95        154750613foseg          0x7fff   32767fooff          0x1c573f50       475479888fop            0x0      0xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
    
     }, v8_int16 = {0x0, 0x0, 0x0, 0x0,     0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm1           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
     
      }, v8_int16 = {0x0, 0x0, 0x0, 0x0,     0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm2           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
      
       }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm3 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x8000000000000000, 0x8000000000000000}, v16_int8 = {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, v8_int16 = {0xfffe, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffff, 0xffff, 0xffff}, v4_int32 = {0xfffffffe, 0xffffffff, 0xfffffffe, 0xffffffff}, v2_int64 = {0xfffffffffffffffe, 0xfffffffffffffffe}, uint128 = 0xfffffffffffffffefffffffffffffffe}---Type 
       
         to continue, or q 
        
          to quit---xmm4 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
         
          }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm5 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x32, 0xa3, 0xd7, 0x2, 0x0 
          
           }, v8_int16 = {0xa332, 0x2d7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2d7a332, 0x0, 0x0, 0x0}, v2_int64 = {0x2d7a332, 0x0}, uint128 = 0x00000000000000000000000002d7a332}xmm6 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
           
            }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm7 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0xda, 0x87, 0xd7, 0x2, 0x0 
            
             }, v8_int16 = {0x87da, 0x2d7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2d787da, 0x0, 0x0, 0x0}, v2_int64 = {0x2d787da, 0x0}, uint128 = 0x00000000000000000000000002d787da}xmm8 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
             
              }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm9 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
              
               }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm10 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
               
                }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm11 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
                
                 }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm12 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x18, 0xe, 0x73, 0x90, 0xb, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xe18, 0x9073, 0x2b0b, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x90730e18, 0x2b0b, 0x0, 0x0}, v2_int64 = {0x2b0b90730e18, 0x0}, uint128 = 0x000000000000000000002b0b90730e18}xmm13 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
                 
                  }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}xmm14 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
                  
                   }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}---Type 
                   
                     to continue, or q 
                    
                      to quit---xmm15 {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 
                     
                      }, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}mxcsr 0x1fa1 [ IE PE IM DM ZM OM UM PM ](gdb) 
                     
                    
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     
    
   
  
 

7. rdi/edi is the first parameter, rsi/esi is the second parameter, and two parameters of the function kslgetl () displayed by the info all-register command are pasted, as shown below:

8. Find the first parameter 0x601082f0. Note that because my OS is 64-bit, eight zeros must be added before, and the letters of the addresses in the v $ latch_children view must be capitalized,

sys@OCM>  select  name from v$latch_children where addr='00000000601082F0';NAME----------------------------------------------------------------shared pool

10. The Latch Lock is shared pool Latch.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.