Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-03

Spurious SIGSEGV on ARMHF with application compiled with fpc trunk

3 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

fpc trunk r26906, cross compiled fpcup for ARMHF; running on Odroid U3 Xubuntu; ran under gdb:
fpcup stops with a SIGSEGV:
...
fpcup: info: Created launcher script for
FPC:/home/odroid/development/fpctrunk/bin/arm-linux/fpc.sh Executing : /home/odroid/development/fpctrunk/compiler/ppc1 "-iV" (working dir: )
2.7.1
Executing : /home/odroid/development/fpctrunk/bin/arm-linux/fpcmkcfg "-h" (working dir: )

Program received signal SIGSEGV, Segmentation fault. 0x00029998 in SYSTEM_$$_PUSHEXCEPTOBJECT$TOBJECT$POINTER$POINTER () (gdb) bt
#0 0x00029998 in SYSTEM_$$_PUSHEXCEPTOBJECT$TOBJECT$POINTER$POINTER () #1 0x00083800 in EXECUTECOMMANDINDIR (
COMMANDLINE=0xb6e6e00c
"/home/odroid/development/fpctrunk/bin/arm-linux/fpcmkcfg -h", DIRECTORY=0x0, OUTPUT=0x0, VERBOSE=true) at processutils.pas:445 #2 0x000836a8 in EXECUTECOMMAND (
COMMANDLINE=0xb6e6e00c
"/home/odroid/development/fpctrunk/bin/arm-linux/fpcmkcfg -h", OUTPUT=0x0, VERBOSE=true) at processutils.pas:431
#3 0x000b92ac in TINSTALLER__CHECKEXECUTABLE (
EXECUTABLE=0xb6e6f22c
"/home/odroid/development/fpctrunk/bin/arm-linux/fpcmkcfg", PARAMETERS=0x160480 "-h", EXPECTOUTPUT=0x16091c "fpcmkcfg", this=<error reading variable>) at installercore.pas:457 #4 0x000c1428 in TFPCINSTALLER__BUILDMODULE (MODULENAME=0xb6fc84ac "FPC", this=<error reading variable>) at installerfpc.pas:1198 #5 0x000d1a54 in TSEQUENCER__DOBUILDMODULE (MODULENAME=0xb6fc84ac "FPC", this=<error reading variable>) at installermanager.pas:624 #6 0x000d4e50 in TSEQUENCER__RUN (SEQUENCENAME=0xb6fccf4c "FPCBuildOnly", this=<error reading variable>) at installermanager.pas:1224 #7 0x000d4ccc in TSEQUENCER__RUN (SEQUENCENAME=0x1662e4 "Only", this=<error reading variable>) at installermanager.pas:1214 #8 0x000d12fc in TFPCUPMANAGER__RUN (this=<error reading variable>) at installermanager.pas:536
#9 0x0000dc24 in main () at fpcup.lpr:802

The executable processutils is trying to execute does not exist. This is not a problem on e.g. Windows/x64 Linux.

What I don't understand: the last line of fpcup output above seems to indicate the code has actually reached the execution part in my code, TProcessEx.Execute.
The TProcessEx.ExecuteCommandInDir call in #1 calls overloaded versions of ExecuteCommandIndir until they end up calling TProcessEx.Execute. Why doesn't that show up in the backtrace?

What does this line mean:
#0 0x00029998 in SYSTEM_$$_PUSHEXCEPTOBJECT$TOBJECT$POINTER$POINTER () ... part of the FPC exception handling code perhaps?

I'm now going to go back to a revision of end January (where I had a working fpcup) to see if that fixes things.

Suggestions/tips welcome.

Thanks,
Reinier

More details:
fpcup revision 416db02e900c
Source:
https://bitbucket.org/reiniero/fpcup/src/?at=processutils_bug_on_armhf

Reinier Olislagers
to Reinier Olislagers
Reinier Olislagers wrote
fpc trunk r26906, cross compiled fpcup for ARMHF; running on Odroid U3 Xubuntu; ran under gdb: fpcup stops with a SIGSEGV:

<snip>

Went back to fpc revision 26550 (end of January), rebuilt cross compiler, rebuilt fpcup.

Ran fpcup with fpc revision set once again to 26550, Lazarus revision to 43823.

This time, fpcup completed without error.

My guess is that the compiler messes up exception handling... on my to do list is running fpc trunk compiled fpcup under the debugger to see what exactly goes wrong...

Thanks,
Reinier

More details:
Both times compiled with (cross)compile options:
-dFPC_ARMHF -CpARMV6 -CaEABIHF -CfVFPV2
fpcup project settings:
- release build
no optimization
-Xs

- debug build
no optimization
-g
-gl
-Ci
-Cr
-Co
-Ct

Reinier Olislagers
to Reinier Olislagers: fpc trunk r26906, cross compiled fpcup for ARMHF; running on Odroid U3 Xubuntu; ran under…
Reinier Olislagers wrote
fpc trunk r26906, cross compiled fpcup for ARMHF; running on Odroid U3 Xubuntu; ran under gdb: fpcup stops with a SIGSEGV:

Had tried to build a simple program to repeat the problem, compiled with r26906 and ran it. Of course :( it didn't throw a SIGSEGV...

program nonexistingfile;
{$mode objfpc}{$H+}
uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes, SysUtils, process;
var
  AProcess: TProcess;
begin
  AProcess:=TProcess.Create(nil);
  try
    try
      AProcess.Executable:='/tmp/filemustnotexist';
      AProcess.Execute;
      if AProcess.ExitCode=0 then
        writeln('Process exitcode 0')
      else
        writeln('Failure. Non-zero process exitcode');
      writeln('Process done, leaving try...except');
    except
      on E: Exception do
        writeln('exception: '+E.Message);
    end;
  finally
    AProcess.Free;
  end;
  writeln('Program finished');
end.