- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm afraid you may consider this question somewhat basic, but it has stumped me so far.
How do I connect the debugger to a routine which is called from an external program (in my case, MATLAB)? All I can find in the debugger help file is a description of how to connect the debugger to a running process by finding its pid. However, I can't see how to find a pid for a process which only runs for a fraction of a second between when MATLAB calls it and when it finishes and sends back the result.
So far I've been putting code into my DLL to pop up a console window from within the function and interact directly with the user that way. However, the routine I'm writing has reached a level of complexity where I feel the need for something more sophisticated...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your DLL project, go to the project properties, then Debugging. The Command property will be blank - fill this in with the complete path to the executable (MATLAB.exe, etc.) you want to run. You can also set the working directory if you choose.
Set a breakpoint in your DLL routine and then click the Go button to start debugging. MATLAB will run, and when it calls your DLL, you'll get the breakpoint.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. I'm afraid, though, that what happens when I try this is that on pressing the 'Go' button a dialog box pops up saying "Debugging information for matlab.exe cannot be found or does not match. No symbols loaded. Do you want to continue debugging?' On selecting 'Yes', Matlab is booted-up automatically (as I'd hoped) but from that point on it runs just as if I wasn't in debug mode: breakpoints are just sailed past.
After one or two false starts, I've made sure that MATLAB is loading the DLL straight from the compiler's own Debug directory which contains the latest compilation of the DLL and the associated pdb file etc.
Am I missing something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll persevere, and come back with a further question if I'm still not successful. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the end I couldn't get things to work as described. However, I tried instead connecting to the pid of the main MATLAB process before it called the DLL, and this worked fine. When MATLAB subsequently called the DLL, it stopped at the breakpoint and opened up the debugger just as I'd hoped.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page