[Mono-bugs] [Bug 380630] Incorrect line number information caused by the new (!cfg-> arch.omit_fp)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 16 18:46:13 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=380630

User martin at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=380630#c2





--- Comment #2 from Martin Baulig <martin at novell.com>  2008-04-16 16:46:13 MST ---
To reproduce, apply the short hack in `diff' to mini, and set
TEST_DEBUGGER=yes.

This will enable the new code path outside the debugger, so you can debug in
gdb.

Just `gdb --args /work/rohan/INSTALL/bin/mono --debug ./test/A.exe' and run it.
 This'll print a lot of junk until there:

** Message: debug-mini.c:329: 0x99cf68 - 0x2aaaaaaf031b - 0x2aaaaaaf030c - f -
8b
** Message: debug-mini.c:329: 0x954378 - 0x2aaaaaaf031b - 0x2aaaaaaf030c - f -
8f
** Message: debug-mini.c:329: 0x954528 - 0x2aaaaaaf0328 - 0x2aaaaaaf030c - 1c -
92
** Message: debug-mini.c:329: 0x99d580 - 0x2aaaaaaf0334 - 0x2aaaaaaf030c - 28 -
95

Here, it's incorrectly using 28 instead of 1c as the offset.

In IL code, we have:

=====
        IL_0000:  ldc.i4.1 
        IL_0001:  ldc.i4.2 
        IL_0002:  newobj instance void string[,]::'.ctor'(int32, int32)
        IL_0007:  dup 
        IL_0008:  ldc.i4.0 
        IL_0009:  ldc.i4.0 
        IL_000a:  ldstr "Ximian"
        IL_000f:  call instance void string[,]::Set(int32, int32, string)
        IL_0014:  dup 
        IL_0015:  ldc.i4.0 
        IL_0016:  ldc.i4.1 
        IL_0017:  ldstr "Monkeys"
        IL_001c:  call instance void string[,]::Set(int32, int32, string)
        IL_0021:  stloc.0 
        IL_0022:  ldloc.0 
        IL_0023:  call void class [mscorlib]System.Console::WriteLine(object)
        IL_0028:  ret 
=====

and it's JITed like this:

======
X.Multi():
0x40015e90      push   %rbp
0x40015e91      mov    %rsp,%rbp
0x40015e94      push   %rbx
0x40015e95      push   %r12
0x40015e97      push   %r13
0x40015e99      push   %r14
0x40015e9b      push   %r15
0x40015e9d      sub    $0x8,%rsp
0x40015ea1      xor    %r15d,%r15d
0x40015ea4      mov    $0x996840,%edi
0x40015ea9      mov    $0x1,%esi
0x40015eae      mov    $0x2,%edx
0x40015eb3      xor    %rax,%rax
0x40015eb6      mov    $0x40015e75,%r11
0x40015ec0      callq  *%r11d
0x40015ec3      mov    %rax,%r14
0x40015ec6      mov    %r14,%r13
0x40015ec9      mov    $0x2aaaab61bfa0,%r12
0x40015ed3      mov    %r13,%rdi
0x40015ed6      mov    %r12,%rsi
0x40015ed9      callq  0x40015e7f
0x40015ede      xor    %edx,%edx
0x40015ee0      xor    %ecx,%ecx
0x40015ee2      mov    0x10(%r13),%rax
0x40015ee6      movslq 0x4(%rax),%rsi
0x40015eea      sub    %rsi,%rdx
0x40015eed      movslq (%rax),%rsi
0x40015ef0      cmp    %rdx,%rsi
0x40015ef3      jbe    0x40015fc1:X.Multi()+0x131
0x40015ef9      movslq 0xc(%rax),%rsi
0x40015efd      sub    %rsi,%rcx
0x40015f00      movslq 0x8(%rax),%rax
0x40015f04      cmp    %rcx,%rax
0x40015f07      jbe    0x40015fba:X.Multi()+0x12a
0x40015f0d      imul   %rdx,%rax
0x40015f11      add    %rcx,%rax
0x40015f14      imul   $0x8,%rax,%rax
0x40015f18      add    %r13,%rax
0x40015f1b      add    $0x20,%rax
0x40015f1f      mov    %r12,(%rax)
0x40015f22      mov    %r14,%rbx
0x40015f25      mov    $0x2aaaab61bb40,%rax
0x40015f2f      mov    %rax,0xffffffffffffffd0(%rbp)
0x40015f33      mov    %rbx,%rdi
0x40015f36      mov    0xffffffffffffffd0(%rbp),%rsi
0x40015f3a      callq  0x40015e7f
0x40015f3f      xor    %edx,%edx
0x40015f41      mov    $0x1,%ecx
0x40015f46      mov    0x10(%rbx),%rax
0x40015f4a      movslq 0x4(%rax),%rsi
0x40015f4e      sub    %rsi,%rdx
0x40015f51      movslq (%rax),%rsi
0x40015f54      cmp    %rdx,%rsi
0x40015f57      jbe    0x40015fb3:X.Multi()+0x123
0x40015f5d      movslq 0xc(%rax),%rsi
0x40015f61      sub    %rsi,%rcx
0x40015f64      movslq 0x8(%rax),%rax
0x40015f68      cmp    %rcx,%rax
0x40015f6b      jbe    0x40015fa4:X.Multi()+0x114
0x40015f71      imul   %rdx,%rax
0x40015f75      add    %rcx,%rax
0x40015f78      imul   $0x8,%rax,%rax
0x40015f7c      add    %rbx,%rax
0x40015f7f      add    $0x20,%rax
0x40015f83      mov    0xffffffffffffffd0(%rbp),%rcx
0x40015f87      mov    %rcx,(%rax)
0x40015f8a      mov    %r14,%r15
0x40015f8d      mov    %r15,%rdi
0x40015f90      callq  0x40010373:X.Single()+0x53
0x40015f95      lea    0xffffffffffffffd8(%rbp),%rsp
0x40015f99      pop    %r15
0x40015f9b      pop    %r14
0x40015f9d      pop    %r13
0x40015f9f      pop    %r12
0x40015fa1      pop    %rbx
0x40015fa2      leaveq 
0x40015fa3      retq   
0x40015fa4      mov    $0x48,%esi
0x40015fa9      mov    $0x2000134,%edi
0x40015fae      callq  0x40002260
0x40015fb3      mov    $0x5c,%esi
0x40015fb8      jmp    0x40015fa9:X.Multi()+0x119
0x40015fba      mov    $0xac,%esi
0x40015fbf      jmp    0x40015fa9:X.Multi()+0x119
0x40015fc1      mov    $0xc0,%esi
0x40015fc6      jmp    0x40015fa9:X.Multi()+0x119
======

Looking at the line number table, we generate:

======
....
  26    f   84 0x40015f14
  27    f   88 0x40015f18
  28    f   8b 0x40015f1b
  29    f   8f 0x40015f1f
  30   1c   92 0x40015f22
  31   28   95 0x40015f25
  32   1c   9f 0x40015f2f
  33   1c   a3 0x40015f33
  34   1c   a6 0x40015f36
.....
======

But 0x40015f25 is in the middle of the method - its offset should be ic, not
28.

Note that the bug goes away if you disable the `cfg->arch.omit_fp = FALSE' in
mono_arch_compute_omit_fp().  We're also generating a few more instructions if
`omit_fp == FALSE', so I assume it's one of these extra instruction causing the
problem.

Martin


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list