unikraft / pykraft

Python library for configuring and building unikernels
Other
177 stars 42 forks source link

kraft-compilation: invalid dbg file format (possible bug KVM) #126

Open Daparrag opened 1 year ago

Daparrag commented 1 year ago

Describe the bug After compiling the helloworld project . I noticed the files _helloworld_kvm-x8664.dbg , _helloworld_kvm-x8664 have different formats. I don't know the exact reason but this miss-mach affect the execution of _helloworld_kvm-x8664.dbg in qemu/kvm environments.

I believe this is highly related with the flags used for compilation. In order to solve this issue I would need some input form your side.

Environment

  1. OS
    Linux 5.19.16-051916-generic #202210150742 SMP PREEMPT_DYNAMIC Sat Oct 15 08:5│6, version 1 (SYSV), statically linked, stripped
    6:00 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 
  2. Compiler
    gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0                                  
    Copyright (C) 2019 Free Software Foundation, Inc.                          
    This is free software; see the source for copying conditions.  There is NO 
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  3. Kraft version:
    kraft, version 0.5.0.dev492

    To Reproduce a. follow the get-started guide: https://unikraft.org/docs/getting-started to build the helloworld example for KVM. b. Identify the miss match between the files by tipping the following command.

$ file helloworld_kvm-x86_64.dbg

helloworld_kvm-x86_64.dbg: **ELF 64-bit** LSB executable, **x86-64**, 
version 1 (SYSV), statically linked, with debug_info, not stripped

$ file helloworld_kvm-x86_64

helloworld_kvm-x86_64: **ELF 32-bit** LSB executable, **Intel 80386**, 
version 1 (SYSV), statically linked, stripped

c. follow the guide for debuging: https://unikraft.org/community/hackathons/sessions/debugging

d. after executing helloworld_kvm-x86_64.dbg as KVM partition for debuging you will notice that QEMU cannot execute the binary because there is an incompatibility

$ sudo qemu-system-x86_64 -s -S -cpu host -enable-kvm -m 128 -nodefaults -no-acpi -display none -nographic -device isa-debu
kg-exit  -kernel unikraft/images/helloworld_kvm-x86_64.dbg -nographic  -append verbose             
-- Output
qemu-system-x86_64: Cannot load x86-64 image, give a 32bit one.

Expected behavior expect the qemu launch the kvm partition for debugging

Desktop (please complete the following information):

Daparrag commented 1 year ago

Dears.

About my previous message: I seams there is not bug at all.

It is just a typo in the documentation:
https://unikraft.org/community/hackathons/sessions/debugging/ https://unikraft.org/docs/develop/debugging/

there is something like: $ qemu-guest -P -g 1234 -k build/app-helloworld_kvm-x86_64.dbg but it should be: $ qemu-guest -P -g 1234 -k build/app-helloworld_kvm-x86_64

Should I fix the documentation and push a commit?

Best.