Unable to set windbg for windows VM - windows

I want to debug the kernel of windows server 2019. My physical host is windows 10. My
VM is windows server 2019(VirtualBox). I followed this video on youtube to complete my
setup<https://www.youtube.com/watch?v=V7DJ_ptkOpM>.
I got this on my VM which I think it's not the reason I failed
c:\KDNET>.\kdnet.exe 172.26.48.1 51111
Enabling network debugging on Intel(R) PRO/1000 MT Desktop Adapter.
Manage-bde.exe not present. Bitlocker presumed disabled.
To debug this machine, run the following command on your debugger host machine.
windbg -k net:port=51111,key=1gofrzddjdu9q.2stxhh3p9pieh.114a4fe4c4vr4.16nbo0k9ghw3v
Then reboot this machine by running shutdown -r -t 0 from this command prompt.
I run the command
windbg -k net:port=51111,key=1gofrzddjdu9q.2stxhh3p9pieh.114a4fe4c4vr4.16nbo0k9ghw3v
The result is this
Using NET for debugging
Open WinSOCKET 2.0
Failed to initialize IPv6 socket. Error On-2147467259
Will attempt to connect to IPv4 only
Failed to initialize IPv4 socket. Error On-2147467259
Kernel debugger failed initialization. HRESULT 0x80004005
unspecified error

Related

Cypress on WSL with X-Server opens empty windows

I've followed this article for running Cypress on WSL (Ubuntu distribution).
When I run cypress open in WSL it does open Cypress app on Windows but Cypress doesn't display anything and WSL throws errors:
[4186:1214/162139.560525:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[4186:1214/162139.560902:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[4186:1214/162139.564644:ERROR:udev_watcher.cc(63)] Failed to enable receiving udev events.
[4186:1214/162139.579120:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[4339:1214/162139.734198:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[4339:1214/162139.739939:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
When I run cypress run (headless) tests end with timeout:
Running: layout/footer.spec.ts (1 of 19)
Timed out waiting for the browser to connect. Retrying...
When I run cypress run --headed it opens VcXsrv window but it's all empty:
After a while it opens another VcXsrv window, also empty. While tests are failing with timeouts (The browser never connected. Something is wrong.) it continues to open more and more empty VcXsrv windows.
My Node version is 16.1.8. Cypress version 9.7.0. Ubuntu version 22.04.1 LTS.

J-Link GDB debugging in CLion

Not long ago CLion added support for Remote GDB debugging and I'm trying to set it up with Seggers's J-Link GDB server.
My setup:
VM VirtualBox running Ubuntu 16.04
J-Link drivers: V6.10
Target chip: nRF51 (ARM Cortex M0)
CLion 2016.2.2
I usually work in windows, but as CLion doesn't support remote GDB in windows I'm trying to make it work running Ubuntu in VirtualBox. I configured the debugger in CLion like shown in the image with a little help from the blog in the link above. The arguments I have used are based on the J-Link documentation (Document: UM08001) and some guessing.
GDB server setup
My problem is that when running the debugger the process just stops and CLion's console outputs:
"Could not connect to target. Please check power, connection and
settings."
I have tried to run JLinkGDBServer from the terminal and then I get as far as this:
/usr/bin/JLinkGDBServer -device nrf51422_xxAC -if swd -speed 1000 -endian little
SEGGER J-Link GDB Server V6.10 Command Line Version
JLinkARM.dll V6.10 (DLL compiled Sep 14 2016 16:46:16)
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: nrf51422_xxAC
Target interface: SWD
Target interface speed: 1000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 5 2016 08:42:09
Hardware: V1.00
S/N: 681666518
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...
Does anyone have a clue of what I'm doing wrong?
You're probably confusing GDB server and GDB itself. Those are GDB options that should be set in the GDB Remote Debug Configuration in CLion, not GDB server settings.
That is, you first run JLinkGDBServer manually, for example, from terminal, just as you've done already, and leave it waiting for GDB to attach. At this moment one should notice the connection port:
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...
Then edit your GDB Remote Debug Configuration in CLion to use the host GDB (most likely /usr/bin/gdb in your case, install it using sudo apt install gdb if necessary), and use the port mentioned above as part of the "target remote" string:
GDB: /usr/bin/gdb
"target remote" args: :2331
Notice the preceding colon in front of the port. This is a shorthand for connecting to localhost using TCP. Just in case, the explicit form is tcp:localhost:2331.
Now you can start the debug session. CLion will start the configured host GDB, GDB communicates to JLinkGDBServer through the specified TCP connection, and finally the GDB server chats with your device.

Cannot start GDBserver using a serial connection

I'm running a small test program on an embedded Linux target (a Freescale i.MX25), which I'd like to debug using GDB. I connect to the system using an FTDI USB-RS232 cable through am Ubuntu VM. GDBserver is installed on the target. I do not have Ethernet or USB support on the target, so I'm trying to use GDB over serial.
When I log into the target using Minicom, I get:
login[1691]: root login on 'ttymxc0'
which I presume means that the console is using ttymxc0. Then, I try to start GDBserver listening for connections from the VM to the test program, residing in /home:
$ cd /home
$ gdbserver /dev/ttymxc0 test
which gives the output (repeatedly):
Remote debugging using /dev/ttymxc0
readchar: Socket operation on non-socket
Remote side has terminated connection. GDBserver will reopen the connection
Is this an error in the way I'm trying to use GDBserver, or something else? Is there another way to debug the program?
You can not use ttymxc0 for two things at the same time (serial console and serial gdb). Disable the getty on that serial line and replace it by the gdbserver.

VS 2013 kernel-mode driver debugging

I'm trying to set up kernel debugging with VS 2013. When I go to Drivers/Add to add a new target machine, it connects to the remote computer and runs through a lot of setup, but it there are always 2 commands that fail.
I looked up the command that is failing in the log and I pasted it into a batch file and ran it on the target machine. I runs just fine. But then when I try to rerun Add Computer from VS, I get the same failure.
RemoteExecute: Binary: $KitRoot$\Testing\Runtimes\TAEF\te.exe
RemoteExecution: Arguments:
"%SystemDrive%\DriverTest\Run\DriverTestTasks.dll"
/select:"#Name='DriverTestTasks::_ConfigureKernelDebugger'"
/p:"DebugTransport=NET" /p:"NetHost=192.168.1.109" /p:"NetPort=50015"
/p:"NetKey=8XD3HYLMVI0D.RKFEA2BPIXO.27JOLNYURED5.MV9OGRF4XR9V"
/p:"StartPolicy=Active" /p:"IgnoreUserModeExceptions=0"
/p:"SuppressReboot=1"
/rebootStateFile:%SystemDrive%\DriverTest\Logs\DriverTestReboot.xml
/enableWttLogging
/wttDeviceString:$LogFile:file="%SystemDrive%\DriverTest\Logs\Configure_debugger_settings_(x86)_(possible_reboot)_00007.wtl",writemode=append,encoding=unicode,nofscache=true,EnableLvl="WexStartTest|WexEndTest|WexXml|WexProperty|WexCreateContext|WexCloseContext|*"
/runas:Elevated RemoteExecute: Process creation return code: 0
RemoteExecute: Process exit code: 0 Initialize: Computer: w8x86wdk-hp
Result completed Test process exit code: -1
I have tried this both with a VMware VM target and against a physical PC target and I have tried adding the computer in the reverse direction and I always get the same failures. I can ping these machines from each other and all machines are Win8 x86. Network discovery and sharing are on. The Windows firewalls are off. These are virgin OS installations so there's nothing on the machines except the OS, VS2013, and WDK 8.1.
Any tips on how to resolve this?
Had same issue when used ws2012 for TARGET machine.
When installed WIN81 instead, turned off UAC and DID NOT install wdk on TARGET - everything started working. Read carefully how to PROVISION TARGET. (it says: dont' install WDK there:)
HOST and TARGET was in the same home workgroup with same passwords for Administrator and MyUserAcc.
also:
under HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System set EnableLUA=0
I am just testing it so I think you should first check your target computer security issue. Then set your port pipe connection and your network adapter setting in your virtual pc.
After that setting make your computer configuration then works perfectly.

Does anyone here uses Linux host/VMWare/VirtualKD debug environment?

Does anyone had a successful experience with VirtualKD setup on Linux host running VMWare Workstation 8 (with Win7 guests)?
Despite the facts there's a lot of admiring comments about 'speed' and 'other benefits' of that VirtualKD, most of them come from Windows/VirtualBox users, and I really don't want to waste my time on trying to get it working on unsupported configuration.
P.S. Official VirtualKD forum has a similar thread that is still unanswered for two years, so decided to ask for reviews here.
P.P.S. My actual problem is that VMWare's socket-based COM port debugging is very slow.. it takes 10 to 20x more time to copy debug output from debuggee to debugger machine, than it takes to print same output to DbgView.
Does anyone had a successful experience with VirtualKD setup on Linux host running VMWare Workstation 8 (with Win7 guests)?
VirtualKD is a Windows-only application. The poster on the forum has worked around the problem of it being Windows-only by redirecting a Unix socket to TCP, therefore allowing Windows clients to connect over the network.
I've used socat to successfully bridge two VMs using a tcp socket. I created pipes in /tmp and ran socat between them; one VM can then debug the other.
In my case, because I'd configured the debugger to use serial connections I was rate limited by the serial connections. I haven't tried the VirtualKD-style setup; however, my bet is it won't work. From the VirtualKD explanation of its internals on VMWare, the client-side code is basically using hypervisor provided functionality. VirtualBox has to be patched by VirtualKD; I expect this is to provide such functionality to VirtualBox clients.
The bad news is this means, ultimately, that the Linux host hypervisor (VMware/VirtualBox on the host) must know to process that information and pass it out to the appropriate location. By default, it won't know how to do this.
I have a successful experience running it on Windows if anyone is looking for that:
Install VirtualBox 5.x or less and create a virtual machine with a Windows .iso SATA device and set it up
Download VirtualKD-3.0
Open the VM and run vminstall.exe on the guest
On admin cmd on the guest: bcdedit /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
Shut down VM, close VirtualBox and kill the VBoxSVC.exe process
Run VirtualIntegration.exe. If it crashes open an admin cmd and cd to C:\Program Files\Oracle\VirtualBox and then type vboxmanage setextradata <VMNAME> VBoxInternal/Devices/VirtualKD/0/Config/Path <VirtualKD-3.0 folder> i.e. vboxmanage setextradata Windows7 VBoxInternal/Devices/VirtualKD/0/Config/Path C:\Users\lewis\Downloads\VirtualKD-3.0
Open vmmon64.exe and set the debugger path i.e C:\Program Files\Debugging Tools for Windows (x64)\windbg.exe, and then select WINDBG.EXE and start debugger automatically
Launch VM and highlight the VirtualKD entry and press f8 and disable driver signature enforcement and you will soon break into the debugger at nt!RtlpBreakWithStatusInstruction, which is a debugger symbol for the first address of the DbgBreakPointWithStatus, which is called from InitBootProcessor, which is the breakpoint you'd get from sxe ibp;.reboot. There is an earlier breakpoint of sxe ld:nt
You will need to unpatch the VM in order to be able to boot it without vmmon open. VirtualKD is good for logging with debugging protocol packets and automating windbg connection but you can't boot debug with it. In order for boot debugging to work you will need to create a COM1 serial port on the VM and set it to create a pipe \\.\pipe\pipename. You then need to connect to the pipe via windbg manually. Make sure that you have done bcdedit /bootdebug /on && bcdedit /bootdebug {bootmgr} /on && bcdedit /set {bootmgr} debugtype serial && bcdedit /set {bootmgr} baudrate 115200 && bcdedit /set {bootmgr} debugport 1 on the guest before booting.

Resources