Apache NetBeans C Debugger Error - Not in executable format - c

I have written, compiled and ran my C program with Apache NetBeans 13 just fine, but when I try to run the debugger I get the following error:
"C:\\Users\\username\\ ... \\ProblemaBombeiros\\dist\\Debug\\MinGW_1-Windows\\problemabombeiros.exe\":
not in executable format: File format not recognized
But the file it found is indeed a executable format .exe .
Here are the configurations for the C/C++ build tools:
Am I doing something wrong or do I need to do something else to start debugging?

Related

"Availability status: error" for working C programs

I recently learned about Visual Studio Code & Intellisense and am currently writing code on that and trying to compile it using Cygwin. However, I'm never able to do it.
I have added C:\cygwin64\binand%systemdrive%:\cygwin\bin` to my system environment variables in settings. I'm doing this on a Windows 11 computer. But every time I try to compile a program, like:
gcc HelloWorld.c
I get:
cc1: fatal error: HelloWorld.c: No such file or directory
compilation terminated.
In file explorer, all the programs I'm trying to compile say "Availability status: error". Specifically, any programs (regardless of language) I have downloaded onto my computer hard drive are apparently unavailable. What does this mean?
I tried using MSYS Mingw-w64 but the same problem happens. I thought that I might not have included the "gcc-core" compiler file when I downloaded it, so i did that again with the file but nothing. I typed "gcc --version" and "gdb -- version" to check and debug but the same messages pop up, both for Cygwin and Mingw.
I tried using other text editors (notepad and vim) to type, but they didn't have any effect. I thought they might create compileable, "available" files on file explorer.

C - Not able to run a C program in any IDE (Tried with Netbeans and VSCode)

I installed MinGW compiler to run a C/C++ program. When I check the compiler version it shows this:
This is my MinGW directory:
This is my PATH setting:
I have set my PATH environment variable as follows:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\MinGW\bin;C:\MinGW\MSYS\1.0\bin;
Whenever I run my C/C++ project in Netbeans, it's giving me below error even though my program build is getting successful:
Please help me to fix this issue.

Eclipse - "Launching 'KeyInPlaintext' Debug has encountered a problem. Error starting process."

I am currently attempting to compile and run a C program in eclipse. The problem is, every time I attempt to run a program, the same error shows up.
The image shows the error that is displayed. I am not sure what to get out of that error.
I currently have cygwin installed, and am able to run gcc and g++ on the command prompt. I also have PE Windows Parser and Cygwin PE parser enabled under Binary Parsers. I have also cleaned and built the project many times over.

Eclipse gdb error while Stepping Over

I'm new to C and while debugging a simple file IO code snippet, the Eclipse debugger (using gdb) gave the following error:
Can't find a source file at "/build/buildd/eglibc-2.19/libio/iofgets.c"
Locate the file or edit the source lookup path to include its location.
THe line where the debugger crashes is
while (NULL!=fgets(line, SIZE, fp))
It looks like the debugger is looking for the source code for fgets in the folder build/buildd/.../libio/, but I'm not trying to step into this line, I'm stepping over it.
I'm using eclipse version 3.8 with Ubuntu 14.04 LTS

Debugging cross-compiled code: Linux->Windows

I'm cross-compiling a project from Linux to target Windows (using mingw). The output is a DLL and p-invoking into it from C# works, but debugging is very difficult. The build outputs a .o file, which can provide symbols to gdb, but basically all I can do there is break on exceptions and find the name of the function that was executing when the exception happened; not even the full stack trace. I can't debug with WinDbg because I don't have .pdb files.
This is an open source project set up to build on Linux; I believe their build process relies on several installed Linux packages to work.
Do I have any options here? Is there a utility that can convert .o files into .pdb? Or some program that can give me more information than gdb when debugging?
Try a IDE that support mingw. For example the open source Code::blocks.
Another possibility is to do it manually: compile it with debug symbols, start you application and attach the GDB debugger to it. It is also part of the MingW32 distribution. Then you can set your breakpoints and debug your application
But I guess using Code::Block is more comfortable
By the way, the GCC compiler does not generate pdb files because it is a propietary format
What xpol means is maybe: if you have a complete mingw installation then Code::blocks can use gdb to visualize a debugging session like it is done in Visual Studio or Eclipse. See chapter "Debugger" at http://www.codeblocks.org/features
You can generate a .pdb file using cv2pdb.exe from Visual D. This works even for programs not written in D if they were compiled with mingw. Once you've downloaded and installed Visual D cv2pdb.exe can be found at C:\Program Files (x86)\VisualD\cv2pdb\cv2pdb.exe.
You can run cv2pdb.exe against an executable like this:
cv2pdb.exe -n target.exe
This will produce a file called target.pdb. Assuming both target.pdb and target.exe are in the current director, you can then use windbg like this:
windbg -sflags 0x80030377 -y . -z target.dmp
In this case I'm also passing a minidump file as target.dmp. This can be omitted. The -sflags 0x80030377 option tells windbg to load target.pdb even though it thinks it doesn't match target.exe.
Note, that it can take windbg a very long time to load target.pdb. Just wait until it no longer says *BUSY* to the left of the command entry box.
Alternatively you can try DrMinGW.

Resources