gdb failing in Eclipse - eclipse

Here is the tool stack: Installed on Windows 7 (x64) is Eclipse (Juno x64) with CDT and the SConsolidator plugin. Underneath is the TDM-GCC (x64) bundle installed with 64-bit support.
If I build a 64-bit application and debug it using Eclipse (which uses gdb bundled with GCC), it builds without error and debugs fine.
When I build a 32-bit application and try to debug it with Eclipse, it builds fine but gdb fails:
gdb: unknown target exception 0x4000001f...
Debugging it with the same gdb via command line works fine.
Any ideas on how to work around this?
FYI: Here are some warnings leading up to the gdb exception:
warning: `C:\Windows\system32\ntdll.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `C:\Windows\SYSTEM32\wow64.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `C:\Windows\SYSTEM32\wow64win.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `C:\Windows\SYSTEM32\wow64cpu.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: Could not load shared library symbols for ntdll32.dll.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for WOW64_IMAGE_SECTION.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for NOT_AN_IMAGE.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for NOT_AN_IMAGE.
Do you need "set solib-search-path" or "set sysroot"?

I had a similar problem in a different scenario but i think the solution should be applicable here too.
I was gdb.exe downloaded from http://www.equation.com/servlet/equation.cmd?fa=gdb to debug a C++ program.
I first tried the 64-bit because my pc is 64-bit but I got the same error as Paul got above. Then I tried 32-bit gdb.exe and it worked.
I also followed the links that were given by Paul and there was also bundle available for 32-bit. So I assume the bundles depend on the type of application rather than the configuration of the platform. But, I doubt 64-bit bundle will work on 32-bit architecture. I haven't tried that and can't say for sure.
I suggest install the bundles that support 32-bit to debug a 32-bit application.

Related

Build a shared library on a Raspberry using Lazarus

I'm trying to build a shared library to use on a raspberry pi (model 3B) using lazarus. After some puzzling I found out that my original library didn't work properly so I switched to a very simple library using this example.
But even this simple library doesn't compile properly to be used. When I try to open the library in another lazarus project it gives me the error:
< libName >: cannot open shared object file: No such file or directory
After some research I found the following diagnostics I could run. The file and ldd command in the compile library:
$file ./libname.so gives:
./libname.so: ELF 32-bit LSB shared object, ARM, EABI5 verion 1 (SYSV), dynamically linked, not stripped
$ldd ./libname.so
not a dynamic executable
I have searched for similar cases and from found that others had this problem when they tried to use libraries compile for a different platform/architecture. I already set the project>project options>compiler options>target platform to OS:= linux and Target CPU family: arm.
The system I am using (using $uname -a):
Linux raspberrypi 4.4.13-V7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux
with distro: Raspbian GNU/linux 8.0 (jessie)
Lazarus version: 1.2.4+dfsg2-1
FPC version: 2.6.4 arm-linux-gtk2
At this point I am not sure what is wrong and why this library isn't working. I can find very little information on this problem (on the aspberry platform and using lazarus) Any suggestions what I could try to make it work, compile it different or do some more diagnostics?
Found the solution. As Marco proposed above: Add initc to the uses part. It seems that if you try to make a library it has to include initc, cmem or LCL to the uses section because the library has to do some memory management for which it needs one of these units.
However this resulted in another error when trying to load the library:
"Undefined symbol: TC_SYSTEM_ISLIBRARY"
This seems to be a raspberry specific problem, compilers on other systems do not give this error. More information can be found HERE.
Eventually solved this by install fpc 3.0.0 compiler on the raspberry pi, compiled it and the library can be loaded properly (but still needs one of the above units).

Executing cuda program through Eclipse is giving error

I am using eclipse to execute a cuda program. I have downloaded a CUDA PLUGIN for
eclipse. When I execute sample cuda program given by plugin its fine but when I try
to execute any other program I am getting error undefined reference to main...
make
Building target: Add_cuda
Invoking: NVCC Linker
nvcc -L/export/trainee3/dinesh/cuda5.0/lib64 -o "Add_cuda" ./mycuda.o -lcudart
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
I found in stackoverflow that some times we get this problem because of system startup file
I used flag -nostartfiles but it is not working in my case..
I have included lib64 and include path in c++ build.
So any suggestion to over come this problem....
We've been over this already.
Use nsight eclipse edition instead.
If you have cuda 5.0 or 5.5 installed, just type nsight in a terminal session.
If you really want to use that Eclipse CUDA plugin (which is no longer supported, I don't believe), then start with the C++ sample project, which you agree now and back then would work. Then modify the source code in that project. Don't create your own project.
Install CUDA 5. It comes with Nsight Eclipse version. Very Elegant to use. NV Visual profiler is integrated with Nsight. Syntax highlighting and debug mode are very easy to use.

Eclipse juno + cuda plugin error

I am using Eclipse Juno parallel version. I have installed
cuda plugin. But while building a sample cuda helloworld
program I am getting error -
make all
make: *** No rule to make target `exe_cuda', needed by `all'. Stop.
******Makefile snapshot**************
all: exe_cuda
# Tool invocations
#echo 'No tool found that can build the extension specified with the build
artifact name $#'
# Other Targets
clean:
-$(RM) $(OBJS)$(C_DEPS) exe_cuda
-#echo ' '
Any suggestion......
I agree that the toolchain does not appear to be set up properly for C projects.
My suggestions are:
Create a C++ project instead. That seems to work.
Use Nsight Eclipse Edition instead. It is installed automatically with the linux CUDA 5 package (just type nsight from a terminal window).
You could report the problem to fixstars corporation, the developer of that cuda plugin. It seems they have not updated it since 2011, so I don't know if it's actively maintained. But the help page is here which includes a link for a mailing list you could use.

"No source available for.." using Nsight Eclipse Edition RC1 on OSX 10.8.1

I'm trying to use CUDA 5 RC1 on OS X Mountain Lion 10.8.1. When debugging from Nsight Eclipse Edition I get the error:
No source available for main()
I've verified that nvcc is set to use -g and -G to emit device and host debug symbols and that -O0 is set to disable optimizations.
Any ideas what the issue is or some other diagnostics I can carry out?
The issue, for me at least, turned out to be that the architecture needed to be set to x64.
To do this, right click on your project and hit Properties.
Then go to Build --> Settings --> Tool Settings.
Under NVCC Compiler --> Code Generation, set Architecture to x64.
Under NVCC Linker --> Miscellaneous set Architecture to x64.
Finally, clean the project and rebuild.

Get the eclipse version on Mac OS X

How can I get the version of eclipse(x32 or x64 ) in OS X?
You can use the file command to get more information about a file:
$ file /Applications/Preview.app/Contents/MacOS/Preview
/Applications/Preview.app/Contents/MacOS/Preview: Mach-O universal binary with 2 architectures
/Applications/Preview.app/Contents/MacOS/Preview (for architecture x86_64): Mach-O 64-bit executable x86_64
/Applications/Preview.app/Contents/MacOS/Preview (for architecture i386): Mach-O executable i386
As you can see, /Applications/Preview.app/Contents/MacOS/Preview (the executable file for Preview) is both 32- and 64-bit. Substitute the path to Eclipse’s executable and you should be able to find out.
Run Activity Monitor while Eclipse is running. There is a column called 'Kind' which shows whether an app is running in 32 or 64-bit mode.