Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accessibility in debugging #200

Merged
merged 7 commits into from
Nov 19, 2024

Conversation

mingxwa
Copy link
Collaborator

@mingxwa mingxwa commented Nov 18, 2024

Motivation

Member functions of proxy cannot be called from a debugger, making it difficult to debug with a value of proxy from client code.

Changes

  • Enabled symbol generation for proxy::operator-> and proxy::operator*.
  • Enabled symbol generation for all the pre-defined dispatch types and macros that generates member functions, including operator_dispatch, conversion_dispatch, PRO_DEF_MEM_DISPATCH, PRO_DEF_FREE_AS_MEM_DISPATCH and the dispatch type generated for basic_facade_builder::add_facade<F, true>.

Verification

Build the following code with MSVC in debug mode (without using the value of proxy in the code):

#include <string>

#include "proxy.h"

PRO_DEF_FREE_AS_MEM_DISPATCH(MemToString, std::to_string, ToString);

struct Stringable : pro::facade_builder
  ::add_convention<MemToString, std::string() const>
  ::build {};

int main() {
  int v = 123;
  pro::proxy<Stringable> p = &v;
}

Set a breakpoint at the end of main and inspect the value of p in the debugger. The debugger invokes the correct function for me.

image

proxy.h Outdated Show resolved Hide resolved
@mingxwa mingxwa merged commit b172bae into microsoft:main Nov 19, 2024
7 checks passed
@mingxwa mingxwa deleted the user/mingxwa/debugging branch November 19, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants