home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / waithang.zip / MAT015.HNG < prev    next >
Text File  |  1998-07-17  |  10KB  |  208 lines

  1. The Modular OS/2 compatability test system hang running MAT015
  2.  
  3. MAT015 - Summary of code flow
  4.  
  5.  The test is a small VDM app that does sin and power series sin approximation
  6.  of a couple of basic numbers. The app is hanging the system while calculating
  7.  the power series sin approximation of -1. The code reads as follows:
  8.  
  9.  double mysinh(double x)
  10.  {
  11.  int i, j;
  12.  double sn, term, magn;
  13.  term = x;
  14.  sn = term;
  15.  for(i=1;i<500;++i)
  16.    {
  17.    j=2*i;
  18.    term=term/((double) j * (j+1));
  19.    term*=x*x;
  20.    magn=sn;
  21.    sn+=term;
  22.    if(fabs(term)<(magn*1.e-17)
  23.     break;
  24.    }
  25.    return(sn);
  26.  }
  27.  
  28.  
  29.  I have identified the line "term*=x*x;" as the problem spot.
  30.  after going through the for loop hex 55 times term has become a very
  31.  small negative number. The calculation of this line yelds a positive one.
  32.  On a working machine it yelds a really small negative number.
  33.  THe following is the debug log of the problem machine for the identified
  34.  line of C code. Keep in mind that x=-1.
  35.  
  36.  ** what is term at this time **
  37.  --dd bp-18 l2
  38.  10ec:00001500  373a92f4 80009455  ** notice the sign bit indicates negative**
  39.  *** don't forgit you have to word flip this to 80009455373a92f4 ***
  40.  --p
  41.  *** load up npx with -1******
  42.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  43.  eip=000003fc esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  44.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  45.  0aaf:000003fc dd4604         fld     qword ptr ìbp+04┘ ss:151c=bff0000000000000
  46.  --p
  47.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  48.  eip=000003ff esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  49.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  50.  0aaf:000003ff 90             nop
  51.  --p
  52.  **** multiply top of npx stack with a -1 ************
  53.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  54.  eip=00000400 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  55.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  56.  0aaf:00000400 dc4e04         fmul    qword ptr ìbp+04┘ ss:151c=bff0000000000000
  57.  --p
  58.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  59.  eip=00000403 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  60.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  61.  0aaf:00000403 90             nop
  62.  --p
  63.  *** multiply top of stack with term ( a very small negative number ) *****
  64.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  65.  eip=00000404 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  66.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  67.  0aaf:00000404 dc4ee8         fmul    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  68.  --p
  69.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  70.  eip=00000407 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  71.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  72.  0aaf:00000407 90             nop
  73.  --p
  74.  *** stash result into term ******
  75.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  76.  eip=00000408 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  77.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  78.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  79.  --p
  80.  eax=000000ab ebx=000014f2 ecx=000003b3 edx=00000630 esi=00000395 edi=000014fc
  81.  eip=00000408 esp=000014ee ebp=00001518 iopl=3 -- vm -- nv up ei pl nz na po nc
  82.  cs=0aaf ss=10ec ds=10ec es=10ec fs=0000 gs=0000  cr2=0001428e  cr3=001c9000
  83.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  84.  --pn 10
  85.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  86.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  87.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  88.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  89.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  90.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  91.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  92.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  93.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  94.  0aaf:00000408 dd5ee8         fstp    qword ptr ìbp-18┘ ss:1500=80009455373a92f4
  95.  *** we just get stuck here in the debuger and cannot go on*******
  96.  
  97.  *** if I run the test and don't step through it I end up with this ****
  98.  
  99.  *** ctrl+c in with debuger *****************
  100.  r
  101.  eax=80010013 ebx=fff00000 ecx=80010013 edx=00000008 esi=7ba45078 edi=7ba2c850
  102.  eip=ffef8b66 esp=00006650 ebp=0000666c iopl=3 rf -- -- nv up ei pl zr na pe nc
  103.  cs=0170 ss=0030 ds=0108 es=0168 fs=0000 gs=0000  cr2=1aad8be4  cr3=001d3000
  104.  0170:ffef8b66 9b             wait
  105.  ##pn 20
  106.  0170:ffef8b66 9b             wait
  107.  0170:ffef8b66 9b             wait
  108.  0170:ffef8b66 9b             wait
  109.  0170:ffef8b66 9b             wait
  110.  0170:ffef8b66 9b             wait
  111.  0170:ffef8b66 9b             wait
  112.  0170:ffef8b66 9b             wait
  113.  0170:ffef8b66 9b             wait
  114.  0170:ffef8b66 9b             wait
  115.  0170:ffef8b66 9b             wait
  116.  0170:ffef8b66 9b             wait
  117.  0170:ffef8b66 9b             wait
  118.  0170:ffef8b66 9b             wait
  119.  0170:ffef8b66 9b             wait
  120.  0170:ffef8b66 9b             wait
  121.  0170:ffef8b66 9b             wait
  122.  0170:ffef8b66 9b             wait
  123.  0170:ffef8b66 9b             wait
  124.  0170:ffef8b66 9b             wait
  125.  0170:ffef8b66 9b             wait
  126.  *** it gets stuck here ******************
  127.  *** there are no simbols for ffef8b66 so lets look back on the stack ****
  128.  ##dw ss:esp l20
  129.  0030:00006650  002c 0000 0008 0000 0000 fff0 0168 0000
  130.  0030:00006660  3f3a fff4 0000 0000 5796 fff4 1512 0000
  131.  0030:00006670  3a5c fff4 5f5a fff4 ffff ffff 0000 0008
  132.  0030:00006680  0000 0100 0000 ffef 0000 fff4 14f6 0000
  133.  ##ln fff43f3a
  134.  0170:fff43f24 os2krnl:DOSHIGH32CODE:WaitNPX + 16
  135.  0170:fff43f3c g__ReleaseNPX - 2
  136.  ##ln fff45796
  137.  0170:fff4578f os2krnl:DOSHIGH32CODE:SchedNextRet2 + 7
  138.  0170:fff45800 TIMSEMHANDLE - 6a
  139.  ##ln fff43a5c
  140.  0170:fff439b5 os2krnl:DOSHIGH32CODE:KMExitKmodeEvents + a7
  141.  0170:fff43aa4 kmodea$kmCheckForceFlags - 48
  142.  ##ln fff45f5a
  143.  0170:fff45e7d os2krnl:DOSHIGH32CODE:cpu_etint + dd
  144.  0170:fff45fca int$intKernelExit - 70
  145.  os2krnl:DOSHIGH32CODE:KMExitKmodeEvents:
  146.  %fff439b5 9af02200000011     call    DOSCODE:f_TaskOnly (1100:000022f0)
  147.  %fff439bc fa                 cli
  148.  %fff439bd 66b86801           mov     ax,0168
  149.  %fff439c1 8ed8               mov     ds,ax
  150.  %fff439c3 8ec0               mov     es,ax
  151.  %fff439c5 33c0               xor     eax,eax
  152.  %fff439c7 8ee0               mov     fs,ax
  153.  %fff439c9 8ee8               mov     gs,ax
  154.  %fff439cb 8b3dec6cf0ff       mov     edi,dword ptr ìfff06cec┘
  155.  %fff439d1 668b1dc11bf1ff     mov     bx,word ptr ìfff11bc1┘
  156.  %fff439d8 663b5f02           cmp     bx,word ptr ìedi+02┘
  157.  %fff439dc 7409               jz      %fff439e7
  158.  ##u
  159.  %fff439de 0fbc1df3fadfff     bsf     ebx,dword ptr ìffdffaf3┘
  160.  %fff439e5 7533               jnz     %fff43a1a
  161.  %fff439e7 8b35e86cf0ff       mov     esi,dword ptr ìfff06ce8┘
  162.  %fff439ed 8b3dec6cf0ff       mov     edi,dword ptr ìfff06cec┘
  163.  %fff439f3 8b866c050000       mov     eax,dword ptr ìesi+0000056c┘
  164.  %fff439f9 0b4704             or      eax,dword ptr ìedi+04┘
  165.  %fff439fc 7411               jz      %fff43a0f
  166.  %fff439fe fb                 sti
  167.  %fff439ff e8a0000000         call    kmodea$kmCheckForceFlags (%fff43aa4)
  168.  %fff43a04 72b6               jc      %fff439bc
  169.  %fff43a06 fa                 cli
  170.  %fff43a07 66b86801           mov     ax,0168
  171.  ##u
  172.  %fff43a0b 8ed8               mov     ds,ax
  173.  %fff43a0d 8ec0               mov     es,ax
  174.  %fff43a0f 803df2fadfff00     cmp     byte ptr ìffdffaf2┘,00
  175.  %fff43a16 753e               jnz     %fff43a56
  176.  %fff43a18 fb                 sti
  177.  %fff43a19 c3                 retd
  178.  %fff43a1a 2eff249d9c39f4ff   jmp     dword ptr cs:ìebx*4+fff4399c┘
  179.  %fff43a22 e869020000         call   kmodea$kmDispatchGlobalContextH (%fff43c90)
  180.  %fff43a27 eb93               jmp     %fff439bc
  181.  %fff43a29 fb                 sti
  182.  %fff43a2a 9a1cbb00005001    call DOSHIGH2CODE:f_CMAttendSwapper (0150:0000bb1c)
  183.  %fff43a31 eb89               jmp     %fff439bc
  184.  ##u
  185.  %fff43a33 fb                 sti
  186.  %fff43a34 9a002d00000011     call    DOSCODE:f_PostPending (1100:00002d00)
  187.  %fff43a3b e97cffffff         jmp     %fff439bc
  188.  %fff43a40 fb                 sti
  189.  %fff43a41 e87f650200         call    _tkEvapAll (%fff69fc5)
  190.  %fff43a46 e971ffffff         jmp     %fff439bc
  191.  %fff43a4b fb                 sti
  192.  %fff43a4c e8f7520300         call    _SMShrinkSwapFile (%fff78d48)
  193.  %fff43a51 e966ffffff         jmp     %fff439bc
  194.  %fff43a56 fb                 sti
  195.  %fff43a57 e8c0170000         call    _tkSchedNext (%fff4521c)
  196.  %fff43a5c e95bffffff         jmp     %fff439bc
  197.  ##
  198.  ***** kmexitkmodeevents calls _tkshednext who calls waitnpx and we hang ******
  199.  ***** the scheduler up and nothing happens again ****************
  200.  
  201.  ***** there appears to be a mexican standoff between the CPU and the NPX *****
  202.  ***** neither one wants to budge ********
  203.  
  204.  ***** I think it's ICE time for this problem since stepping through it
  205.        yields a different hang point than running and breaking in **********
  206.  ***** I it also an insteresting fact that the problem occurs
  207.        exactly at this same point in the test case.******************
  208.