Forum Replies Created
-
AuthorPosts
-
subvertParticipant
I dont have a license key I am using trial
subvertParticipantUpdate:
Alright, just in case someone comes upon this thread, this is my final setting which worked:
I Uninstalled VisualKernel 4.0 and installed 3.1r9 just for one last try, and somehow this time it did install completely on VS2019 and i was able to create a Linux kernel module project. I’m not sure why Linux kernel module template didn’t appear last time i installed 3.1r9.
Now this time i selected the hello world, and then used KGDBoE with the default setting, and used Ubuntu 16.04 VM as the target machine.
This time, KGDBoE worked and i was able to debug the code without any issues so far.
As to why all of the sudden everything works, and how is KGDBoE working even tho when i try to insmod it manually it gives me “invalid parameters” error, i really don’t know, i guess it was the combination of using VS2022 with VisualKernel 4, which both are farily new and one is still in Beta.
Another side note:
Coming from a Windows driver development world, I’m fairly impressed with this project, because compared to debugging windows drivers, the experience so far has been much more efficient in terms of performance (knock on wood). For example, single stepping through source code when using visual studio with a target windows machine is much more slower compared to when i use VisualKernel on a target Linux machine.
- This reply was modified 2 years, 3 months ago by subvert.
subvertParticipantBut considering that VisualKernel has an option to debug a remote physical machine (selecting Target a physical x86/x64 machine in Target Type section), then isn’t that exactly the same thing that i am doing? These two VMs in virt-manager are basically two separate machines, so how is this different? I basically need to debug a remote machine from my windows 10 VM..
subvertParticipantNote that I’m not sure whether or not installing the Ubuntu/Windows as a VM in virt-manager vs actually having two separate computers will make any difference or not, but i mentioned it just to be clear what my current situation is.
One thing i suspect is the COM ports, can i just select any available COM port that is presented to my in VisualKernel, both in the target Linux and the Windows machine? Tried selecting the first and second COM port for both the machines, but no luck. When i use COM port for communication, do i need to do anything in my host machine, which is a fedora 36 silverblue? This part really confuses me because aren’t i already connected to the target using ssh? why do i need COM communication if i already selected ssh as a connection method before?
- This reply was modified 2 years, 3 months ago by subvert.
subvertParticipantSteps to reproduce:
- Download the latest Ubuntu (22.04) or Ubuntu 18.04, and install it as a VM in virt-manager, and install a Windows 10 as a VM in virt-manager.
- Install VS2019 and VisualKernel 4.0 or 3.1r9, to reproduce the problem of ” Linux Kernel Module Wizard” not showing up as a template when trying to create a new project in VS2019
- Install VS2022 and VisualKernel 3.1r9, to reproduce the problem of ” Linux Kernel Module Wizard” not showing up as a template when trying to create a new project in VS2022
- Install VS2022 and VisualKernel 4.0 in Windows 10 to finally be able to create a linux kernel module project
- Create new Linux Kernel Module Wizard project in VS2022
- Select Hello World
- Setup a new target for running kernels -> Target a physical x86/x64 -> Create a new ssh connection (And obviously check beforehand that you can actually ssh to target)
- Build settings:
- Selecting next will now reproduce the problem of smart device error:
- Now uncheck the download symbol box to pass this stage, or use the debug ready Fedora 36 that you guys provide as a debug ready VM instead of Ubuntu, and give it to virt-manager and do the steps again, doing this will not give the smart device error at this stage
- Keep the default settings in source code access (store source files on windows computer)
- In Debug Settings, if you select “Debug a physical machine over network”, you cannot debug it as it gives the “Cannot build kgdboe”, this happened in fedora 36, Ubuntu 18, 22, cannot build it anywhere, even after installing the build essentials.
- Selecting “Debug a physical machine over a COM port” and selecting any COM port on Linux and Windows machine and any named pipe, will give the “Failed to start GDB session” error i mentioned above.
subvertParticipantSo i tried the pre built fedora 36 ready for debugging VM that you guys have (QEMU version), And it got me through the symbol problem, and i used COM port this time instead of network to get around the building error i shared above, but still got the following GDB error……..
Failed to start GDB session
VisualKernel version: 4.0.0.2309
(gdb begin)
— GDB Session —
Your VisualKernel trial expires in 30 days!
C:\Program Files (x86)\Sysprogs\VisualKernel\KernelTools\gdb-multiarch.exe –interpreter mi
-gdb-set breakpoint always-inserted on
=thread-group-added,id=”i1″
~”GNU gdb (GDB) 12.1\n”
~”Copyright (C) 2022 Free Software Foundation, Inc.\n”
~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.”
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
~”\nType \”show copying\” and \”show warranty\” for details.\n”
~”This GDB was configured as \”–host=i686-w64-mingw32 –target=x86_64-linux-gnu\”.\n”
~”Type \”show configuration\” for configuration details.\n”
~”For bug reporting instructions, please see:\n”
~”<https://www.gnu.org/software/gdb/bugs/>.\n”
~”Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>.”
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
~”\n\n”
~”For help, type \”help\”.\n”
~”Type \”apropos word\” to search for commands related to \”word\”.\n”
^done
-file-exec-and-symbols “C:\\Program\ Files\ \(x86\)\\Sysprogs\\VisualKernel\\KernelTools\\amd64\\dummy\.elf”
^done
add-symbol-file c:/KernelCache/5.18.10-200.fc36.x86_64.kernel/vmlinux 0xffffffff88000000 -s .rodata 0xffffffff89200000 -s .pci_fixup 0xffffffff8977d7a0 -s .tracedata 0xffffffff89780e40 -s __ksymtab 0xffffffff89780eb8 -s __ksymtab_gpl 0xffffffff89793134 -s __ksymtab_strings 0xffffffff897a5ec0 -s __init_rodata 0xffffffff897e2ca0 -s __param 0xffffffff897e2ed0 -s __modver 0xffffffff897e7698 -s __ex_table 0xffffffff897e76e0 -s .notes 0xffffffff897e8f64 -s .BTF 0xffffffff897e917c -s .BTF_ids 0xffffffff89d007fc -s .data 0xffffffff89e00000 -s __bug_table 0xffffffff8a1a3a80 -s .orc_unwind_ip 0xffffffff8a1c7d14 -s .orc_unwind 0xffffffff8a3e89f4 -s .orc_lookup 0xffffffff8a719d44 -s .vvar 0xffffffff8a75a000 -s .data..percpu 0x0 -s .init.text 0xffffffff8a78f000 -s .init.data 0xffffffff8a806000 -s .x86_cpu_dev.init 0xffffffff8a9d7210 -s .parainstructions 0xffffffff8a9d7238 -s .retpoline_sites 0xffffffff8a9e5d68 -s .altinstructions 0xffffffff8a9f0610 -s .iommu_table 0xffffffff8a9fff98 -s .apicdrivers 0xffffffff8aa00060 -s .exit.text 0xffffffff8aa000a0 -s .smp_locks 0xffffffff8aa02000 -s .data_nosave 0xffffffff8aa0d000 -s .bss 0xffffffff8aa0e000 -s .brk 0xffffffff8b000000 -s .init.scratch 0xffffffff8b200000
&”add-symbol-file c:/KernelCache/5.18.10-200.fc36.x86_64.kernel/vmlinux 0xffffffff88000000 -s .rodata 0xffffffff89200000 -s .pci_fixup 0xffffffff8977d7a0 -s .tracedata 0xffffffff89780e40 -s __ksymtab 0xffffffff89780eb8 -s __ksymtab_gpl 0xffffffff89793134 -s __ksymtab_strings 0xffffffff897a5ec0 -s __init_rodata 0xffffffff897e2ca0 -s __param 0xffffffff897e2ed0 -s __modver 0xffffffff897e7698 -s __ex_table 0xffffffff897e76e0 -s .notes 0xffffffff897e8f64 -s .BTF 0xffffffff897e917c -s .BTF_ids 0xffffffff89d007fc -s .data 0xffffffff89e00000 -s __bug_table 0xffffffff8a1a3a80 -s .orc_unwind_ip 0xffffffff8a1c7d14 -s .orc_unwind 0xffffffff8a3e89f4 -s .orc_lookup 0xffffffff8a719d44 -s .vvar 0xffffffff8a75a000 -s .data..percpu 0x0 -s .init.text 0xffffffff8a78f000 -s .init.data 0xffffffff8a806000 -s .x86_cpu_dev.init 0xffffffff8a9d7210 -s .parainstructions 0xffffffff8a9d7238 -s .retpoline_sites 0xffffffff8a9e5d68 -s .altinstructions 0xffffffff8a9f0610 -s .iommu_table 0xffffffff8a9fff98 -s .apicdrivers 0xffffffff8aa00060 -s .exit.text 0xffffffff8aa000a0 -s .smp_locks 0xffffffff8aa02000 -s .data_nosave 0xffffffff8aa0d000 -s .bss 0xffffffff8aa0e000 -s .brk 0xffffffff8b000000 -s .init.scratch 0xffffffff8b200000\n”
~”add symbol table from file \”c:/KernelCache/5.18.10-200.fc36.x86_64.kernel/vmlinux\” at\n”
~”\t.text_addr = 0xffffffff88000000\n”
~”\t.rodata_addr = 0xffffffff89200000\n”
~”\t.pci_fixup_addr = 0xffffffff8977d7a0\n”
~”\t.tracedata_addr = 0xffffffff89780e40\n”
~”\t__ksymtab_addr = 0xffffffff89780eb8\n”
~”\t__ksymtab_gpl_addr = 0xffffffff89793134\n”
~”\t__ksymtab_strings_addr = 0xffffffff897a5ec0\n”
~”\t__init_rodata_addr = 0xffffffff897e2ca0\n”
~”\t__param_addr = 0xffffffff897e2ed0\n”
~”\t__modver_addr = 0xffffffff897e7698\n”
~”\t__ex_table_addr = 0xffffffff897e76e0\n”
~”\t.notes_addr = 0xffffffff897e8f64\n”
~”\t.BTF_addr = 0xffffffff897e917c\n”
~”\t.BTF_ids_addr = 0xffffffff89d007fc\n”
~”\t.data_addr = 0xffffffff89e00000\n”
~”\t__bug_table_addr = 0xffffffff8a1a3a80\n”
~”\t.orc_unwind_ip_addr = 0xffffffff8a1c7d14\n”
~”\t.orc_unwind_addr = 0xffffffff8a3e89f4\n”
~”\t.orc_lookup_addr = 0xffffffff8a719d44\n”
~”\t.vvar_addr = 0xffffffff8a75a000\n”
~”\t.data..percpu_addr = 0x0\n”
~”\t.init.text_addr = 0xffffffff8a78f000\n”
~”\t.init.data_addr = 0xffffffff8a806000\n”
~”\t.x86_cpu_dev.init_addr = 0xffffffff8a9d7210\n”
~”\t.parainstructions_addr = 0xffffffff8a9d7238\n”
~”\t.retpoline_sites_addr = 0xffffffff8a9e5d68\n”
~”\t.altinstructions_addr = 0xffffffff8a9f0610\n”
~”\t.iommu_table_addr = 0xffffffff8a9fff98\n”
~”\t.apicdrivers_addr = 0xffffffff8aa00060\n”
~”\t.exit.text_addr = 0xffffffff8aa000a0\n”
~”\t.smp_locks_addr = 0xffffffff8aa02000\n”
~”\t.data_nosave_addr = 0xffffffff8aa0d000\n”
~”\t.bss_addr = 0xffffffff8aa0e000\n”
~”\t.brk_addr = 0xffffffff8b000000\n”
~”\t.init.scratch_addr = 0xffffffff8b200000\n”
~”(y or n) [answered Y; input not from terminal]\n”
~”Reading symbols from c:/KernelCache/5.18.10-200.fc36.x86_64.kernel/vmlinux…\n”
^done
-gdb-version
~”GNU gdb (GDB) 12.1\n”
~”Copyright (C) 2022 Free Software Foundation, Inc.\n”
~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.”
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
~”\nType \”show copying\” and \”show warranty\” for details.\n”
~”This GDB was configured as \”–host=i686-w64-mingw32 –target=x86_64-linux-gnu\”.\n”
~”Type \”show configuration\” for configuration details.\n”
~”For bug reporting instructions, please see:\n”
~”<https://www.gnu.org/software/gdb/bugs/>.\n”
~”Find the GDB manual and other documentation resources online at:\n <http://www.gnu.org/software/gdb/documentation/>.”
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
~”\n\n”
~”For help, type \”help\”.\n”
~”Type \”apropos word\” to search for commands related to \”word\”.\n”
^done
-list-features
^done,features=[“frozen-varobjs”,”pending-breakpoints”,”thread-info”,”data-read-memory-bytes”,”breakpoint-notifications”,”ada-task-info”,”language-option”,”info-gdb-mi-command”,”undefined-command-error-code”,”exec-run-start-option”,”data-disassemble-a-option”]
-gdb-set verbose on
^done
-gdb-set disassembly-flavor intel
^done
-gdb-set print demangle off
^done
-gdb-set architecture i386:x86-64
~”The target architecture is set to \”i386:x86-64\”.\n”
^done
info target
&”info target\n”
~”Symbols from \”C:\\Program Files (x86)\\Sysprogs\\VisualKernel\\KernelTools\\amd64\\dummy.elf\”.\n”
^done
-break-insert -f /tmp/VisualKernel/c/Dev/Linux/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36_main.c:8
&”warning: could not convert ‘/tmp/VisualKernel/c/Dev/Linux/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36_main.c’ from the host encoding (CP1252) to UTF-32.\nThis normally should not happen, please file a bug report.”
&”\n”
&”No source file named /tmp/VisualKernel/c/Dev/Linux/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36_main.c.\n”
^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”<PENDING>”,pending=”/tmp/VisualKernel/c/Dev/Linux/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36_main.c:8″,times=”0″,original-location=”/tmp/VisualKernel/c/Dev/Linux/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36/LinuxKernelModuleFedora36_main.c:8″}
-break-delete 1
^done
-break-insert -f LinuxKernelModuleFedora36_main.c:8
&”No source file named LinuxKernelModuleFedora36_main.c.\n”
^done,bkpt={number=”2″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”<PENDING>”,pending=”LinuxKernelModuleFedora36_main.c:8″,times=”0″,original-location=”LinuxKernelModuleFedora36_main.c:8″}
-target-select remote :55572
^error,msg=”Remote communication error. Target disconnected.: (undocumented errno 10061).”— Linux 5.18.10-200.fc36.x86_64 —
VisualGDB has hooked printk() and will display its output in this window.
You can disable this in VisualGDB Project Properties.I really wanted your product to work, But I’m struggling to get it to work no matter what setting i use…..
- This reply was modified 2 years, 3 months ago by subvert.
subvertParticipantAlso tried to give the gdb to it manually, no luck.
And even without the symbols, i cannot debug the target as i get the following error when i press 5:
Cannot build kgdboe
Run “make -C “/lib/modules/$(uname -r)/build” M=”/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8″ modules” in directory “” on local computer
————————–
make: Entering directory ‘/usr/src/linux-headers-5.15.0-46-generic’
CC [M] /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/irqsync.o
CC [M] /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_main.o
CC [M] /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.o
make: Leaving directory ‘/usr/src/linux-headers-5.15.0-46-generic’
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_main.c: In function ‘kgdboe_init’:
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_main.c:71:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
71 | int err = kgdboe_io_init(device_name, udp_port, local_ip, force_single_core != 0);
| ^~~
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c: In function ‘kgdboe_rx_handler’:
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:40:17: error: implicit declaration of function ‘kgdb_schedule_breakpoint’; did you mean ‘kgdb_arch_remove_breakpoint’? [-Werror=implicit-function-declaration]
40 | kgdb_schedule_breakpoint();
| ^~~~~~~~~~~~~~~~~~~~~~~~
| kgdb_arch_remove_breakpoint
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c: In function ‘kgdboe_read_char’:
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:76:5: warning: this ‘while’ clause does not guard… [-Wmisleading-indentation]
76 | while (s_IncomingRingBufferReadPosition == s_IncomingRingBufferWritePosition)
| ^~~~~
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:79:9: note: …this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
79 | result = s_IncomingRingBuffer[s_IncomingRingBufferReadPosition++];
| ^~~~~~
In file included from /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:8:
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c: In function ‘kgdboe_io_init’:
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/tracewrapper.h:8:30: warning: initialization of ‘int *’ from ‘long unsigned int’ makes pointer from integer without a cast [-Wint-conversion]
8 | #define kallsyms_lookup_name ((unsigned long(*)(const char *))kallsyms_lookup_name_address)
| ^
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:163:30: note: in expansion of macro ‘kallsyms_lookup_name’
163 | int *_gro_normal_batch = kallsyms_lookup_name(“gro_normal_batch”);
| ^~~~~~~~~~~~~~~~~~~~
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:163:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
163 | int *_gro_normal_batch = kallsyms_lookup_name(“gro_normal_batch”);
| ^~~
In file included from /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.c:8:
At top level:
/tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/tracewrapper.h:23:27: warning: ‘do_lookup_tracepoint’ defined but not used [-Wunused-function]
23 | static struct tracepoint *do_lookup_tracepoint(const char *tracepointName, const char *tracepointPtrName)
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:297: /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8/kgdboe_io.o] Error 1
make: *** [Makefile:1881: /tmp/kgdboe-b02afbe5-399e-4642-9ee8-71900ab73bb8] Error 2
————————–
Command exited with code 2- This reply was modified 2 years, 3 months ago by subvert.
-
AuthorPosts