Skip navigation
VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
2,169 Views 11 Replies Last post: Oct 18, 2010 2:35 PM by buddha100 RSS
J.F.V Novice 15 posts since
May 8, 2008
Currently Being Moderated

Jun 3, 2008 8:19 AM

Question about vmware coredump / vmw-gdb stub

Hello all

 

Let me first make precise that I am using vmware workstation 6.0.3 but this issue also

arises on vmware-ws 6.5b.

 

It happens that I have a strange behavior when debugging a subtle piece of code that does

the following:

 

- switch back from protected mode to real mode

- call some BIOS API

- switch back from real mode to protected mode

- continue the original program

 

When stepping this code in vmware, it works very well and never crash. However, when

executing this code without stepping, vmware crashes with a stack fault, and without

calling the BIOS routine properly.

 

My questions are as follow:

 

- is there anyway to know where the code crash using the vmware coredump file (or another debug option ?)

 

- is it possible that debugging into vmware change rights on memory (just like debugging a userland application

with gdb usually does). More generally, where can I get more information about the vmware gdb stub ?

 

- is there any other known issue (vmware or other) about executing such code, that would explain the difference

of results between debugging into vmware and just letting it run ?

 

Thanks

 

JFV

slava_malyugin Enthusiast 61 posts since
May 14, 2007
Currently Being Moderated
1. Jun 3, 2008 9:11 AM in response to: J.F.V
Re: Question about vmware coredump / vmw-gdb stub

 

Hello J.F.V, please let me address your questions:

 

 

> is there anyway to know where the code crash using the vmware coredump file (or another debug option ?)

 

 

If you get a stack fault (that technically is triple-fault), then yes. If you are using beta build, or release build with "debug=true" then adding the following

 

 

option to config file will make your VM suspend at the moment of triple-fault:

 

 

    monitor.suspend_on_triplefault=true

 

 

Then if you resume the VM by passing one more option on the command line, debugger will get activated before the instruction is executed, just at the point of the triple-fault:

 

 

     .../vmware -s monitor_control.enable_guestdebugonstart=true MyVM.vmx

 

 

You should be able to attach debugger and take a look at memory/registers/etc. If this fails for any reason, take a look at vmware.log file after VM gets  suspended on a triple-fault, there should be register dump at the end of the log. It may help you find location of the code that caused triple-fault.

 

 

Both options are undocumented and unsupported, but I'll try to help if they do not work.

 

 

> Is it possible that debugging into vmware change rights on memory (just like debugging a userland application with gdb usually does). More generally, where can I get more information about the vmware gdb stub ?

 

 

 

Debug stub does not change Guest-visible memory protection. If you use "normal" breakpoints, stub will put "int3" in the Guest memory. With debugStub.hideBreakpoints=1, it is practically invisible. One exception - and the one that frequently masks triple faults - is this: when breakpoint hits (no matter if hidden or not), or when you single-step with the stub, we are flushing hardware TLB. If you happen to have a stale mapping in the TLB, then it could explain why you are getting stack-faults without stub, but do not get them with it. Just to be sure, you may want to try flushing TLB after all page table modifications in your kernel.

 

 

We do not  share that much information about internals of debug stub. If you have access to our Academics Program, or if your employer is part of our Community Source, then you can take a look at sources and contact me and other developers. Otherwise, the best way to find out is to be hired by VMware

 

 

> is there any other known issue (vmware or other) about executing such code, that would explain the difference of results between debugging into vmware and just letting it run ?

 

 

I  think I addressed this question above: stale TLB mappings in Guest kernel would be my best guess. I hope this helps.

 

 

Sincerely,

 

 

Vyacheslav (Slava) Malyugin

 

 

 

 

 

slava_malyugin Enthusiast 61 posts since
May 14, 2007
Currently Being Moderated
4. Jun 3, 2008 2:52 PM in response to: J.F.V
Re: Question about vmware coredump / vmw-gdb stub

 

Sorry, I have been unclear. With monitor.suspend_on_triplefault=true the VM should suspend instead of producing stack fault. Do you observe this?

 

 

 

 

 

Sincerely,

 

 

Vyacheslav (Slava) Malyugin

 

 

slava_malyugin Enthusiast 61 posts since
May 14, 2007
Currently Being Moderated
7. Jun 4, 2008 11:06 PM in response to: J.F.V
Re: Question about vmware coredump / vmw-gdb stub

 

Hi J.F.V. I double-checked the sources for 6.0.3, and the options should work. I guess something is wrong with my assumption about the fault that your VM is getting. Is it possible that you added options to the .vmx file, and then restored from snapshot? Snapshot restore overwrites the values in configuration file. Do you  see all options in the vmware.log after the crash? Could you paste portion of the log a few dozen lines before and after message informing about "stack fault"? Thank you.

 

 

 

 

 

Sincerely,

 

 

Vyacheslav (Slava) Malyugin

 

 

slava_malyugin Enthusiast 61 posts since
May 14, 2007
Currently Being Moderated
10. Jun 5, 2008 2:03 PM in response to: J.F.V
Re: Question about vmware coredump / vmw-gdb stub

 

Hi J.F.V. I agree: the crash appears to be related to the STI. You are in real mode, so there are not too many things that could cause triple fault. Perhaps IDT is pointing at nowhere, or SS is not set up properly? I probably would not be able to help you narrow down the problem, but it seems that you are right in suspectting that IRQ arrived at unexpected time.

 

 

The reason problem does not happen when you single step is because we suspend interrupts while single-stepping. Otherwise you'd end up in the timer handler after every step. You may want to use Record/Replay to record the crash, and then step thru it in Replay mode - you should be able to see the crash.

 

 

 

 

 

Sincerely,

 

 

Vyacheslav (Slava) Mlayugin

 

 

 

 

 

buddha100 Lurker 1 posts since
Oct 18, 2010
Currently Being Moderated
11. Oct 18, 2010 2:35 PM in response to: slava_malyugin
Re: Question about vmware coredump / vmw-gdb stub

I was trying to test this feature by enabling

 

        debug=true

        monitor.suspend_on_triplefault=true

 

in the .vmx file for the VM.

 

Manually induced kernel crash still prints the stack trace to the console

and doesn't suspend the VM.

 

What we would like to do is

    (1) guest VM should suspend on a kernel fault

    (2) we would like to connect to this VM from thru kgdb after resuming the guest

 

Today it looks like there can be only one gdbserver listener on vm management

network at vmnet gateway:8864 for a 64-bit guest.

 

Will the above sequence of triple fault suspend, resume, connect thru kgdb

still work if there are multiple guest VMs started

on the same vm management network on the same hypervisor with the following lines

in the .vmx file

 

  debugStub.listen.guest64 ="TRUE"

  debugStub.listen.guest64.remote ="TRUE"

  debugStub.hidebreakpoints = "TRUE"

  monitor.debugOnStartGuest64 = "TRUE"

 

Thanks,

kvc

Bookmarked By (0)

Share This Page

Communities