Re: Using Visual Studio Code to Debug/Trace Git?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/13/25 12:04 AM, Patrick Steinhardt wrote:

There are two ways to realize what you want right now:

   - Import the CMake build instructions that we have in
     "contrib/buildsystems". It has existed for a rather long time, but
     is not an officially supported way to build Git. It's also lacking a
     couple of features that you can expect from our Makefile, like
     building docs. It may be good enough though.

   - Generate a Visual Studio solution via Meson by installing Meson and
     then running `meson setup --backend=vs2022 build-msvc`. This has
     only landed in Git v2.48 and is thus really new. As such it is still
     marked experimental, but will become an official way to build Git
     and is more feature complete.

I'm aware of an issue with Visual Studio right now though when using it
with Meson that keeps it from working -- I'll send a patch series later
today to fix that issue, and then it should be a good way to build Git
on Windows via MSVC.

Thanks for your thoughtful reply. I'll look into what you describe.

In the mean time, I've discovered another method that seems
to be working, for the very limited execution tracing I'm
doing. What I do, on Fedora 41 Workstation, is to build
Git from source using the standard method. This has the side
effect of generating various .h files that themselves aren't
part of the distribution. Then, using Visual Studio Code,
I open the Git source directory, open common-main.c, and then
set a breakpoint at main(). I can then click on Run->Start Debugging
which starts git and breaks at main(). From there I can set whatever
additional breakpoints I want.

This method has allowed me to trace various things but I'm not sure
if it's a complete solution, especially when forking new processes
or using threads. The one very minor problem I've noticed so far
is that the executable file generated by VSC isn't called 'git'.

I welcome corrections or comments.

I hope this helps other people.

Cordially,
Jon Forrest





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux