Why are there wrong paths in DWARF table - dwarf

I compiled my program with armclang with -g option.
When I try to debug it with Keil it doesn't recognize the source files ( I cannot set breakpoints in them, or see in which function I currently am). I checked the compiled .o files with objdump and it seems that the PATHs to c files are wrong. For example I have:
The problem is that the file is not in F:/MyProject/build/obj\main.c but in F:/MyProject/src/main.c. What can be a reason for the wrong paths? I double-checked with different projects and all paths are correct there

Ok, I found the issue. The problem was that I used flag --save-temps=obj. Without it the paths are correct

Related

How to add library paths in Delphi 10

I am trying to install GLscene but getting problems with the source file locations.
It says in the install instructions to add the GLscene source directories into the global library path in tool/options/Delphi options/Library, which I have done but it has no effect.
I can add the source directories into each package project directory and it then compiles, but I would rather have it accessible globally.
The GLscene library items I have entered are,
C:\Users\Andy\Documents\Embarcadero\Studio\Projects\GLScene_VCL\Source
C:\Users\Andy\Documents\Embarcadero\Studio\Projects\GLScene_VCL\Source\Shaders
C:\Users\Andy\Documents\Embarcadero\Studio\Projects\GLScene_VCL\Source\DesignTime
Which are all correct,
anybody know any reason why the compiler can't find the files in these directories?
The compiler will search for source files on the library path. Note that there are separate library paths for different targets, e.g. Win32, Win64 etc.
If you have source files that cannot be found, then they are not in the library path that you specified.
Personally I don't like the approach of using search paths for source files. I like everything under my project directory so that I can check out from my VCS and have everything I need to build right there. A search path based approach makes serious development very difficult because you cannot maintain branches. What if you have old versions to maintain that use old versions of your libraries?
Well this is a bit late but it could help someone else.
Try and add the paths to both the Library Path and the Debug DCU Path.
Recent Delphi versions have different build configurations for Release and Debug and my guess is that the Debug configuration only searches in the Debug DCU Path.

XCode - iOS - <OCMock/OCMock.h> file not found

I Have an iOS application that I am trying to add OCMock to in order to better unit test it. I've followed the instruction on ocmock.org as well as instructions I've found in other places but still I cannot get my test code to compile.
Here's what I've done
Added the source code to my project directory
Create the groups in my project to mimic my file system
I selected the option to add to my test targets so the framework was added appropriately as well as the Library Search Path
Then I manually added the headers to the Header Search Path
And added the -ObjC linker flag
Then when I go to import the header file, I get the file not found error
Any ideas what I am missing here???
You have the search path test/libraries/OCMock. Then you have #import <OCMock/OCMock.h>.
This fails because there is no file test/libraries/OCMock/OCMock/OCMock.h.
You use the search path test/libraries, or you can create a prefix directory to hold OCMock and have the search path point at that.
I generally have a directory with the library name and version number before the actually directory.
The directory test/libraries/OCMock-X.X.X could contain the OCMock directory. That way the search path still be more specific: test/libraries/OCMock-X.X.X and you still use OCMock/OCMock.h as the include.
One more thing to check, for anyone else having this problem - I copied OCMock from one project to another and everything looked right, but it wasn't finding the include file. It turned out that even though I had the right groups in Xcode, the files had all been dumped into one directory. I needed to create folders on disk and associate them with the groups in Xcode. The accepted answer here clued me in to what was wrong (though as is often the case, in hindsight it should have been obvious).

Xcode *Apple Mach-0 Error

Got this error and I'm not sure what's the problem I haven't touched this project in a few weeks, any help is appreciated...
check here for the images
http://s24.postimg.org/nmsnnsxol/Screen_Shot_2014_04_03_at_21_50_32.png
http://s21.postimg.org/jmfzvludj/Screen_Shot_2014_04_03_at_21_50_55.png
Your library search paths are not proper and that is why the warnings are there Directory not Found.
Since it cant find the directory the compilation fails as the classes are not available.
Go to Build Settings - Library Paths and make sure your paths are proper based on your project directory.
There should not be jumbled \ strings in it.

No symbols/source for external library in Xcode 4

My application is not seeing source code for a library:
If I "Jump to definition" on a library method, XCode takes me to the .h file but says there is no .cpp counterpart
When debugging, I see no source code and most of the call-stack is missing for the library:
I have made sure "Show disassembly when debugging" is UNchecked
I built the library as DEBUG and then packaged up the headers+.a file into a SDK dir. So I guess I need to either copy the debug files into that SDK dir as well, or tell my application where to look. I'm not sure how to do either.
To clarify, my application project doesn't maintain a reference to the library project, only to the .a files and the header dirs. This is because the library project is created by CMake and I don't want to modify it.
First of all, you should check the .debug_str section of your static library to verify it contains the appropriate debug information.
Try running this command on the terminal:
xcrun dwarfdump /path/to/library.a | grep "\.m"
You should see a bunch of your source (.m) file paths printed out. Theoretically, this is where Xcode is going to look when you stop in the debugger, so make sure the paths here are correct. If you don't see any paths, you will need to pass an appropriate debug flag (e.g. -g to the compiler when building your library.
If the paths are somehow incorrect, or you want to point them to some other location, you may be able to modify them as part of the build process in CMake, for example to make them relative to your project directory. Try looking at "Make gcc put relative filenames in debug information", which uses CMake to adjust these debug paths.

IntelliJ refusing to copy text file to the compiled classes folder

The URL below is null, and a null pointer is resulted at "toURI()".
URL u = getClass().getClassLoader().getResource("res/root.txt");
File f = new File(u.toURI());
Scanner sc = new Scanner(f);
I've looked in out/production/MyProject/res and the .txt file is not there. I've tried rebuilding and compiling the project, but nothing so far has made IntelliJ think the .txt file is required. >_>
I've also tried having a look at preferences, though I'm not sure what I'm looking for, the compiler doesn't have anything set to be ignored so I don't know.
Any ideas?
P.S. my operating system is Mac OSX if that helps
In IDEA, Project Settings > Compiler lists resource patterns corresponding to files that will be copied to the compile output path.
By default, files with the .txt extension are not included, so you will simply need to add the corresponding pattern to that list for your project.

Resources