Recent

Author Topic: Recompiling RTL in 2.5.1 64 bit  (Read 16692 times)

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Recompiling RTL in 2.5.1 64 bit
« on: February 18, 2010, 07:07:43 pm »
How do I recompile RTL? Is there a standard set of the folders that I need to include in a particular order?
I am getting a bunch of errors (wrong arguments, etc) when I am compiling

I am trying to figure out what is causing a safecall method to produce an access violation when compiled in 64 bit (http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=15768 ).


Thanks!
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #1 on: February 18, 2010, 11:55:13 pm »
on a command shell, in the fpc source dir, run
Code: [Select]
make all (if you have a 64bit starting compiler)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #2 on: February 19, 2010, 12:01:14 am »
But that will rebuild the compiler, right?
What I am trying to do is to compile the system units with the debug info so that I can see the source location and the call stack when a get an access violation when processing an OLE exception in a safecall method.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #3 on: February 19, 2010, 12:40:05 am »
What I am trying to do is to compile the system units with the debug info so that I can see the source location and the call stack when a get an access violation when processing an OLE exception in a safecall method.

Call me stupid  but, why you need to recompile the RTL to find an access violation in your program?
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #4 on: February 19, 2010, 12:44:33 am »
Because the safecall calling convention is broken in the x64 compiler and the access violation is raised by the code in one of the system units.
See http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=15768 
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #5 on: February 19, 2010, 01:44:08 am »
ahh... in that case, if your compiler and rtl are uptodate, run in the rtl dir:
Code: [Select]
make OPT=-gand add the rtl\units\x86_64-win64 dir to your fpc.cfg
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #6 on: February 19, 2010, 08:28:56 am »
Thanks, now I can build RTL.
But the debugger does not work anymore: Cannot insert breakpoint; error accessing memory address.

Are there any tricks that I need to know about when debugging under Window 7 64 bit?

Thank you!
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2582
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #7 on: February 19, 2010, 10:44:42 am »
what is the output on the debugger output window ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #8 on: February 19, 2010, 11:15:48 am »
Thanks, now I can build RTL.
But the debugger does not work anymore: Cannot insert breakpoint; error accessing memory address.

Are there any tricks that I need to know about when debugging under Window 7 64 bit?

Download the gdb mentioned here: http://bugs.freepascal.org/view.php?id=15587

And use the -WB compiler option mentioned here: http://bugs.freepascal.org/view.php?id=15692

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #9 on: February 19, 2010, 12:12:17 pm »
Because the safecall calling convention is broken in the x64 compiler and the access violation is raised by the code in one of the system units.
See http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=15768 
Oh! Thanks, I didn't know. :-[
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #10 on: February 21, 2010, 06:53:42 am »
Thanks! Looks like I can debug RTL just fine now!
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #11 on: February 24, 2010, 07:38:40 am »
Looks like fpc_DestroyException in except.inc raises an exception when safecall convention is used.
It looks like it is trying to free a bogus exception object.
This only happens in 64 bit if the safecall calling convention is used.

I don't think I understand what is going on. Can somebody more familiar with the compiler and RTL take a look at this?
The sample project at  http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=15768  produces the access violation 100% of the time.

Thanks!
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

dmitry

  • New Member
  • *
  • Posts: 32
    • Outlook Developer Tools
Re: Recompiling RTL in 2.5.1 64 bit
« Reply #12 on: February 24, 2010, 07:51:56 am »
I posted a $300 bounty for fixing the bug:
http://wiki.freepascal.org/Bounties#bug_15768
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

 

TinyPortal © 2005-2018