win10 gdb not in executable format: File format not recognized

Viewed 1943

I'm a C newbie who recently installed gcc and gdb on windows 10 through MinGW. However, when I tried to debug my program using gdb through win10 cmd I got an error.

Here's what I did on cmd:

gcc ./test.c
gdb ./a.exe

And I got this:

not in executable format: File format not recognized

Then I tried to install gdb on bash as well and did the following:

gcc ./test.c
gdb ./a.out

(gcc through bash would create a.out but would create a.exe through cmd)

This time gdb seems to be able to start the executable file correctly, however when I tried typing in break commands I got another error message:

No symbol table is loaded. Use the "file" command.

Can anyone help to solve the problem? PS. I've tried using file but it didn't work either. PSS.after using gcc -g ./test.c the gdb seems to be working correctly on bash. However the windows one still can't run .exe file.

0 Answers
Related