[Lldb-commits] [PATCH] D39314: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 26 10:55:21 PDT 2017


zturner added a comment.

A test would be something like this:

  // dll.cpp
  BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, void* reserved) {
    return TRUE;
  }
  
  int __declspec(dllexport) DllFunc(int n) {
    int x = n * n;  
    return x;  // set breakpoint here
  }



  // main.cpp
  int __declspec(dllimport) DllFunc(int n);
  
  int main(int argc, char ** argv) {
    int x = DllFunc(4);
    int y = DllFunc(8);   // set breakpoint here
    int z = DllFunc(16);
    return x + y + z;
  }

Run `main.exe` in the debugger, when you're stopped at the breakpoint get the value of `x` and ensure that it's 4.
**Step out** and get the value of `x` and ensure that it's 8.
**Step in** and ensure the value of `n` is 8, then **run** and ensure the value of `x` is 16.
Delete the breakpoint in the dll, then **run** and ensure the program terminates with a return value of 56


https://reviews.llvm.org/D39314





More information about the lldb-commits mailing list