qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Understand reason for SIGSEGV


From: vivek pandya
Subject: Understand reason for SIGSEGV
Date: Wed, 17 Jan 2024 11:40:42 +0530

Hello Qemu Community!

I am trying to debug a rv32im ELF with the following command and attaching GDB to it.

qemu-riscv32-static -cpu rv32 -g 1234 /home/vivek/dev/mozak-vm/examples/target/riscv32im-mozak-zkvm-elf/debug/fibonacci

However I am getting SIGSEGV on executing instruction sw ra, 12(sp). Below dump shows relevant register values.
Can someone kindly help me fix this?

(gdb) disass
Dump of assembler code for function guest::__start:
   0x01000478 <+0>:     addi    sp,sp,-16
=> 0x0100047c <+4>:     sw      ra,12(sp)
   0x01000480 <+8>:     auipc   ra,0x0
   0x01000484 <+12>:    jalr    836(ra) # 0x10007c4 <_ZN5guest3env4init17h44225ca281c81721E>
   0x01000488 <+16>:    auipc   ra,0x0
   0x0100048c <+20>:    jalr    -988(ra) # 0x10000ac <fibonacci::mozak_generated_main::main>
   0x01000490 <+24>:    auipc   ra,0x0
   0x01000494 <+28>:    jalr    932(ra) # 0x1000834 <_ZN5guest3env8finalize17h0ed5e0df9ab35cd7E>
   0x01000498 <+32>:    lw      ra,12(sp)
   0x0100049c <+36>:    addi    sp,sp,16
   0x010004a0 <+40>:    ret
End of assembler dump.
(gdb) i r
ra             0x1000478        0x1000478 <guest::__start>
sp             0x40010010       0x40010010
...
pc             0x100047c        0x100047c <guest::__start+4>
(gdb) si

Program received signal SIGSEGV, Segmentation fault.


Thanks!
Vivek

reply via email to

[Prev in Thread] Current Thread [Next in Thread]