Illegal Instruction

Russel Winder russel at winder.org.uk
Tue Nov 7 18:06:44 UTC 2017


David,

> Running "disas(semble)" once you hit the illegal instruction should 
> print the code surrounding the instruction pointer in disassembled
> form. 
> Seeing which instruction fails and where it is would be an inroads 
> towards reducing/tracking down the issue.

I think I may now have a clue for you.

> The output you show has gdb stopping on SIGUSR1, which is (was?) used
> by 
> the GC internally to synchronise between threads. You might need to
> run 
> "handle SIGUSR1 noprint nostop" to avoid having to manually continue 
> each time until you actually hit the illegal instruction.

Eminently successful, :-)

> GDB should automatically switch to the faulting thread, but if it 
> doesn't, "info threads" to display a list of all threads and "thread 
> <n>" to switch between them might be helpful.

(gdb) info threads
  Id   Target Id         Frame 
  1    Thread 0x7ffff7fb2700 (LWP 27525) "me-tv" 0x00007ffff4ee466d in poll () at ../sysdeps/unix/syscall-template.S:84
  2    Thread 0x7fffe7c15700 (LWP 27529) "gmain" 0x00007ffff4ee466d in poll () at ../sysdeps/unix/syscall-template.S:84
  3    Thread 0x7fffe7414700 (LWP 27530) "gdbus" 0x00007ffff4ee466d in poll () at ../sysdeps/unix/syscall-template.S:84
* 4    Thread 0x7fffe50f4700 (LWP 27531) "me-tv" 0x0000555555600c9a in std.variant.VariantN!(32uL).VariantN.handler!(frontend_manager.FrontendAppeared).handler(std.variant.VariantN!(32uL).VariantN.OpID, ubyte[32]*, void*) ()
  5    Thread 0x7fffe48f3700 (LWP 27532) "me-tv" __lll_unlock_wake () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:371
  6    Thread 0x7fffd7fff700 (LWP 27533) "me-tv" clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:80

So it seems to have switched as expected since:

Thread 4 "me-tv" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7fffe50f4700 (LWP 27531)]
0x0000555555600c9a in std.variant.VariantN!(32uL).VariantN.handler!(frontend_manager.FrontendAppeared).handler(std.variant.VariantN!(32uL).VariantN.OpID, ubyte[32]*, void*) ()

I wont put the full disassembly here just now, in case the answer is
here in this fragment.:


(gdb) disas
Dump of assembler code for function _D3std7variant18__T8VariantNVmi32Z8VariantN50__T7handlerTS16frontend_manager16FrontendAppearedZ7handlerFE3std7variant18__T8VariantNVmi32Z8VariantN4OpIDPG32hPvZl:
   0x0000555555600800 <+0>:	push   %rbp
   0x0000555555600801 <+1>:	push   %r15
   0x0000555555600803 <+3>:	push   %r14
   0x0000555555600805 <+5>:	push   %r13
   0x0000555555600807 <+7>:	push   %r12
   0x0000555555600809 <+9>:	push   %rbx
   0x000055555560080a <+10>:	sub    $0xb8,%rsp
   0x0000555555600811 <+17>:	mov    %edx,%ebp
   0x0000555555600813 <+19>:	mov    %rsi,%r14
   0x0000555555600816 <+22>:	mov    %rdi,%r12

…

   0x0000555555600c6c <+1132>:	movups %xmm3,0x40(%rax)
   0x0000555555600c70 <+1136>:	movups %xmm2,0x30(%rax)
   0x0000555555600c74 <+1140>:	movups %xmm1,0x20(%rax)
   0x0000555555600c78 <+1144>:	movups %xmm0,0x10(%rax)
   0x0000555555600c7c <+1148>:	mov    0x23c145(%rip),%rsi        # 0x55555583cdc8
   0x0000555555600c83 <+1155>:	lea    0x23ce06(%rip),%rdx        # 0x55555583da90 <_D46TypeInfo_S16frontend_manager16FrontendAppeared6__initZ>
   0x0000555555600c8a <+1162>:	mov    %rax,%rdi
   0x0000555555600c8d <+1165>:	callq  0x5555555ec440 <_D3std7variant16VariantException6__ctorMFC8TypeInfoC8TypeInfoZC3std7variant16VariantException at plt>
   0x0000555555600c92 <+1170>:	mov    %rax,%rdi
   0x0000555555600c95 <+1173>:	callq  0x5555555ec180 <_d_throw_exception at plt>
=> 0x0000555555600c9a <+1178>:	ud2    
   0x0000555555600c9c <+1180>:	mov    %rax,%rbx
   0x0000555555600c9f <+1183>:	xor    %edi,%edi
   0x0000555555600ca1 <+1185>:	mov    $0xd,%edx
   0x0000555555600ca6 <+1190>:	lea    0x38(%rsp),%rsi
   0x0000555555600cab <+1195>:	callq  *0x30(%rsp)
   0x0000555555600caf <+1199>:	mov    %rbx,%rdi
   0x0000555555600cb2 <+1202>:	callq  0x5555555ec600 <_d_eh_resume_unwind at plt>
End of assembler dump.
(gdb)



-- 
Russel.
==========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-ldc/attachments/20171107/bd94d58f/attachment.sig>


More information about the digitalmars-d-ldc mailing list