User Tools

Site Tools


developers:env_emul

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
developers:env_emul [2019/04/10 22:07]
mick [Running Linux on QEMU]
developers:env_emul [2019/04/10 22:12]
mick
Line 32: Line 32:
 In case you built bbl or OpenSBI with the Linux kernel as its payload you can omit the ''​-bios''​ parameter and point the ''​-kernel''​ parameter directly to the combined bbl / fw_payload.elf binary. In case you built bbl or OpenSBI with the Linux kernel as its payload you can omit the ''​-bios''​ parameter and point the ''​-kernel''​ parameter directly to the combined bbl / fw_payload.elf binary.
 </​WRAP>​ </​WRAP>​
 +
 +
 +=== Debugging with QEMU ===
 +
 +With the ''​-s''​ option, QEMU allows a remote gdb session, to debug the running system. You may connect to the debugging session through gdb by typing ''​target remote localhost:​1234'',​ here is an example debug session:
 +
 +<​code>​
 +mick@trampakoulas ~/​kexec/​kexec-tools $ riscv64-unknown-linux-gnu-gdb
 +
 +GNU gdb (GDB) 8.2.50.20181127-git
 +Copyright (C) 2018 Free Software Foundation, Inc.
 +License GPLv3+: GNU GPL version 3 or later <​http://​gnu.org/​licenses/​gpl.html>​
 +This is free software: you are free to change and redistribute it.
 +There is NO WARRANTY, to the extent permitted by law.
 +Type "show copying"​ and "show warranty"​ for details.
 +This GDB was configured as "​--host=x86_64-pc-linux-gnu --target=riscv64-unknown-linux-gnu"​.
 +Type "show configuration"​ for configuration details.
 +For bug reporting instructions,​ please see:
 +<​http://​www.gnu.org/​software/​gdb/​bugs/>​.
 +Find the GDB manual and other documentation resources online at:
 +    <​http://​www.gnu.org/​software/​gdb/​documentation/>​.
 +
 +For help, type "​help"​.
 +Type "​apropos word" to search for commands related to "​word"​.
 +(gdb) target remote localhost:​1234
 +Remote debugging using localhost:​1234
 +warning: No executable has been specified and target does not support
 +determining executable automatically. ​ Try using the "​file"​ command.
 +0xffffffffb8916080 in ?? ()
 +(gdb) i r
 +ra             ​0xffffffff80033f4c 0xffffffff80033f4c
 +sp             ​0xffffffffbadd3d60 0xffffffffbadd3d60
 +gp             ​0xffffffff807a7b58 0xffffffff807a7b58
 +tp             ​0xffffffffb883b480 0xffffffffb883b480
 +t0             ​0xbafd5002 3137163266
 +t1             0x2 2
 +t2             0x0 0
 +fp             ​0xbafd5000 0xbafd5000
 +s1             ​0x80200000 2149580800
 +a0             0x6 6
 +a1             0x0 0
 +a2             0x0 0
 +a3             0x0 0
 +a4             ​0xffffffff80765578 -2139728520
 +a5             ​0xffffffff80765578 -2139728520
 +a6             ​0x78 120
 +a7             ​0x2e 46
 +s2             ​0x809f8000 2157936640
 +s3             0x0 0
 +s4             0x0 0
 +s5             ​0x200 512
 +s6             0x1 1
 +s7             ​0xfffffffeffe00000 -4297064448
 +s8             ​0xb8b16058 3098632280
 +s9             0x2 2
 +s10            0x1 1
 +s11            0x0 0
 +t3             ​0x1e108 123144
 +t4             ​0x1e108 123144
 +t5             0x0 0
 +t6             ​0xffffffff807b3465 -2139409307
 +pc             ​0xffffffffb8916080 0xffffffffb8916080
 +(gdb) q
 +A debugging session is active.
 +
 + Inferior 1 [Remote target] will be detached.
 +
 +Quit anyway? (y or n) y
 +Detaching from program: , Remote target
 +Ending remote debugging.
 +[Inferior 1 (Remote target) detached]
 +</​code>​
 +
developers/env_emul.txt ยท Last modified: 2019/04/12 19:16 by mick