Console and Debugger not working while Unit Testing iPhone in XCode - iphone

I am building a logic test suite using Xcode 3.1.4. I am able so far to build the test target and see the results inside de *.m test files as compiler errors (if they fail). The problem is that I can't see any information in the Debugger Console and I can't debug since the debugger does not work either.
1.How can I do to see TestCases ouput on the debugger console?
2.Are there any configuration issues regarding Unit Testing and Debugging test cases?
I would be very greateful if anyone could help me.
Thanks!!

You can setup Google Toolbox for Mac. With it, you will be able to step through your code both on simulator and device.

http://www.grokkingcocoa.com/how_to_debug_iphone_unit_te.html worked great for me, once I unchecked the DYLD_FRAMEWORK_PATH environment variable.

Related

Debugging MBED with Eclipse

I am currently using mac OS to set up a debugger to debug Mbed OS application , I followed the instruction from https://os.mbed.com/docs/mbed-os/v5.12/tutorials/eclipse.html .
I successfully set up the local debug toolchain and I am stuck at this error for quite awhile already. I install "make" as written in the documentary using homebrew and also set the path as suggested but still getting this error
00:13:27 **** Incremental Build of configuration Default for project mbed-os-example-blinky ****
make all
Cannot run program “make”: Unknown reason
Error: Program “make” not found in PATH
PATH=[/Users/roseyv/Developer/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-g++]
00:13:27 Build Failed. 1 errors, 0 warnings. (took 4ms)
Any idea how to resolve this issue? or if there is any other better way we can set up debugger to debug MBED os application
Your help will be greatly appreciated, Thank you in advance!
In the mean time Mbed has updated their website. The link you posted is no longer valid. My suggestion now would be to use Mbed Studio.
Unfortunately Mbed is moving away from supporting Eclipse and only supports IDE's for which you have to be logged in with your account, Mbed Studio or the online compiler.
You could build from the command line option. Next use something like a Segger j-link and Segger Ozone to debug. I found Ozone easier to setup with random code compared to embedded debugging on Eclipse. This is what you pay for.

Error: register 'sp' unsuitable for global register variables on this target

I am playing around with a project for a STM32 µC. I use the SW4STM32 workbench and CubeMX on a Mac OSX system. My project itself is fine, everything compiles accordingly and behaves on the device as expected.
For a further learning purpose, I would like to implement unit tests using the CppuUTest framework. I have set up everything, got my test directories and a makefile to configure the MakefileWorker variables in place.
However, when executing the Makefile, I keep getting the error:
error:
register 'sp' unsuitable for global register variables on this target
This error originates from the file syscalls.c (which is a file generated by CubeMX). The line causing the error is:
register char * stack_ptr asm("sp");
After doing my research, it seems like there is no easy workaround to solve the issue. The source code is generated by Cube and works fine when compiling with the sw4stm32 toolchain (which is using a mcu gcc compiler).
However, the CppUTest toolchain is using clang, which cannot cope with global register variables (as the error says aswell).
My question here ist:
Has anyone of you had the same error yet or more experience in setting up CppUTest for a sw4stm32 project on an OSx system? Does anyone have an idea how to solve this problem?
If you need more information / code snippets from me, I will gladly share it.
Thank you very much guys! Any help would be highly appreciated :-)
Cheers,
Tobi

Debugging STMF4 Discovery in Eclipse using GDB

Hello all: I have never posted on Stackoverflow, but I have always come here for help for years.
I have a question and problem regarding debugging in eclipse using an STLINK STM32 Discovery board. I have looked online for the answer and have followed many tutorials, but I still cannot seem to get it to work correctly. I will try my luck at asking here.
I have set up the eclipse environment correctly with my compiler and gdb server (to my knowledge). First I make sure the server is started before I press debug in eclipse. I am using Atollic STLINK gdb server. I have tried many arm-none-eabi-gdb type exe's while debugging, but they all seem the same. My debug configuration is setup to use arm-none-eabi-gdb on port 61234 (Attolic). When I press debug, the program launches correctly and goes into the debug view in eclipse. The program downloads correctly to my discovery board. I know this because I have gotten debugging to work partially and have stepped through the code without crashing on 'some' occasions depending on the compiled code and debug configuration startup options. The code is a simple LED turn on on the board. If I unplug the usb cable and plug it back in, my code runs fine, because the LEDs light up, so we know the environment is probably set up correctly, because the code downloads to flash via eclipse commands.
The problem is with actual debug steps. 99% of the time the arm-none-eabi-gdb.exe program crashes when in the debug view after I do a few "step into's" with the debugger commands at the top of eclipse. After the first line of my main function is reached, I will try to step into the first line and I get a windows crash of the arm-eabi.exe program. The debug console in eclipse reads a gdb error: .......dwarf2: C10xx Internal Error - unknown CFA rule. Now... depending on how I set the options in the debug configuration with regards to the startup tab, different options produce different results and the following options have been toggled: Halt, resume, break point at : main, etc.. This crash also seems to be dependent on the code being compiled in the main function.
Now, does this have any dependency on which compiler is used with the gdb server and arm-none-eabi-gdb.exe programs? For instance, if I compiled the code with Atollic versus Keil versus code sourcery versus IAR, would the Attollic gdb service + arm-none-eabi-gdb programs be able to work with any compiled code? Are there some missing symbols somewhere not being generated? For reference, I am using an EVAL version of the IAR compiler tool set. If I make a project with the same code in embedded workbench using the STLINK, the code compiles and debugs fine.
What is a CFA rule? Call frame address? Am I not setting up the stack pointer or something in my program? I thought the IAR compiler took care of all that junk in the cstartup.
Any help is appreciated.
Thanks,
LostTime77

iPhone Application crashes in "AdHoc" mode

i got a little application which is working very well with my "debug" configuration on my phone and in simulator.
i created a adhoc provisioning profile, and added a "beta" configuration to it.
trying to launch the application with the ad-hoc configuration crashes my application immediatelly.
the console output is:
Running…
Error launching remote program: failed to get the task for process 2434.
Error launching remote program: failed to get the task for process 2434.
The program being debugged is not being run.
The program being debugged is not being run.
i also created a dist.plsit, unchecked the get-tast-allow and setted this file in my built settings under code signing.
does anyone have an idea?
thanks!
Sometimes when you change lots of things, especially build configs, xcodebuild doesn't seem to figure out which files are stale and links in old stuff that needs to be rebuilt. Try doing a Clean All or just delete your build directory from the project dir. That seems to solve most of these bizarre-ass unexplainable problems for me.
simple thing. i clicked "built and run" instead of "built".
an ad-hoc version cannot be debugged :D

Anyone successful in debugging unit tests for iPhone?

I found examples on how to debug your unit test in Cocoa or the ADC page here.
But I can't get the debugging to work for an iPhone app target. I can get the tests up and running and they are run during the build, but what I need is to debug the tests for some of the more complex failures.
You might consider moving your tests to GHUnit, where they run in a normal application target, so debugging is straightforward.
This can be done by setting up a separate Executable for the project that uses the otest tool to run the unit tests, after setting a bunch of relevant environment variables for the executable. I have used this method to successfully debug SenTestKit logic unit tests.
I found the following links helpful:
http://www.grokkingcocoa.com/how_to_debug_iphone_unit_te.html (also contains help to fix common errors encountered setting up the project).
http://cocoawithlove.com/2009/12/sample-iphone-application-with-complete.html (covers both logic tests and application tests)
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/otest.1.html (Man Page for otest XCode tool)
The NSLog messages show up in Console.app
Should give you a starting point.
In Xcode 4, you can set breakpoints in your unit tests.
Create a new project with "include unit tests" checked.
Put a breakpoint in the failing unit test.
Press Command-U to test.
If you do Build & Go instead of just build, then you can set breakpoints in your unit tests and debug them traditionally. This is if you are using the google toolbox for iphone unit testing; i don't know how you are doing it and if the process is different.