Eclipse is not able to find sources during debug - eclipse

I'm building my c/c++ application for arm controllers with gcc in a docker. There together with the .hex and .bin file also the .elf file is generated. Once generated they all are exported out from the container to the host machine. Now I would like to debug the application with openocd, arm-none-eabi-gdb and eclipse cdt. I'm able to start debug session on the target board, but when I stop the debugger (or it stops on its on at startup on main) it is not able to find the source files to show:
Can't find a source file at "/usr/src/Testbench/LIBS/Shell/shell.c"
The path here is the one of the build project in the docker container and has nothing to do with the new debug project on the host where all files are located now.
I tried to edit source lookup path in eclipse with no luck, I could find the file an then it worked for just that file. Also specifying the folders did not work. Anyway, doing it manually always for all files/folders in the project is not an option.
The solution should be "scripted" since all this is part of a CI/devops concept.
It seems that the "wrong" path is hard coded in the elf file. Is there a (scripted) way to change that path to match the actual project location so that eclipse and gdb just work as expected and the developper can see the debug info when debugging?
Possibly it should work on Linux and Windows ;-)
Thanks in advance for your help
Martin

Now it works! In eclipse in the debug configuration in the gdb commands I added :
set substitute-path /usr/src/ ${workspace_loc}
Then I had to go to the source lookup path in eclipse and remove everything.

Related

Eclipse opening and then closing immediately

Eclipse keeps showing the splash screen and then closing immediately after...I just downloaded it so I haven't had the opportunity to make a work space. I've tried uninstalling and reinstalling, the file has already been unzipped at this point I have no idea as to what I should do about this.
Make sure that you have installed Java JDK properly
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Whenever it (Eclipse) encounters a problem that does not warrant launching a dialog, Eclipse saves a report in the workspace log file. The log file can be looked at in four alternative ways.
Locate the file yourself, see workspace/.metadata/.log.
Start Eclipse using -consoleLog. This will print the messages
that normally go to the .log file in the enclosing shell/command window. When the Java VM suffers a hard crash, it produces a separate logging file named something like hs_err_pidXXXXX.log. These files are also helpful for diagnosing
problems.
(Other two might not be useful in your case)
Window > Show View > PDE Runtime > Error Log. This gives you a view
with the contents of the .log file.
Help > About Eclipse Platform > Configuration Details. This
prints out a great number of details about the environment and
also concatenates the .log file. Great for including in a bug
report.
Source
Make sure that Java installed properly..
Uninstall Java and install again, this worked for me

Eclipse: Switching between build configurations doesn't update excluded files

I have two c++ source files. I am building each in a separate build configuration. I have set up each build configuration to exclude the other source file. In the Project Explorer, one of the file's icons has a slash through it, showing it as the source file that is excluded and I cannot refactor code for this source file. This is all as expected, done according to the instructions found here.
I have verified that each file has the "Exclude resource from build" box checked for the appropriate build configuration. Furthermore, I have verified that the build command for each build configuration builds the correct source file.
Then I click Project->Build Configurations->Set Active and select the other build configuration but the same source file is excluded. I also tried switching configurations by actually building the different configurations, but again, the file exclusions remain the same (both the icon shows it as deactivated and I cannot refactor that source file).
I have searched various posts but do not see the exact circumstance I'm facing, though this one was close. Perhaps I don't know the correct terminology to do a proper search.
Am I switching between configurations correctly? Is there a workaround for this behavior (besides including all files in the build, if I need to refactor, and then re-excluding them before build)?
I have seen this behavior in Nsight (running Eclipse 3.8) and in Eclipse Mars (4.5.0). I am running on Linux CentOS 6.7, 64-bit.
In Window->Preferences->Indexer, select "Use active build configuration" (help.eclipse.org/mars/…) in the frame titled "Build configuration for the indexer".

Launch and debug a single script in PyDev

I am a beginner in using Eclipse and PyDev (Aptana Studio 3). I am not used to and i don't understand the workflow in such big IDEs as Eclipse.
I have a simple task: i have a simple Python script, which i want to open and run in Eclipse, having its output in Eclipse console. Or debug it.
Until now i used another IDE called Eric4, which allowed me to do what i want - open a file and run immediately, without creating a project or setting up launch configurations.
Is this possible in Eclipse, or i have to create a project for each file i want to run or debug? I want to understand how it works.
I guess i understand that creating a project is needed at least for settings up the paths (PYTHONPATH), but if it's a single script - somehow to use by default the current directory?
For example i have a folder called snippets where i keep a lot of python scripts which demonstrate some functionality. How do i open these files one by one and run them?
Most of my coworkers launch python scripts in a separate console - python my_scipt.py.
You need to have at least one project with the configuration you want (i.e.: syntax type, interpreter), then, open the file you want to run and press F9.
If it's an external file -- i.e.: a file that's not under a project in Eclipse -- it'll ask you to associate a project with the launch to get the needed information for the launch, but the file doesn't really have to be in the project (note that you can drag external files from your filesystem into Eclipse to open them).
I suggest you follow the steps on the getting started: http://pydev.org/manual_101_root.html (it guides you to configuring PyDev and explains how to do a run/debug session).

Eclipse doesn't recognize lua files after installing the lua plugin

I downloaded Eclipse Classic off of the Eclipse website then the Lua Eclipse IDE plugin. I followed the install instructions but Eclipse doesn't seem to recognize or be able to understand lua files. Can someone help?
Sounds like your file types aren't associated. Click on Window/Preferences and select General/Editors/File Associations.
Add more information
Which installation guide did you follow? (Lua Eclipse Installation?)
Which OS (version)?
Which java version? (Which implementation)
Which eclipse version?
I love these kind of questions because they provide an opportunity to do a test I postponed until now...
So I downloaded the plugin package, and followed the instructions: closed Eclipse, put two jar files in the plugin folder, put the open-ldb.exe elsewhere, restarted Eclipse.
I created a generic project, added a generic file linked to an existing Lua file. When I opened the file, it was automatically identified as such, with a moon icon and correct syntax highlighting.
Using Eclipse 3.5.1 on Windows XP, BTW.
Now, I have an issue, the debugger won't start for me, I get a
Unable to connect to PDA VM
Connection refused: connect
error, not sure why (path to exe file is correct, I have another error when it is wrong).
But at least I have the Lua files recognized without problem.
I think you might want to check that in Preferences > General > Editors > File Associations, *.lua is defined and associated to the Lua editor.
Instead of opening a File you have to do the following:
Open a new LUA project.
Then import using 'File System' all files (resources and LUA files) into the project.
Now you can see and edit the LUA files. Don't know why it doesn't work by simply opening a LUA file directly.

System.getProperty("user.dir") anomaly in Eclipse

In my current project settings, I have configured Eclipse to place the compiled .class files in the /bin directory.
My puzzle is that, when I run the application via the IDE and get it to print the current working directory (System.out.println(System.getProperty("user.dir")) I expect the console output to be /bin - instead the value printed is the projectRoot folder (without the /bin suffix).
If I were to navigate to the /bin folder directly, and execute my java class, the current working directory is printed as I expect it to be. What I would like is the Eclipse IDE to behave similarly.
Any ideas as to why I am observing this disparity? I have gone through many project build settings, but cannot seem to find anything that would cause this anomaly.
Kind regards,
Dinuk
In Eclipse, the working directory defaults to the project directory.
You can change this in the run properties
(Project->Properties->Run/DebugSettings->Edit->Arguments tab, at the bottom of the page).
Edit: Actually, the easiest way to get to it is Run->Open Run Dialog->Arguments tab.
It's been a while since I used Eclipse.
From an example of Eclipse Setup New Project
alt text http://apps.sourceforge.net/mediawiki/sprite2d/nfs/project/s/sp/sprite2d/a/ae/EclipseNewProjectDebugArguments.jpg