Kernel debugging in VS 2012 - visual-studio-2012

I have a Kernel mode filter driver project. Host: Win8 Pro x64 running VS2012, Target:Win8 Pro x64 VM on the same machine. I was able to provision the VM through VS 2012 over the network. I deployed the package project. When I try to deploy and Install the package from VS, I am not able to succeed. So I manually installed the driver and the driver works fine. After installing the driver manually, I attach to the kernel of the VM and click on Break all. I find the Kd console in the immediate window of VS '12. I type the command "bu !DriverEntry" and then I type the "g" command. I see the message Debuggee is running. When I place break points on my code and press any key in the VM, I don't see the break points getting hit in my code. Need help!!

Use Fltmc command to load and attach your filter to a specific drive
You can put breakpoints directly in VS without the need to type in the console, if your filter is getting loaded after you type fltmc load "filter name" VS should stop at the driver entry function breakpoint, you may also need to attach it.
Dont forget to check if your debugger is working by when you click break all target machine should freeze.

I wasn't able to debug through VS. I went for a work around and this time I used a Win7 VM. Made use of the KdPrint() method and used the DebugView tool to see the messages. This is a lengthy process but atleast I'm able to debug my driver. Hope this helps someone else too

Related

Why can't I start the Virtual Machine I just built using VitrualBox?

Everything used to work fine, but I haven't been using Virtual Box for several weeks. Now all of the sudden, I get the following exception when trying to start my Windows 10(32-Bit) VM. Note - Things were working fine several weeks ago. As far as I can tell, I haven't changed anything on my system that would cause this. The exception details are as follow:
VirtualBox - Error In supR3HardenedWinReSpawn (rc=-5640)
Please try reinstalling VirtualBox. where supR3HardenedWinReSpawn
what: 1 VERR_SUP_VP_THREAD_NOT_ALONE (-5640) - Process Verification
Failure: The process has more than one thread
I have been researching this for some time, to avail. Any help would be greatly appreciated.
There is a workaround:
Open VMbox manager
Run your VM with option "Detachable start"
Wait a while and then use "Show" to show the screen
Detachable start option
Show the screen
My setup:
Oracle VM Box 6.0 running on Win10,
VM is Ubuntu 18.04
If you are using vagrant to boot up your Virtual machine, then in most cases the error is due to improper shutdown of the VM. A fix that worked for me is to execute vagrant halt or similar commands multiple times until you have a clean boot.
In case anyone is in the same predicament, I will share what finally fixed my issue. I found a post during my hours and hours of searching that said you have to enable virtualization in BIOS settings. I checked my machine and virtualization was enabled, so I went on searching. At a loss for what to try next, I finally tried turning virtualization off, just to see. No change, but when I went to turn it back on, just as a flook I turned Turbo off, and what do you know - All of the suddent I can start my VM. So the solution, in case it saves someone time:
Uninstall Virtual Box (Latest Version)
Reboot your machine and enter BIOS
Make sure anything with the term 'Virtualization' is turned on
Make sure anything with the term 'Turbo' is turned off
Reboot your machine
Install Virtual Box
Hopefully this saves some poor soul what I had to go through to get this thing working.
METHOD A
If you are using WindHawk, exit it and re-try.
Method B
download previous version from https://www.virtualbox.org/wiki/Download_Old_Builds
install & extensions
Try to re-run your guest OS.
Try to do these steps:
1. Uninstall the VirtualBox program.
2. In your C:\users\\ might have two folders called ".VirtualBox" and "VirtualBox VMs": Delete them
3. Restart your PC
4. Install VirtualBox again
5. Add again your VM
6. It must working fine!
These steps worked for me!
Workaround 1:
Just increase the RAM size from virtual box settings
Right Click on OS image .
Settings->System->MotherBoard
Increase the base memory
Workaround 2:
Change the Paravirtualization Interface from default to none
Right Click on OS image .
Settings->System->Acceleration
Change acceleration from default to none.
The above one's was basically a workaround , which can work in some but not in all.
The best thing would be to reinstall virtual box with latest version which virtual box has tried to rectify the bug and use the same vdi files which was made by Virtual Box .
One of the most common causes that will cause this type of behaviour is a missing driver (VBoxDrv.inf). It’s possible that due to some permission issues, the installation of this crucial driver doesn’t complete during the initial installation. In this case, you can fix the problem by installing the VBoxDrv.inf manually.
1.Fix the directory problem Press Windows key + R to open up a Run dialog box. Inside the text box, type ‘regedit’ and press Enter to open up Registry Editor. When you’re prompted by the User Account Control (UAC), click Yes to grant admin access.
Once you’re inside the Registry Editor, use the left-hand section to navigate to the
following location: HKEY_LOCAL_MACHINE\system\currentcontrolset\services\vboxdrv
After you arrive at the correct location, move over to the right-hand section and
double-click on ImagePath the path associated should be \C:\Program
Files\Oracle\VirtualBox\drivers\vboxdrv\VBoxDrv.sys
if not replace with the above path and click ok.
Install the VBoxDRV.inf OPen location C:\Program Files\Oracle\VirtualBox\drivers\vboxdrv right-click on VBoxDrv.inf and choose Install from the context menu.
Then in cmd run command "sc start vboxdrv"
Restart system. This should work.

Is GPU debugger (beta) from Android Studio 2.2 working?

I am trying to debug some OpenGL code, so I wanted to make use of the GPU debugger from Android Studio. For this I need to get a GPU trace, according to the steps detailed at https://developer.android.com/studio/debug/am-gpu-debugger-trace.html. But, after the dialog for trace name, Android Studio shows directly the message: Failed to attach to process.
Android Studio has version 2.3, and was recently updated.
On the device (Samsung S3) I see the alert: !Waiting for debugger.. process zzz is waiting for debugger to attach.
I tried to enable all GPU related options from developer options in device settings, also to disable all, with the same result. Is this feature working? My setup is not very uncommon.
I reached to a point where I get the message: The GPU debugger does not currently support tracing on this device. So the answer would be that it does not work on S3. I'll leave the question here, maybe it will save someone a few hours of investigation.
When trying to enable Run/Debug Configurations>Profiling>Capture GPU Commands, I was required to install "GPU Tools". Then, after accepting to install, it complained that they were already installed in the folder, and I should remove them prior to new installation. So I moved them away. Then it would give the error from the question.
After some attempts, I decided to put the contents of the folder back, deselect/select again Capture GPU. It said once again that I needed to install GPU tools, but this time I did nothing. The checkbox got checked anyway, and when trying to start the trace, went on to do some stuff without complaining about the attaching to the process. Finally it did not work anyway, but at least I know the reason.

Windows Phone 8 Emulator in VMWare Fusion on OSX

I am attempting to launch the windows phone 8 SDK emulator on my Mac so that i can do simple web testing of mobile websites i build.
I have followed several guides and they all say the same thing.
Such as:
6. Once the content (list of files and folders) is displayed, find the VMware virtual machine configuration file – the file with the .vmx extension.
hypervisor.cpuid.v0 = “FALSE”
And this guide proved to be quite useful to get it setup:
http://developer.nokia.com/Community/Wiki/Windows_Phone_8_SDK_on_a_Virtual_Machine_with_Working_Emulator
I was able to get Hyper-V support enabled and I have even managed to open the Windows Phone 8 Emulator directly from the Hyper-V Manager. But in this state it is missing the chroming, the buttons, and when the mouse goes across the screen it disappears. The solution to this is said to be launching the emulator directly from Visual Studio.
My problem is when ever i try to launch the emulator from Visual Studio it creates a new image and then goes into a boot look where it keeps crashing and restarting over and over again.
When viewing the Hyper-V event logs i see this error:
'WP8SDK720P' has encountered a fatal error. The guest operating system reported that it failed with the following error codes: ErrorCode0: 0xC000021A, ErrorCode1: 0x88EB9150, ErrorCode2: 0x0, ErrorCode3: 0xC0000022, ErrorCode4: 0xD203BC. If the problem persists, contact Product Support for the guest operating system. (Virtual machine ID 50607D9A-6E23-4369-9D89-2730614219BA)
How can i get past this error?
In the end I found a solution, I managed to launch the original Windows Phone VM image directly from the commandline with this command:
"C:\Program Files (x86)\Microsoft XDE\8.0\XDE.exe" /vhd "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images\Flash.vhd" /name WP8SDK720P
I created a new text file with notepad and put this command in it and saved the file on my desktop as a .bat file. This way i can just double click the shortcut and launch the sim.
Hopefully this helps someone else out there. In this way, you don't even need to start visual studio to run the emulator, it makes it much simpler if all you are using the emulator for is testing web-apps.
N.B. if you press FN+DOWN-ARROW you can enable the keyboard to work in the sim.
Follow these steps and see if it might help you to fix the problem.
Step 1: Shut down the Guest operating system (Windows 8 in this case).
Step 2: Open the settings for the VM and select Processors. Look at the left pane and see if you have CHECKED the option "Virtualize Intel VT-x/EPT or AMD-V/RVI" under the Virtualization engine section.
Step 3: Open the configuration file (Windows 8 x64.vmx) for the VM and check if you had added the following line of command (hypervisor.cpuid.v0 = "FALSE") to it as shown in the screen shot. You will generally find the file at the location where the virtual hard disk is placed.
If every thing is right, check to see if you had installed Visual Studio 2012 Update 3 (if you are using Visual Studio 2012 as your IDE).
Hope this helps to fix the issue. If you need more information on how to create a VM for developing windows phone 8 apps, there is a great article on nokia developer forum. You can find it here
Happy Coding!!

"A remote operation is taking longer than expected" x64

First off, I think I've been to every website and forum there is that's discussing this issue and I've tried many different things. I'm at my wits end. This is the dumbest thing and I just want to start coding again!
I'm using Visual Studio Express 2012 for Windows Desktop. I have a x64 project I'm trying to run in Debug mode using the local windows debugger. The only external library I'm using is that of which is required to run DX11.
I attempt to run my program and it freezes. A window pops up saying "A remote operation is taking longer than expected."
I click Terminate and another window pops up asking if I'd like to terminate the remote session. Why yes, I would.
Then it says, "Unable to start program (my path leading to my .exe). The network connection to the Visual Studio Remote Debugger has been closed."
To my understanding, because Visual Studio itself is a 32 bit application, it needs to use the Remote Debugger to compile to x64. Is that correct?
Regardless, I'm still failing to see where that would break down. I've ran several repairs on VS and upgraded to Service Pack 2 (or 1, whichever is the latest).
I've ran a windows repair and uninstalled any VMWare type stuff on my computer. I'm not using a VPN.
I've even copied msvsmon.exe from my laptop (working instance of the project) over to this computer and still no luck.
I'm about ready to Nuke my OS and do a clean install on everything. sigh
Found the problem. It wasn't Windows Firewall like other threads describe. It was my internet filter. I guess it decided to try and block msvsmon.exe because it was using the network. Adding it, along with WDExpress.exe to the application exceptions list did the trick.

Visual Studio 2012 Remote Debugging: Invalid access to memory location

I followed the instructions in this link: http://msdn.microsoft.com/en-us/library/bt727f1t.aspx to install the remote debugger (2012) on my server where the application is running in hope to debug it remotely from my dev machine running visual studio 2012.
I cannot even get as far as viewing the list of processes to attach to on the remote machine. I keep getting "Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named [name]. Invalid access to memory location".
I have managed to successfully connect a few times but then the attach fails immediately then I cannot connect again.
This is causing huge issues for me as I cannot remote debug anything. I must be missing something glaring. Please someone give me a solution.
I've found the only way to correct this is by restarting Visual Studio.
Worked for me. I found it at this blog post about invalid access and remote debugging.
It turns out the one thing I missed was to tell Visual Studio where to find the .pdb symbols relating to the remote process. To do this go to Tools -> Options -> Debugging then in the Symbol (.pdb) locations add the remote location to the pdb files.
To clarify, I was attaching fine but could not break into code. Now I can. Be aware though that there are other hurdles before you get to my stage where I was attaching to the process successfully but could not catch a breakpoint.
I recently had someone else report this and debugged the issue on their machine. The "Invalid access to memory location" errors are due to an issue in Windows, it can be addressed with this hotfix.
I have had this problem in VS 2012, 2013, 2015 and 2017. Based on other answers it is likely that the problem is related to running a 32 bit version of Visual Studio on a 64 bit PC. Sometimes, as others have recommended, restarting Visual Studio fixes the problem but the best solution I've found so far is to start Visual Studio without a solution, open Debug -> Attach to Process, change the Connection Target to the remove server and wait for the process list to load. Then Cancel, do not attach yet. Load your desired solution and then come back to Attach to Process and the remote process list will still be loaded. Connect to your desired process and everything should work properly from then on.

Resources