Skip to content

Conversation

@mingxwa
Copy link
Member

@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

@mingxwa mingxwa requested review from guominrui and tian-lt November 18, 2024 11:45
@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