News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Crash @ Compile Current File

Started by Ceniza, July 15, 2005, 11:56:41 PM

Previous topic - Next topic

Ceniza

Well, I just got it to test it and... lovely, lovely crash.

Program received signal SIGSEGV, Segmentation fault.
0x01e6cc2e in CompilerGCC::AddOutputLine (this=0x1d158b8, output=@0x22fa70,
   forceErrorColor=false) at plugins/compilergcc/compilergcc.cpp:1849
1849            CompilerLineType clt = compiler->CheckForWarningsAndErrors(output);

(gdb) bt
#0  0x01e6cc2e in CompilerGCC::AddOutputLine (this=0x1d06390,
   output=@0x22f9f8, forceErrorColor=false)
   at plugins/compilergcc/compilergcc.cpp:1849
#1  0x01e6c876 in CompilerGCC::OnGCCError (this=0x1d06390, event=@0x22bc018)
   at plugins/compilergcc/compilergcc.cpp:1829
#2  0x100a8ff8 in wxEvtHandler::ProcessEventIfMatches ()
  from E:\WINDOWS\system32\wxmsw26_gcc_custom.dll

:cry:

[edit]
Ok, got something more that could maybe help:

(gdb) p clt
$1 = 2090035912
(gdb) p compiler
$2 = (class Compiler *) 0x2180738
(gdb) p output
$3 = (const wxString &) @0x22f9f8: {<wxStringBase> = {
   static npos = 4294967295,
   m_pchData = 0x22a3ec4 "mingw32-g++.exe: E:\\Documents: No such file or directory"}, <No data fields>}

That problem is because the compiler couldn't find the file 'cause its path has spaces.

Just tried with another file in the root of a drive and... crash!

(gdb) p output
$4 = (const wxString &) @0x22f9f8: {<wxStringBase> = {
   static npos = 4294967295,
   m_pchData = 0x22c2dec "D:\\port.o(.text+0x3a):port.c: undefined reference to `outportb'"}, <No data fields>}

So it's more like the plugin isn't handling the errors correctly and crashing because of them.

Changed the code of the program so it wouldn't have compile/link problems (just noticed it was an old DOS program) and it worked!
[/edit]

tiwag

shall i make a project for you ? **GRIN**

rickg22

wait, this is serious. Ceniza, can you post this at SF along with the file, so that we can reproduce it?

Ceniza

The file doesn't matter, as far as it have some compiler/linker problem or it be in a path with spaces.

You sure you want me to add
#include <dos.h>

int main()
{
 outportb(0x378, 1);
 return 0;
}


to SF?

It should say that dos.h doesn't exist and couldn't find outportb when linking.

tiwag

Quote from: CenizaThe file doesn't matter, as far as it have some compiler/linker problem or it be in a path with spaces.

You sure you want me to add
#include <dos.h>

int main()
{
 outportb(0x378, 1);
 return 0;
}


to SF?

It should say that dos.h doesn't exist and couldn't find outportb when linking.

Your sample compiles fine with my old TurboC 2.01 dos-compiler  :)

Ceniza

Ok, for your consideration, quick fix which seems to be working:

plugins/compilergcc/compilergcc.cpp line 152 from:
   : m_CompilerIdx(-1),

to:
   : m_CompilerIdx(0),


I finally found the problem in there is the index never got updated so it tried to access an array at position -1.

Now, about the paths with spaces, I made this workaround (you're the ones who really know the code so it could be done somewhere else in a nicer way):

plugins/compilergcc/directcommands.cpp starting on line 269 from:
   wxString o_filename = fname.GetFullPath();
   fname.SetExt(EXECUTABLE_EXT);
   wxString exe_filename = fname.GetFullPath();

   MakefileGenerator mg(m_pCompilerPlugin, 0, "", 0); // don't worry! we just need a couple of utility funcs from it

   wxString compilerCmd = mg.CreateSingleFileCompileCmd(ctCompileObjectCmd,
                                                        0,
                                                        0,
                                                        filename,
                                                        o_filename,
                                                        wxEmptyString);

to:
   wxString o_filename = '"' + fname.GetFullPath() + '"';
   fname.SetExt(EXECUTABLE_EXT);
   wxString exe_filename = '"' + fname.GetFullPath() + '"';
   wxString i_filename = '"' + filename + '"';

   MakefileGenerator mg(m_pCompilerPlugin, 0, "", 0); // don't worry! we just need a couple of utility funcs from it

   wxString compilerCmd = mg.CreateSingleFileCompileCmd(ctCompileObjectCmd,
                                                        0,
                                                        0,
                                                        i_filename,
                                                        o_filename,
                                                        wxEmptyString);


plugins/compilergcc/makefilegenerator.cpp starting on line 218 from:
    wxFileName fname(object);

to:
    wxString object_unquoted(object);
    if (!object_unquoted.IsEmpty() && object_unquoted[0] == '"')
    {
    object_unquoted.Replace("\"", "");
    }
    wxFileName fname(object_unquoted);


I hope it be of any use.

mandrav

Fixed in CVS. Thanks ceniza for pointing it out :)

Yiannis.
Be patient!
This bug will be fixed soon...