[RFC] `Just My Code Stepping` for non-MSVC debuggers

Hi everyone,

To help ELF-based debuggers(lldb/gdb/sony’s downstream debugger) adopt the MSVC Just My Code Stepping feature (https://devblogs.microsoft.com/cppblog/announcing-jmc-stepping-in-visual-studio/), I’m working on adding the MSVC-style JMC instrumentation to LLVM for ELF-based debuggers (D119910). The instrumentation for ELF shares implementation with the instrumentation for COFF(D118428).

In fact, there are similar features in lldb/gdb already, such as:

  • gdb “skip -file/-function”
  • lldb “target.process.thread” step-in-avoid-nodebug/step-out-avoid-nodebug
    These are different(less powerful than) from Just My Code Stepping in that if the user specifies a function to be skipped, the stepping could only stop after a call to the function. The debugger could not stop at any user code inside that call. For example, If A calls B, B is user code, A is configured to be skipped, lldb/gdb skip B also whereas MSVC debugger could stop at B. I think Just My Code Stepping could complement these features nicely.

Anyone is interested in this feature in the LLVM project? Any concerns or suggestions? Thanks.

I’d definitely love this feature. I suggest that you allow developers to specify somehow a list of foundational libraries that they can skip. This will help in cases when a company has some libraries that replace the standard library and most developers don’t want to debug them.

Thanks for the suggestion, @wallace. MSVC has a config file for this (Debug user code with Just My Code - Visual Studio (Windows) | Microsoft Docs). When an ELF debugger implements the feature, very likely, there would be an equivalent configuration.