I'm using Visual Studio 2017 to develop a C++ app on a remote Linux machine. First, I run my code on the remote machine and then attach to the remote process using SSH. I attach to Native (GDB) code and hit my breakpoint. The problem is that I can't view the contents of a string received in the debugger.
std::string msg_str(static_cast<char*>(incoming.data()), incoming.size());
The string above is retrieved via ZeroMQ message. If I do a QuickWatch on msg_str, none of the values are in a human readable form.
What I expect to see is:
{"message":"mark","color":"#FFAABB","session_id":"XVg32B","x":34,"y":563}
What do I need to do in order to view this in the VS2017 debugger?
edit
No I'm not compiling with VS. I'm developing a game using the Urho3D engine. On the Linux box I use cmake to create the makefile and then compile/link using make from a SSH bash shell. In VS I get all kinds of build errors.
I've been searching high and low for more information on how to set this project up, to no avail. My biggest problem is that I'm a C# developer trying to come up to speed with C++. The learning curve is pretty steep...
I think the problem is that you've attached to the remote process and VS doesn't know that it's supposed to be looking at a std::string. Are you able to run your test by building then executing from within VS? Does VS know that the source it can see is what's running in the debugger?
It looks like at least some of the string is visible in QuickWatch as _M_p. The result you expect doesn't appear to be a simple string, could this have a bearing?
I just tried inspecting std::string ss ("12345", 5) in QuickWatch in VS2017 (15.7.3) and the string is displayed exactly as you would expect. But I did compile and run (F5) from VS.
========= 18 June
You can create a makefile project in VCLinux very easily. Add a new project to your solution and choose Visual C++ - Cross Platform - Linux - Makefile Project. Then copy your sources and makefile into the newly created project directory and add them to the VS project. In the project settings, set the Remote Build commands, e.g. cd $(RemoteProjectDir);make debug and under Debugging set the remote command you want executed.
Depending on how complex your project is, it might be worth creating a very simple, stand-alone test to try out remote building and debugging to verify that you can set a breakpoint and correctly visualise a string.
Not the perfect solution, but I do msg_str.c_str() in the immediate window. Probably wouldn't work well for anything beyond the 7bit ascii subset of utf.
I'm checking out the Linux on Power SDK and want to have a setup using QEMU (Setup 2 from the tutorial page).
So far I've got the SDK, advance toolchain cross compiler and qemu-user-space-emulator all installed on Ubuntu 16.04. The whole process was quite painstaking since the user guide and all other infos often don't refer to the correct package locations and names or redirect to dead links.
I've got a "Hello world" project that I can run with the QEMU setting as described in the user guide but I cannot figure out how to get a debug build and step through the process running in QEMU using GDB. I have to add I'm not too familiar with Eclipse and using QEMU other than virtualizing a whole guest system.
Having command line debugging access is a first step but in the end I want it controllable from the IDE (setting breakpoints on lines, etc.).
Has anybody found any better documentation or knows if this is possible at all?
I've written what should be a very simple unit test using the Native Unit Test project in Visual Studio 2011 Beta. The test builds and fails (not unexpectedly), and I need to debug it. When I try to launch the test under the debugger, the debugger never starts, and instead presents this dialog which lingers indefinitely:
Anyone know what might cause this? I've never had this problem with previous versions of Visual Studio.
Update:
I've opened an MSDN thread on this: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/db3213f8-9658-4470-9e3f-3b67ec954fae
I also opened a connect bug (which apparently was just summarily dismissed): https://connect.microsoft.com/VisualStudio/feedback/details/735369/debugger-wont-start-for-native-unit-test#details
I would need to know some more information regarding this issue but it seems like it is possible that the DebugAttachProcess() method in windows isn't returning which can happen in the case that you do not have enough permissions to do so... make sure you run VS as Administrator, also, you can try to debug it in ollydbg to see if it is an executable problem, although it wont give you the source (you're stuck in assembly).
I have a WPF 4.0 application that I have compiled for x86. When running on 64bit Win7, I need to start up an on-screen keyboard, located in %windows%/System32/osk.exe. Problem is I can't do it- I get an error 'Could not start On-Screen Keyboard'.
I found this thread:
Unable to launch onscreen keyboard (osk.exe) from a 32-bit process on Win7 x64 which sounds exactly like my problem.
I used all the relevant bits from that post, but the error persists. And even worse, I managed to get a 32 bit version of osk.exe and when I try to start THAT I just get a blank error box- no message at all, just a red 'X'.
So I can't compile my app for AnyCPU (3rd party interop libs), and have read that that might not solve the issue anyways. I have also read that one workaround is to disable virtualization using Wow64DisableWow64FsRedirection, but that this is unsafe. Seems like a lot of effort just to run a little app :(
What can I do to launch this little thing from my app?
Wrapping the offending app in a exe compiled with AnyCPU works fine and seems to be the least painful approach.
Many of my users have been telling me that they'd like to run my software on their Linux machines under Wine.
But I'm a Windows Developer who has practically no experience with Linux.
Now I could spend a month or two installing Linux, learning Linux, installing Wine, learning Wine, and thoroughly ensure my application runs well under Wine. But I am still developing for Windows, so I don't want to take so much time away from development right now.
So what can I do without too much effort to get my program running as well as possible under Wine?
I did find this General help on running applications under Wine.
Download VMWare and an Ubuntu virtual machine (Ubuntu is a popular Linux distribution) from the VMWare site. This will provide you with a working Linux O/S inside your Windows environment without needing to install Linux manually.
You can then use the instructions here to install Wine, that Wiki page also provides you with some instructions on how to use it.
If you follow what Adam Rosenfield suggested and just try running your application in Wine unmodified, you will be able to determine quickly whether there are problems. My guess would be that there are some, otherwise your users would not have contacted you about it :)
There are many ways for getting help with debugging applications in Wine, consult the website for options and pick a few ways that suit you. As always, it's best not to rely on a single channel for communication.
Also, if you are more comfortable with developing in Windows, the approach of using a virtual machine will allow you to compile your code as usual in Windows and copy the binary into the virtual machine for testing (Ubuntu supports browsing/mounting Windows shares).
As long as you're not doing anything unusual such as playing around with hardware or poking around in undocumented API calls and data structures, you should be able to run your code under Wine with few or no modifications. Wine has a fairly complete implementation of the public Windows APIs, so if your program plays nice and doesn't mess around, it should just work.
Don't use too much of the windows API! Don't use anything new from Microsoft ;)
Avoid using WPF is the #1 suggestion.
But it really wouldn't kill you to test your app under Wine. It's not that hard to try; it certainly won't take months. For instance:
Use http://www.ubuntu.com/getubuntu/downloadmirrors#wubi to install
Ubuntu into a file on your Windows machine, then start ubuntu and install the latest Wine from
http://winehq.org/download/deb
Then try running your app's installer.
If it doesn't work, check the Wine FAQ, ask for help in one of the wine forums, and/or file bugs in wine's bug tracker.
Should take about three hours from a dead start to trying out your installer.
I was rather surprised when one of my Delphi5 applications just worked out of the zip.
The only real way this is going to work is to do it yourself, i.e. install vmware and a linux distro as Sean suggested. Linux isn't actually that hard, and we're all here to help.
Having done a quick test I can confirm that it largely works. There is an ACCVIO reading 0x34 during start up, the error dialog can be ignored and the application runs, I opened the Steve McCarthy GEDCOM.
Screenshot
This was using Wine 1.1.12 under MEPIS 7.9.94-rc1_32 under VMWare. Highly recommend to use VMWare for this sort of thing.
What language/platform do you develop with? Depending on which it is, it should be no trouble to get it running native. For example, if you use Java or Python, both operate very cleanly on Linux. Likewise, if you're a .NET developer, you should be able, with some pain, to get your app running in Mono.
Find Linux beta testers. It can reports a bug to WINE developers or find a bug in your application.
Wine is more sensitive to errors than Windows. For example, Wine will crash on NULL window handles, and fail to create windows if the class is invalid, whereas Windows is more robust and will just circumvent the error.
It's an opportunity to clean up your code.
I was amazed at how well Wine ran my app the first time I tried. However, I had to get rid of a third-party driver-based component.