MinGW + gdb, error 193



  • Hallo,

    ich versuche verzweifelt ein Programm unter gdb zu debuggen und habe folgendes Problem. Es geht nicht.

    Ich benutze MinGW, um simple Beispiel-Programme zu kompilieren, die WinAPI benutzen. So sieht mein Makefile aus:

    all:
            mingw32-gcc About1.c -o About1.exe -O0 -mwindows -Wall -Wextra -Wswitch-enum -pedantic -ggdb -DUNICODE
    

    Hier die Version des mingw32-gcc:

    C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About>mingw32-gcc --version
    mingw32-gcc (GCC) 3.4.5 (mingw special)
    Copyright (C) 2004 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    Kompilieren geht wunderbar. Nach dem Start von gdb allerdings folgendes:

    C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About>gdb About1.exe
    GNU gdb 6.7.50.20071127
    Copyright (C) 2007 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32"...
    (gdb) run
    Starting program: C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About/About1.exe
    Error creating process C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About/About1.exe, (error 193).
    (gdb) quit
    

    Error creating process.
    Ein wenig im Internet gesucht, anscheinend bedeutet error 193, dass etwas mit der exe-Datei nicht stimmt. Bloss was? Hat jemand einen Tip für mich?

    Interessant ist, dass diese About1.exe ohne Debugger normal ausgeführt werden kann... d.h. Windows hat anscheinend keine Probleme damit.

    Gruß,
    abc.w



  • erste idee:
    der minimalistische mingw hat einen eigenen gdb...
    http://www.mingw.org/MinGWiki/index.php/gdb

    nimmst du den oder den originalen?



  • Hallo,

    ich nehme den, der nach der Installation mit MinGW mit dabei ist. Ich nehme an, das ist der richtige...
    Was noch merkwürdig ist, wenn ich als admin die exe Datei in ein anderes Verzeichnis kopiere, z.B. c:\Programme, dann kann ich die exe debuggen. Ist das vielleicht irgendeine Sicherheitseinstellung am Windows, AntiVir oder Firewall oder was auch immer?

    Gruß,
    abc.w



  • An Leerzeichen im Verzeichnisnamen liegt es auch nicht. Habe wie folgt ausprobiert:

    About > gdb "f:\a b\a und b und c\About1.exe"
    GNU gdb 6.7.50.20071127
    Copyright (C) 2007 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32"...
    (gdb) run
    Starting program: f:\a b\a und b und c\About1.exe
    
    Program exited normally.
    (gdb)
    

    Vom gdb Quellcode werde ich auch nicht schlau. Dort wird wie gewohnt CreateProcess aufgerufen (Datei win32-nat.c, gdb 6.8) und der Rückgabewert geprüft:

    ret = CreateProcess (0,
    		       args,	/* command line */
    		       NULL,	/* Security */
    		       NULL,	/* thread */
    		       TRUE,	/* inherit handles */
    		       flags,	/* start flags */
    		       NULL,	/* environment */
    		       NULL,	/* current directory */
    		       &si,
    		       &pi);
    
    #ifdef __CYGWIN__
      if (tty >= 0)
        {
          close (tty);
          dup2 (ostdin, 0);
          dup2 (ostdout, 1);
          dup2 (ostderr, 2);
          close (ostdin);
          close (ostdout);
          close (ostderr);
        }
    #endif
    
      if (!ret)
        error (_("Error creating process %s, (error %d)."),
    	   exec_file, (unsigned) GetLastError ());
    

    Es wundert mich sehr, warum es nicht geht...



  • Und so geht es:

    C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About>subst /D G:
    
    C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About>subst G: "c:\Dokumente und Einstellungen\abcw\Ei
    gene Dateien\WinProgramming\About"
    
    C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About>gdb G:\About1.exe
    GNU gdb 6.7.50.20071127
    Copyright (C) 2007 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32"...
    (gdb) run
    Starting program: G:\About1.exe
    
    Program exited normally.
    (gdb) quit
    
    C:\Dokumente und Einstellungen\abcw\Eigene Dateien\WinProgramming\About>
    

    Von hinten durch die Brust ins Auge...



  • Ich persönlich verwende für Kommandozeilenoperationen mit MinGW MSys - in einer Bash fühle ich mich einfach wohler als in der Windows-Kommandozeile 😉

    Da es sich anscheinend um ein Problem mit dem Ort des ausführbaren Programmes handelt, könntest Du den Versuch mit MSys mal machen.


Anmelden zum Antworten