SDL2 framework causes a crash in my application. I would like to debug the framework code (i.e. place a breakpoint in a file inside the framework) to examine the problem further. How can I do this?
I have the SDL2 framework project with the source code. I can build both projects with debugging information etc.
I tried to attach (Debug > Attach to Process... > APPNAME) the SDL2 project to the running instance of my app, but I receive the following error:
Lost connection to "My Mac". Restore the connection to "My Mac" and
run APPNAME again, or if APPNAME is still running, you can attach to
it by selecting Debug > Attach to Process > APPNAME.
If debugging a framework is impossible, I'd like to know the best way to debug a third-party library in OS X. The SDL2 project gives option to build the library as a static or dynamic library as well.
Related
I am trying to deploy and debug a xamarin.mac app inside a xamarin.forms application. I can build it but am not able to deploy it to my mac. (I am using VS for mac) the error pop up is not helpful either as the link supplied leaves me at a 404 page.
No one else in my team has this issue and build configurations and settings are the same.
Error message
Unable to launch application to debug, possibly due to it crashing quickly.
See https://aka.ms/xm-crash-no-output for more help.
Could not open /Users/sam/myapp: pid returned -1
I have some problem which is stopping Delphi XE2 from building my project for the OSX platform. I've gone back to basics and created a brand new 'Hello World' console application project. The program compiles/builds/runs fine on the Win32 platform. I add OSX as a new platform for the project, and my remote profile is configured correctly and clicking 'Test Connection' confirms it can see my MacBook. Problem is when I activate the OSX platform, then click 'Build' (under Debug or Release) then the progress window appears as usual and no errors occur, but no output files are created and the 'OSX32' subfolder doesn't get created.
Any ideas what might be the problem?
Solved it - no idea how it got there but in Tools->Options->Environment Variables I had an entry under 'User overrides' as follows :
PLATFORM = Win32
This meant the compiler was only ever building for Win32, regardless of which platform was currently activated.
As somebody said, the Unity project must be run on devices, but that is a lot of trouble. Is there any way to run a project in iOS's simulator?
Prerequisites:
Mac
XCode
Unity3D for Mac
Guide:
Go to Edit > Player settings > Inspector > iOS tab. Change the Target SDK to Simulator SDK then build the project again.
Open Build Settings and switch platform to iOS.
In the same window set Run XCode as Debug, check Development Build and Script Debugging.
Click Build and Run, choose a directory for iOS builds (for example, create a new directory named Build.iOS)
Build's a long process, take a break.
Unity3D documentation - Building your Unity game to an iOS device for testing.
It was supported until Unity3D 3.3. and iOS 4.??? But the current release 3.4 crashes. See this posting in Unity3D forum.
Anyway I find it easier to run the project in in editor player for debugging and do real testing on the device. Deploying to iPhone via XCode is always annoyingly slow. So I designed my code to distinguish at startup between device and player like
if (Application.platform == RuntimePlatform.IPhonePlayer) {
// do what ever you need
} else ...
Working with the abstract factory design pattern or singletons makes it pretty easy.
Can anyone point me to the documentation on how to make Instruments run UIAutomation scripts and start the iPhone application with the debugger running in the Simulator?
Constraints:
I only have iPhone 3g hardware to test with and debugging against the device with UIAutomation just does not reliably work.
Normally the test scripts are just ran to make sure everything passes, but now a weird bug exists that only gets triggered when the UIAutomation script runs (which is a good thing). The bug cannot be duplicated in manual operation.
There does not seem to be anyway to attach Instruments UIAutomation to a process already running in the simulator. There is no selection.
Starting Instruments UIAutomation directly does not cause it to start with the debugger.
I would assume that there is some command line magic that can be configured in Instruments edit active target (environment variable, arguments, working directory) to make this happen, but I've not found the magic paragraph.
Thanks,
Neil
This stumped me for a while, too -- especially since when the Automation Instrument is selected, the Instruments application explicitly says Current instrumentation disallows attach. The key is to realize that an app running in the simulator is visible in your host system as its own process, so attaching directly from GDB works well. These instructions are for XCode 4.2 (4C199) on Snow Leopard 10.6.8:
Start your test in Instruments however you normally do (either directly from Instruments, or from Xcode 4's Product -> Profile. Pick whatever templates and scripts to get your automated test underway.
Back in Xcode, under the menu Product -> Attach to Process, you should see your iOS app, listed by name, alongside all the other applications on your host computer. In fact, it very likely will be listed first, under the section header Likely Targets.
If it's not visible, choose View -> Debug Area -> Show Debug Area so you can see the gdb console.
Hit the pause button (Product -> Debug -> Pause) to interrupt your program. Set breakpoints, inspect, as usual.
Then next question is: why can't I see my normal NSLog() output in the debugger console?
Your app already bound itself to the console output streams, so the simplest place to look for its output is in OS X Console app (/Applications/Utilities/Console.app) and look under DATABASE SEARCHES -> All Messages.
I'm developing an app for the iPhone, but I guess the question is the same on the Mac.
What is your approach to debug the state of your application after it has been launched by its URL scheme?
There is a way to debug your application when it is launched from an external URL:
Set a breakpoint where you want it in application:handleOpenURL: or application:didFinishLaunchingWithOptions:
In Xcode, edit the Active Executable's settings. On the Debugging tab, select the "Wait for next launch/push notification" checkbox.
Build and Debug. The Console will give you an alert saying "Waiting for [AppName] to launch... The debugger will attach to [AppName] the next time it is launched."
Open your app by invoking a custom URL or sending it a push notification. The debugger will stop at your breakpoint.
I'm on Xcode 8.2.1 and the fastest way is to simply go to Product -> Edit Scheme and select “Wait for executable to be launched” like the image below. When debugging started, it will not launch the app but "waiting for "THE APP" to launch..". When an action (click on the push notification), the breakpoint will kick in.
Actually, I think it would be quite different on the Mac than on the iPhone as you can have the application open already on the Mac and call the URL scheme, whereas on the iPhone you need to quit the application to open another to call the URL scheme.
What you could try is adding a debug button to your UI which allows you to call the URL scheme from inside the running application (calling -openURL: on NSWorkspace). This should in theory work the same whether your app is open or closed when the URL scheme is sent.