View Issue Details

IDProjectCategoryView StatusLast Update
0036173FPCPackagespublic2019-10-19 14:15
ReporterIoulianos Kakoulidis Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.0.4 
Summary0036173: PTCGRAPH InitGraph call generates exception in Debug mode
DescriptionFollowing code generates exception on InitGraph call in Debug mode. See - except.JPG in attachment.
After pressing "Break" button - see break_assm.JPG
After pressing "Continue" button program generates expected output and terminates with error - see continue_heaptrc.JPG
Release mode works as expected.
Same behavoir on Wondows 8 64 bit FPC 3.0.4 / Lazarus 2.0.0.

program tgraph;
{$mode tp}

uses
  PTCGRAPH,
  PTCCRT;

var
  grmode, grdriver: smallint;
  x, y: integer;
  ch: Char;
begin
  grdriver := DETECT;
  PTCGRAPH.InitGraph(grdriver, grmode, '');
  PTCGRAPH.SetColor(white);
  ch := PTCCRT.ReadKey;
  PTCGRAPH.Line(0, 00, getmaxx, getmaxy);
  ch := PTCCRT.ReadKey;
end.

Additional InformationFPC - 3.0.4
Lazarus - 2.0.0
OS - Windows Vista 32bit SP1
CPU - Intel Pentium Dual E2200
GPU - GPU - Intel Q33 Express
RAM - 3GB

TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Ioulianos Kakoulidis

2019-10-13 12:14

reporter  

tgraph.lpr (333 bytes)   
program tgraph;
{$mode tp}

uses
  PTCGRAPH,
  PTCCRT;

var
  grmode, grdriver: smallint;
  x, y: integer;
  ch: Char;
begin
  grdriver := DETECT;
  PTCGRAPH.InitGraph(grdriver, grmode, '');
  PTCGRAPH.SetColor(white);
  ch := PTCCRT.ReadKey;
  PTCGRAPH.Line(0, 00, getmaxx, getmaxy);
  ch := PTCCRT.ReadKey;
end.
tgraph.lpr (333 bytes)   
break_assm.JPG (143,588 bytes)   
break_assm.JPG (143,588 bytes)   
continue_heaptrc.JPG (33,588 bytes)   
continue_heaptrc.JPG (33,588 bytes)   
except.JPG (24,256 bytes)   
except.JPG (24,256 bytes)   
tgraph.lpi (4,042 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
  <ProjectOptions>
    <Version Value="11"/>
    <PathDelim Value="\"/>
    <General>
      <Flags>
        <MainUnitHasCreateFormStatements Value="False"/>
        <MainUnitHasTitleStatement Value="False"/>
        <MainUnitHasScaledStatement Value="False"/>
      </Flags>
      <SessionStorage Value="InProjectDir"/>
      <MainUnit Value="0"/>
      <Title Value="tgraph"/>
      <UseAppBundle Value="False"/>
      <ResourceType Value="res"/>
    </General>
    <BuildModes Count="3">
      <Item1 Name="Default" Default="True"/>
      <Item2 Name="Debug">
        <CompilerOptions>
          <Version Value="11"/>
          <PathDelim Value="\"/>
          <Target>
            <Filename Value="tgraph"/>
          </Target>
          <SearchPaths>
            <IncludeFiles Value="$(ProjOutDir)"/>
            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
          </SearchPaths>
          <Parsing>
            <SyntaxOptions>
              <IncludeAssertionCode Value="True"/>
            </SyntaxOptions>
          </Parsing>
          <CodeGeneration>
            <Checks>
              <IOChecks Value="True"/>
              <RangeChecks Value="True"/>
              <OverflowChecks Value="True"/>
              <StackChecks Value="True"/>
            </Checks>
            <VerifyObjMethodCallValidity Value="True"/>
          </CodeGeneration>
          <Linking>
            <Debugging>
              <DebugInfoType Value="dsDwarf2Set"/>
              <UseHeaptrc Value="True"/>
              <TrashVariables Value="True"/>
              <UseExternalDbgSyms Value="True"/>
            </Debugging>
            <Options>
              <Win32>
                <GraphicApplication Value="True"/>
              </Win32>
            </Options>
          </Linking>
        </CompilerOptions>
      </Item2>
      <Item3 Name="Release">
        <CompilerOptions>
          <Version Value="11"/>
          <PathDelim Value="\"/>
          <Target>
            <Filename Value="tgraph"/>
          </Target>
          <SearchPaths>
            <IncludeFiles Value="$(ProjOutDir)"/>
            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
          </SearchPaths>
          <CodeGeneration>
            <SmartLinkUnit Value="True"/>
            <Optimizations>
              <OptimizationLevel Value="3"/>
            </Optimizations>
          </CodeGeneration>
          <Linking>
            <Debugging>
              <GenerateDebugInfo Value="False"/>
            </Debugging>
            <LinkSmart Value="True"/>
            <Options>
              <Win32>
                <GraphicApplication Value="True"/>
              </Win32>
            </Options>
          </Linking>
        </CompilerOptions>
      </Item3>
    </BuildModes>
    <PublishOptions>
      <Version Value="2"/>
      <UseFileFilters Value="True"/>
    </PublishOptions>
    <RunParams>
      <FormatVersion Value="2"/>
      <Modes Count="0"/>
    </RunParams>
    <Units Count="1">
      <Unit0>
        <Filename Value="tgraph.lpr"/>
        <IsPartOfProject Value="True"/>
      </Unit0>
    </Units>
  </ProjectOptions>
  <CompilerOptions>
    <Version Value="11"/>
    <PathDelim Value="\"/>
    <Target>
      <Filename Value="tgraph"/>
    </Target>
    <SearchPaths>
      <IncludeFiles Value="$(ProjOutDir)"/>
      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    </SearchPaths>
    <Linking>
      <Options>
        <Win32>
          <GraphicApplication Value="True"/>
        </Win32>
      </Options>
    </Linking>
  </CompilerOptions>
  <Debugging>
    <Exceptions Count="3">
      <Item1>
        <Name Value="EAbort"/>
      </Item1>
      <Item2>
        <Name Value="ECodetoolError"/>
      </Item2>
      <Item3>
        <Name Value="EFOpenError"/>
      </Item3>
    </Exceptions>
  </Debugging>
</CONFIG>
tgraph.lpi (4,042 bytes)   

Ioulianos Kakoulidis

2019-10-15 09:23

reporter   ~0118614

Exception occurs here - file fpc\3.0.4\source\packages\ptc\src\win32\directx\win32directxconsolei.inc
procedure TDirectXConsole.internal_recycle(const _title: string; window: HWND; const mode: IPTCMode; _pages: Integer; exact: Boolean);
begin
  { Check if the console is open }
  if not FOpen then
    raise TPTCError.Create('cannot recycle because it is not already open');
...

Ioulianos Kakoulidis

2019-10-17 09:13

reporter   ~0118638

Backtrace -

#0 fpc_raiseexception at :0
0000001 PTC$_$TDIRECTXCONSOLE_$__$$_INTERNAL_RECYCLE$ANSISTRING$QWORD$IPTCMODE$LONGINT$BOOLEAN at :0
0000002 PTC$_$TDIRECTXCONSOLE_$__$$_INTERNAL_OPEN$ANSISTRING$QWORD$IPTCMODE$LONGINT$BOOLEAN at :0
0000003 PTC$_$TDIRECTXCONSOLE_$__$$_OPEN$ANSISTRING$LONGINT$LONGINT$IPTCFORMAT$LONGINT at :0
0000004 _$PTC$_Lj22270 at :0
0000005 ?? at :0
0000006 ?? at :0

Ioulianos Kakoulidis

2019-10-19 13:32

reporter   ~0118688

Maybe-this is normal behavior. If Yes - please delete issue.

Thaddy de Koning

2019-10-19 14:01

reporter   ~0118689

Last edited: 2019-10-19 14:03

View 2 revisions

You should study the examples in the PTC package directory: there are many.
At least on Debian-armhf all examples work. There must be something wrong with your code.

That goes for debug mode too: no difference.

Ioulianos Kakoulidis

2019-10-19 14:15

reporter   ~0118691

No problem. Delete issue.

Issue History

Date Modified Username Field Change
2019-10-13 12:14 Ioulianos Kakoulidis New Issue
2019-10-13 12:14 Ioulianos Kakoulidis File Added: tgraph.lpr
2019-10-13 12:14 Ioulianos Kakoulidis File Added: break_assm.JPG
2019-10-13 12:14 Ioulianos Kakoulidis File Added: continue_heaptrc.JPG
2019-10-13 12:14 Ioulianos Kakoulidis File Added: except.JPG
2019-10-13 12:14 Ioulianos Kakoulidis File Added: tgraph.lpi
2019-10-15 09:23 Ioulianos Kakoulidis Note Added: 0118614
2019-10-17 09:13 Ioulianos Kakoulidis Note Added: 0118638
2019-10-19 13:32 Ioulianos Kakoulidis Note Added: 0118688
2019-10-19 14:01 Thaddy de Koning Note Added: 0118689
2019-10-19 14:03 Thaddy de Koning Note Edited: 0118689 View Revisions
2019-10-19 14:15 Ioulianos Kakoulidis Note Added: 0118691