Debugging the UOS


Tomasz Bursztyka
 

Hi,

So as the title says I am bit stuck on how to debug a UOS efficiently.

I could not find a way to get a gdb server available for the
UOS, besides for linux which requires to be built with kgdb support if
I understood well(?).

But I am running zephyr as UOS.
And using only printk() is a no go, not because it's the poor man's
solution but because when the vm crashes, I will not be able to stop it
with acrn-dm (even with -f). The only way to recover is to reboot the
entire setup (acrn runs on up squared). It takes then a lot of time,
too much time in fact.

What would be a better method?

Br,

Tomasz


Zou, Terry
 

Hi Tomasz, yes, in our regular release with default industrial config e.g., v1.6.1, we already enabled gdb in both service os, and guest os, but all based on Clear Linux. So from acrn hypervisor perspective, i think there should be no limitation, especially for UOS debug.
We did not try Zephyr gdb yet, but normally if Zephyr support/build gdb in image(suppose doable in zephyr native), it should works as guest. Anyway will double check with Zephyr for more debug experience, keep you updated then, thanks.


Yin, Fengwei <fengwei.yin@...>
 

Hi Tomasz,

On Tue, 26 May 2020 09:09:20 +0200
Tomasz Bursztyka <tomasz.bursztyka@...> wrote:

Hi,

So as the title says I am bit stuck on how to debug a UOS efficiently.

I could not find a way to get a gdb server available for the
UOS, besides for linux which requires to be built with kgdb support if
I understood well(?).

But I am running zephyr as UOS.
And using only printk() is a no go, not because it's the poor man's
solution but because when the vm crashes, I will not be able to stop
it with acrn-dm (even with -f). The only way to recover is to reboot
the entire setup (acrn runs on up squared). It takes then a lot of
time, too much time in fact.

What would be a better method?
My understanding is that you want to debug UOS (which is zephyr) itself.
There are two thing need check:
1. Whether zephyr could support kgdb like debug methodology?
2. If it could, because the limitation that ACRN doesn't support
hardware debugging register, only software breakpoint could be used.

Talking about UOS can't be stopped, if you doesn't care real time
performance (I suppose this is likely true), you can start zephyr as
standard guest. Then you could try to kill acrn-dm to restart UOS.
If you want to shutdown it. a minor change to acrn-dm could achieve
that.


Regards
Yin, Fengwei


Br,

Tomasz




Tomasz Bursztyka
 

Hi Fengwei,

Zephyr does not support kgdb no.

About the RT, I need it because currently only LOAPIC timer works
properly in Zephyr on top of ACRN and thus requires the loapic pass-
through.

Best regards,

Tomasz

Hi Tomasz,

On Tue, 26 May 2020 09:09:20 +0200
Tomasz Bursztyka <tomasz.bursztyka@...> wrote:

Hi,

So as the title says I am bit stuck on how to debug a UOS
efficiently.

I could not find a way to get a gdb server available for the
UOS, besides for linux which requires to be built with kgdb support
if
I understood well(?).

But I am running zephyr as UOS.
And using only printk() is a no go, not because it's the poor man's
solution but because when the vm crashes, I will not be able to
stop
it with acrn-dm (even with -f). The only way to recover is to
reboot
the entire setup (acrn runs on up squared). It takes then a lot of
time, too much time in fact.

What would be a better method?
My understanding is that you want to debug UOS (which is zephyr)
itself.
There are two thing need check:
1. Whether zephyr could support kgdb like debug methodology?
2. If it could, because the limitation that ACRN doesn't support
hardware debugging register, only software breakpoint could be
used.

Talking about UOS can't be stopped, if you doesn't care real time
performance (I suppose this is likely true), you can start zephyr as
standard guest. Then you could try to kill acrn-dm to restart UOS.
If you want to shutdown it. a minor change to acrn-dm could achieve
that.


Regards
Yin, Fengwei

Br,

Tomasz




steven.l.wang@...
 

1. Currently, Zephyr does not support kgdb.
2. If you want to debug UOS with gdb server, I guess that support for gdb server has to ben added in ACRN. 
    - Gdb server can be used to debug zephyr running with qemu. It is because qemu supports gdb server. So, similarly,  gdb server support needs to be enabled in ACRN. 


Tomasz Bursztyka
 

Hello,

About this gdb server missing feature, I just opened a github issue:
https://github.com/projectacrn/acrn-hypervisor/issues/4997


Tomasz

1. Currently, Zephyr does not support kgdb.
2. If you want to debug UOS with gdb server, I guess that support for
gdb server has to ben added in ACRN.
- Gdb server can be used to debug zephyr running with qemu. It is
because qemu supports gdb server. So, similarly, gdb server support
needs to be enabled in ACRN.


Geoffroy Van Cutsem
 

Thanks Tomasz, I think such feature makes sense so thanks for filing the request!!

Geoffroy

-----Original Message-----
From: acrn-users@... <acrn-users@...>
On Behalf Of Tomasz Bursztyka
Sent: Tuesday, June 30, 2020 11:09 AM
To: acrn-users@...
Subject: Re: [acrn-users] Debugging the UOS

Hello,

About this gdb server missing feature, I just opened a github issue:
https://github.com/projectacrn/acrn-hypervisor/issues/4997


Tomasz


1. Currently, Zephyr does not support kgdb.
2. If you want to debug UOS with gdb server, I guess that support for
gdb server has to ben added in ACRN.
- Gdb server can be used to debug zephyr running with qemu. It is
because qemu supports gdb server. So, similarly, gdb server support
needs to be enabled in ACRN.