Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Roland Schwingel <roland.schwingel@onevision.de>
To: Mark Kettenis <mark.kettenis@xs4all.nl>,
	drow@false.org, gdb@sources.redhat.com
Subject: Re: gdb stack trace problems (Addendum)
Date: Tue, 19 Apr 2005 07:34:00 -0000	[thread overview]
Message-ID: <4264B432.9000101@onevision.de> (raw)

Hi Mark, Daniel and list....

Sorry for replying my own post, but I forgot something...
 
 > Mark Kettenis wrote on 18.04.2005 19:10:57:
 >  >    Date: Mon, 18 Apr 2005 09:57:21 -0400
 >  >    From: Daniel Jacobowitz <drow@false.org>
 >  >
 >  >    > Program received signal SIGSEGV, Segmentation fault.
 >  >    > [Switching to thread 2316.0xf8c]
 >  >    > 0x0040131d in crashIfZero (num=2) at gdbtest.c:17
 >  >    > 17                      *data=911;
 >  >    > (gdb) thr 1
 >  >    > [Switching to thread 1 (thread 2316.0xf10)]#0  0x7c91eb94 in
 >  >    > ntdll!LdrAccessResource () from ntdll.dll
 >  >    > (gdb) bt
 >  >    > #0  0x7c91eb94 in ntdll!LdrAccessResource () from ntdll.dll
 >  >    > #1  0x7c91d85c in ntdll!ZwDelayExecution () from ntdll.dll
 >  >    > #2  0x7c8023ed in SleepEx () from
 > /vol/c/WINDOWS/system32/kernel32.dll
 >  >    > #3  0x00000000 in ?? () from
 >  >
 >  >    OK, here's a concrete problem.  GDB 6.x has a (usually) more 
reliable
 >  >    prologue analyzer for x86, compared to GDB 5.3.  However, the 
old one
 >  >    got lucky with SleepEx and the new one doesn't.  I'd ask you to 
post
 >  >    disassembly of the function except I'm not sure how wise that is
 > with a
 >  >    Microsoft DLL...
 >  >
 >  >    Mark, you did the work on the i386 prologue analyzer.  Any 
chance you
 >  >    could take a look at this?
 >  >
 >  > Sure if someone can provide me with the dissassembly in AT&T syntax
 >  > for that function, or even better some assembler code that exhibits
 >  > the problem.  No promises though that I'll fix this.  Last time I
 >  > looked at some windows disassembler it looked like it was hand
 >  > optimized in such a way that the entire function needed to be analyzed
 >  > to do something useful; something that doesn't quite fit in the way we
 >  > do things in GDB.
 > Here is the disassembly of one function (func1) that cannot be shown
 > correctly
 > from within gdb 6.3.50 in att flavor:
 > (gdb) disas func1
 > Dump of assembler code for function func1:
 > 0x004013ca <func1+0>:   push   %ebp
 > 0x004013cb <func1+1>:   mov    %esp,%ebp
 > 0x004013cd <func1+3>:   sub    $0x8,%esp
 > 0x004013d0 <func1+6>:   movl   $0x64,(%esp)
 > 0x004013d7 <func1+13>:  call   0x401830 <Sleep@4>
 > 0x004013dc <func1+18>:  sub    $0x4,%esp
 > 0x004013df <func1+21>:  mov    0x8(%ebp),%eax
 > 0x004013e2 <func1+24>:  mov    %eax,(%esp)
 > 0x004013e5 <func1+27>:  call   0x4012eb <crashIfZero>
 > 0x004013ea <func1+32>:  mov    0x8(%ebp),%eax
 > 0x004013ed <func1+35>:  mov    %eax,(%esp)
 > 0x004013f0 <func1+38>:  call   0x40139d <func2>
 > 0x004013f5 <func1+43>:  leave
 > 0x004013f6 <func1+44>:  ret  
 > End of assembler dump.
 >
 > I hope this is what you requested. I will aid in tracking this down,
 > wherever I can. As you see from the assembly Sleep() is
 > called not SleepEx() as shown in the gdb 6.3.50 stack
 > trace. In gdb 5.3 stack trace Sleep() is correctly shown if you
 > look at my posting from yesterday

As you might see Sleep() is not the direct call to msvcrt. Here
is the disassembly of the Sleep() linked to the exe.

(gdb) disas 0x401830
Dump of assembler code for function Sleep@4:
0x00401830 <Sleep@4+0>: jmp    *0x4040e4
0x00401836 <Sleep@4+6>: nop   
0x00401837 <Sleep@4+7>: nop   
0x00401838 <Sleep@4+8>: add    %al,(%eax)
0x0040183a <Sleep@4+10>:        add    %al,(%eax)
0x0040183c <Sleep@4+12>:        add    %al,(%eax)
0x0040183e <Sleep@4+14>:        add    %al,(%eax)
End of assembler dump.

(gdb) disas 0x4040e4
Dump of assembler code for function _imp__Sleep@4:
0x004040e4 <_imp__Sleep@4+0>:   in     $0x41,%al
0x004040e6 <_imp__Sleep@4+2>:   add    %al,(%eax)
0x004040e8 <_imp__Sleep@4+4>:   add    %al,(%eax)
0x004040ea <_imp__Sleep@4+6>:   add    %al,(%eax)
0x004040ec <_imp__Sleep@4+8>:   daa   
0x004040ed <_imp__Sleep@4+9>:   add    %bl,0x5f(%edi)
0x004040f0 <_imp__Sleep@4+12>:  addr16
0x004040f1 <_imp__Sleep@4+13>:  gs
0x004040f2 <_imp__Sleep@4+14>:  je     0x404161 <_imp__Sleep@4+125>
0x004040f4 <_imp__Sleep@4+16>:  popa  
0x004040f5 <_imp__Sleep@4+17>:  imul   $0x736772,0x61(%esi),%ebp
0x004040fc <_imp__Sleep@4+24>:  cmp    $0x0,%al
0x004040fe <_imp__Sleep@4+26>:  pop    %edi
0x004040ff <_imp__Sleep@4+27>:  pop    %edi
0x00404100 <_imp__Sleep@4+28>:  jo     0x404161 <_imp__Sleep@4+125>
0x00404102 <_imp__Sleep@4+30>:  pop    %edi
0x00404103 <_imp__Sleep@4+31>:  outsb  %gs:(%esi),(%dx)
0x00404105 <_imp__Sleep@4+33>:  jbe    0x404170 <_imp__Sleep@4+140>
0x00404107 <_imp__Sleep@4+35>:  jb     0x404178 <_imp__Sleep@4+148>
0x00404109 <_imp__Sleep@4+37>:  outsb  %ds:(%esi),(%dx)
0x0040410a <_imp__Sleep@4+38>:  add    %al,(%eax)
0x0040410c <_imp__Sleep@4+40>:  add    %bl,%ds:0x5f(%edi)
0x00404110 <_imp__Sleep@4+44>:  jo     0x404171 <_imp__Sleep@4+141>
0x00404112 <_imp__Sleep@4+46>:  pop    %edi
0x00404113 <_imp__Sleep@4+47>:  insw   (%dx),%es:(%edi)
0x00404115 <_imp__Sleep@4+49>:  outsl  %ds:(%esi),(%dx)
0x00404116 <_imp__Sleep@4+50>:  add    %al,%fs:%gs:(%eax)
0x0040411a <_imp__Sleep@4+54>:  add    %al,(%eax)
0x0040411c <_imp__Sleep@4+56>:  push   %eax
0x0040411d <_imp__Sleep@4+57>:  add    %bl,0x5f(%edi)
0x00404120 <_imp__Sleep@4+60>:  jae    0x404187 <_imp__Sleep@4+163>
0x00404122 <_imp__Sleep@4+62>:  je     0x404183 <_imp__Sleep@4+159>
0x00404124 <_imp__Sleep@4+64>:  popa  
0x00404125 <_imp__Sleep@4+65>:  jo     0x404197 <_imp__Sleep@4+179>
0x00404127 <_imp__Sleep@4+67>:  pop    %edi
0x00404128 <_imp__Sleep@4+68>:  je     0x4041a3 <_imp__Sleep@4+191>
0x0040412a <_imp__Sleep@4+70>:  jo     0x404191 <_imp__Sleep@4+173>
0x0040412c <_imp__Sleep@4+72>:  add    %al,(%eax)
0x0040412e <_imp__Sleep@4+74>:  add    %al,(%eax)
0x00404130 <_imp__Sleep@4+76>:  jns    0x404132 <_imp__Sleep@4+78>
0x00404132 <_imp__Sleep@4+78>:  pop    %edi
0x00404133 <_imp__Sleep@4+79>:  arpl   %sp,0x78(%ebp)
0x00404136 <_imp__Sleep@4+82>:  imul   $0xb90000,0x0(%eax,%eax,1),%esi
0x0040413e <_imp__Sleep@4+90>:  pop    %edi
0x0040413f <_imp__Sleep@4+91>:  insw   (%dx),%es:(%edi)
0x00404141 <_imp__Sleep@4+93>:  outsl  %ds:(%esi),(%dx)
0x00404142 <_imp__Sleep@4+94>:  add    %al,%fs:%gs:(%eax)
0x00404146 <_imp__Sleep@4+98>:  add    %al,(%eax)
0x00404148 <_imp__Sleep@4+100>: mov    $0x70665f00,%esp
0x0040414d <_imp__Sleep@4+105>: jb     0x4041b4 <_imp__Sleep@4+208>
0x0040414f <_imp__Sleep@4+107>: jae    0x4041b6 <_imp__Sleep@4+210>
0x00404151 <_imp__Sleep@4+109>: je     0x404153 <_imp__Sleep@4+111>
0x00404153 <_imp__Sleep@4+111>: add    %ch,%cl
0x00404155 <_imp__Sleep@4+113>: add    %bl,0x69(%edi)
0x00404158 <_imp__Sleep@4+116>: outsl  %ds:(%esi),(%dx)
0x00404159 <_imp__Sleep@4+117>: bound  %eax,(%eax)
0x0040415b <_imp__Sleep@4+119>: add    %bl,0x1(%esi)
0x0040415e <_imp__Sleep@4+122>: pop    %edi
0x0040415f <_imp__Sleep@4+123>: outsl  %ds:(%esi),(%dx)
0x00404160 <_imp__Sleep@4+124>: outsb  %ds:(%esi),(%dx)
0x00404161 <_imp__Sleep@4+125>: gs
0x00404162 <_imp__Sleep@4+126>: js     0x4041cd <_imp__Sleep@4+233>
0x00404164 <_imp__Sleep@4+128>: je     0x404166 <_imp__Sleep@4+130>
0x00404166 <_imp__Sleep@4+130>: add    %al,(%eax)
0x00404168 <_imp__Sleep@4+132>: test   %al,(%ecx)
0x0040416a <_imp__Sleep@4+134>: pop    %edi
0x0040416b <_imp__Sleep@4+135>: jae    0x4041d2 <_imp__Sleep@4+238>
0x0040416d <_imp__Sleep@4+137>: je     0x4041dc <_imp__Sleep@4+248>
0x0040416f <_imp__Sleep@4+139>: outsl  %ds:(%esi),(%dx)
0x00404170 <_imp__Sleep@4+140>: add    %al,%fs:%gs:(%eax)
0x00404174 <_imp__Sleep@4+144>: sbb    $0x2,%al
0x00404176 <_imp__Sleep@4+146>: popa  
0x00404177 <_imp__Sleep@4+147>: je     0x4041de <_imp__Sleep@4+250>
0x00404179 <_imp__Sleep@4+149>: js     0x4041e4 <_imp__Sleep@4+256>
0x0040417b <_imp__Sleep@4+151>: je     0x40417d <_imp__Sleep@4+153>
0x0040417d <_imp__Sleep@4+153>: add    %al,(%eax)
0x0040417f <_imp__Sleep@4+155>: add    %bh,0x2(%edi)
0x00404182 <_imp__Sleep@4+158>: jo     0x4041f6 <_imp__Sleep@4+274>
0x00404184 <_imp__Sleep@4+160>: imul   $0x66,0x74(%esi),%ebp
0x0040418b <_imp__Sleep@4+167>: add    %cl,0x74657302(%ebp)
0x00404191 <_imp__Sleep@4+173>: bound  %esi,0x66(%ebp)
0x00404194 <_imp__Sleep@4+176>: add    %al,(%eax)
0x00404196 <_imp__Sleep@4+178>: add    %al,(%eax)
0x00404198 <_imp__Sleep@4+180>: nop   
0x00404199 <_imp__Sleep@4+181>: add    0x69(%ebx),%dh
0x0040419c <_imp__Sleep@4+184>: addr16 outsb %ds:(%si),(%dx)
0x0040419e <_imp__Sleep@4+186>: popa  
0x0040419f <_imp__Sleep@4+187>: insb   (%dx),%es:(%edi)
0x004041a0 <_imp__Sleep@4+188>: add    %al,(%eax)
0x004041a2 <_imp__Sleep@4+190>: add    %al,(%eax)
0x004041a4 <_imp__Sleep@4+192>: pop    %edx
0x004041a5 <_imp__Sleep@4+193>: add    %al,0x72(%ebx)
0x004041a8 <_imp__Sleep@4+196>: gs
0x004041a9 <_imp__Sleep@4+197>: popa  
0x004041aa <_imp__Sleep@4+198>: je     0x404211 <_imp__Sleep@4+301>
0x004041ac <_imp__Sleep@4+200>: push   %esp
0x004041ad <_imp__Sleep@4+201>: push   $0x64616572
0x004041b2 <_imp__Sleep@4+206>: add    %al,(%eax)
0x004041b4 <_imp__Sleep@4+208>: fwait
0x004041b5 <_imp__Sleep@4+209>: add    %al,0x78(%ebp)
0x004041b8 <_imp__Sleep@4+212>: imul   $0x7365636f,0x72(%eax,%edx,2),%esi
0x004041c0 <_imp__Sleep@4+220>: jae    0x4041c2 <_imp__Sleep@4+222>
0x004041c2 <_imp__Sleep@4+222>: add    %al,(%eax)
0x004041c4 <_imp__Sleep@4+224>: fild   (%edx)
0x004041c6 <_imp__Sleep@4+226>: push   %ebx
0x004041c7 <_imp__Sleep@4+227>: gs
0x004041c8 <_imp__Sleep@4+228>: je     0x40421f <_imp__Sleep@4+315>
0x004041ca <_imp__Sleep@4+230>: outsb  %ds:(%esi),(%dx)
0x004041cb <_imp__Sleep@4+231>: push   $0x6c646e61
0x004041d0 <_imp__Sleep@4+236>: gs
0x004041d1 <_imp__Sleep@4+237>: fs
0x004041d2 <_imp__Sleep@4+238>: inc    %ebp
0x004041d3 <_imp__Sleep@4+239>: js     0x404238 <_libmsvcrt_a_iname+20>
0x004041d5 <_imp__Sleep@4+241>: gs
0x004041d6 <_imp__Sleep@4+242>: jo     0x40424c <_libkernel32_a_iname+12>
0x004041d8 <_imp__Sleep@4+244>: imul   $0x746c6946,0x6e(%edi),%ebp
0x004041df <_imp__Sleep@4+251>: gs
0x004041e0 <_imp__Sleep@4+252>: jb     0x4041e2 <_imp__Sleep@4+254>
0x004041e2 <_imp__Sleep@4+254>: add    %al,(%eax)
0x004041e4 <_imp__Sleep@4+256>: jmp    0x4041e8 <_imp__Sleep@4+260>
0x004041e6 <_imp__Sleep@4+258>: push   %ebx
0x004041e7 <_imp__Sleep@4+259>: insb   (%dx),%es:(%edi)
0x004041e8 <_imp__Sleep@4+260>: gs
0x004041e9 <_imp__Sleep@4+261>: gs
0x004041ea <_imp__Sleep@4+262>: jo     0x4041ec <_imp__Sleep@4+264>
0x004041ec <_imp__Sleep@4+264>: add    %al,0x0(%eax)
0x004041ef <_imp__Sleep@4+267>: add    %al,(%eax)
0x004041f1 <_imp__Sleep@4+269>: inc    %eax
0x004041f2 <_imp__Sleep@4+270>: add    %al,(%eax)
0x004041f4 <_imp__Sleep@4+272>: add    %al,0x0(%eax)
0x004041f7 <_imp__Sleep@4+275>: add    %al,(%eax)
0x004041f9 <_imp__Sleep@4+277>: inc    %eax
0x004041fa <_imp__Sleep@4+278>: add    %al,(%eax)
0x004041fc <_imp__Sleep@4+280>: add    %al,0x0(%eax)
0x004041ff <_imp__Sleep@4+283>: add    %al,(%eax)
0x00404201 <_imp__Sleep@4+285>: inc    %eax
0x00404202 <_imp__Sleep@4+286>: add    %al,(%eax)
0x00404204 <_imp__Sleep@4+288>: add    %al,0x0(%eax)
0x00404207 <_imp__Sleep@4+291>: add    %al,(%eax)
0x00404209 <_imp__Sleep@4+293>: inc    %eax
0x0040420a <_imp__Sleep@4+294>: add    %al,(%eax)
0x0040420c <_imp__Sleep@4+296>: add    %al,0x0(%eax)
0x0040420f <_imp__Sleep@4+299>: add    %al,(%eax)
0x00404211 <_imp__Sleep@4+301>: inc    %eax
0x00404212 <_imp__Sleep@4+302>: add    %al,(%eax)
0x00404214 <_imp__Sleep@4+304>: add    %al,0x0(%eax)
0x00404217 <_imp__Sleep@4+307>: add    %al,(%eax)
0x00404219 <_imp__Sleep@4+309>: inc    %eax
0x0040421a <_imp__Sleep@4+310>: add    %al,(%eax)
0x0040421c <_imp__Sleep@4+312>: add    %al,0x0(%eax)
0x0040421f <_imp__Sleep@4+315>: add    %al,(%eax)
0x00404221 <_imp__Sleep@4+317>: inc    %eax
0x00404222 <_imp__Sleep@4+318>: add    %al,(%eax)
End of assembler dump.

Also I want to mention that it might have something to do with threading.
In a nonthreaded app I don't have any problems with gdb 6.3.50 stack
dumping.

Thanks for your help,

Roland



             reply	other threads:[~2005-04-19  7:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-19  7:34 Roland Schwingel [this message]
2005-04-19  7:45 ` Mark Kettenis
2005-04-19  8:01 Roland Schwingel
     [not found] ` <4268B942.5080300@onevision.de>
2005-04-22 17:51   ` Mark Kettenis
2005-04-25 12:35 Roland Schwingel
2005-04-25  8:00 ` Roland Schwingel
2005-04-25 19:35 ` Mark Kettenis
2005-04-25 19:45   ` Daniel Jacobowitz
2005-04-25 20:37     ` Mark Kettenis
2005-04-26  9:11 Roland Schwingel
2005-04-26 11:53 Roland Schwingel
2005-05-02  7:04 Roland Schwingel
2005-05-08 13:31 ` Mark Kettenis
2005-05-08 23:20   ` Christopher Faylor
2005-05-09  4:48     ` Eli Zaretskii
2005-05-09  5:26       ` Christopher Faylor
2005-05-09  5:30     ` Stan Shebs
2005-05-10  8:38 Roland Schwingel
2005-05-10  8:39 Roland Schwingel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4264B432.9000101@onevision.de \
    --to=roland.schwingel@onevision.de \
    --cc=drow@false.org \
    --cc=gdb@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox