help please! why xadd %eax,0xfffffffc(%edx) cause segment fault?

  • Follow


I'm debugging my c++ codes, in gdb I got these lines:

0x9f927d7b <_Z7testooov+59>:    mov    %edi,(%esp)
0x9f927d7e <_Z7testooov+62>:    mov    $0x10,%edx
0x9f927d83 <_Z7testooov+67>:    mov    %edx,0x4(%esp)
0x9f927d87 <_Z7testooov+71>:    call   0x9f9212bc
<_ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode@plt>
0x9f927d8c <_Z7testooov+76>:    mov    0x2a8(%ebx),%edx
0x9f927d92 <_Z7testooov+82>:    mov    0x254(%ebx),%ecx
0x9f927d98 <_Z7testooov+88>:    add    $0x8,%edx
0x9f927d9b <_Z7testooov+91>:    mov    %edx,0xffffff0c(%ebp)
0x9f927da1 <_Z7testooov+97>:    mov    0xffffff5c(%ebp),%edx
0x9f927da7 <_Z7testooov+103>:   lea    0xc(%ecx),%eax
0x9f927daa <_Z7testooov+106>:   mov    %eax,0xffffff08(%ebp)
0x9f927db0 <_Z7testooov+112>:   add    $0x20,%ecx
0x9f927db3 <_Z7testooov+115>:   mov    $0xffffffff,%eax
0x9f927db8 <_Z7testooov+120>:   mov    %ecx,0xffffff60(%ebp)
0x9f927dbe <_Z7testooov+126>:   lea    0xfffffff4(%edx),%ecx
0x9f927dc1 <_Z7testooov+129>:   lock xadd %eax,0xfffffffc(%edx)

the last line caused a segment fault, could someone help to explain
it?
many thanks!

0
Reply djslls 3/24/2009 9:16:04 AM

On Mar 24, 2:16�am, djslls <spamt...@crayne.org> wrote:
> I'm debugging my c++ codes, in gdb I got these lines:
>
> 0x9f927d7b <_Z7testooov+59>: � �mov � �%edi,(%esp)
> 0x9f927d7e <_Z7testooov+62>: � �mov � �$0x10,%edx
> 0x9f927d83 <_Z7testooov+67>: � �mov � �%edx,0x4(%esp)
> 0x9f927d87 <_Z7testooov+71>: � �call � 0x9f9212bc
> <_ZNSt19basic_ostringstreamIcSt11char_traitsIcESaIcEEC1ESt13_Ios_Openmode@plt>
> 0x9f927d8c <_Z7testooov+76>: � �mov � �0x2a8(%ebx),%edx
> 0x9f927d92 <_Z7testooov+82>: � �mov � �0x254(%ebx),%ecx
> 0x9f927d98 <_Z7testooov+88>: � �add � �$0x8,%edx
> 0x9f927d9b <_Z7testooov+91>: � �mov � �%edx,0xffffff0c(%ebp)
> 0x9f927da1 <_Z7testooov+97>: � �mov � �0xffffff5c(%ebp),%edx
> 0x9f927da7 <_Z7testooov+103>: � lea � �0xc(%ecx),%eax
> 0x9f927daa <_Z7testooov+106>: � mov � �%eax,0xffffff08(%ebp)
> 0x9f927db0 <_Z7testooov+112>: � add � �$0x20,%ecx
> 0x9f927db3 <_Z7testooov+115>: � mov � �$0xffffffff,%eax
> 0x9f927db8 <_Z7testooov+120>: � mov � �%ecx,0xffffff60(%ebp)
> 0x9f927dbe <_Z7testooov+126>: � lea � �0xfffffff4(%edx),%ecx
> 0x9f927dc1 <_Z7testooov+129>: � lock xadd %eax,0xfffffffc(%edx)
>
> the last line caused a segment fault, could someone help to explain
> it?
> many thanks!

Most likely the address in EDX was wrong. See if your pointer variable
is miscalculated, corrupted or not initialized.

Alex

0
Reply Alexei 3/24/2009 3:29:21 PM


1 Replies
138 Views

(page loaded in 0.092 seconds)

Similiar Articles:




7/26/2012 10:21:38 AM


Reply: