[WayBack] Horace Dediu on Twitter: “Personal computing, the first 40 years.… “
–jeroen
Posted by jpluimers on 2018/06/01
Posted in History, Power User | Leave a Comment »
Posted by jpluimers on 2018/06/01
Reminder to self: when you get Unknown function at TMethodImplementationIntercept in a Delphi stack trace from the Exception.StackTrace property or FastMM memory report:
Via:
The Exception.StackTrace was introduced in Delphi 2009 that extended these [WayBack] Exception Members:
Self or the innermost InnerException)Some notes:
GetExceptionStackInfoProc: function (P: PExceptionRecord): Pointer;
CleanUpStackInfoProc: procedure (Info: Pointer);
GetStackInfoStringProc: function (Info: Pointer): string;
TMethodImplementationIntercept was introduced in the System.Rtti unit of Delphi XE6 [WayBack]:
–jeroen
Example code:
| unit ExceptionHelperUnit; | |
| interface | |
| uses | |
| System.SysUtils; | |
| type | |
| ExceptionHelper = class helper for Exception | |
| public | |
| function Describe: string; | |
| class procedure RaiseNotImplementedException(const aClass: TClass; const aMethodName: string); | |
| class function GetStackTrace: string; | |
| end; | |
| implementation | |
| uses | |
| System.RTLConsts, | |
| System.SysConst; | |
| type | |
| EStackTraceException = class(Exception); // EProgrammerNotFound to make it really clear this is only to be used in very limited places ?? | |
| { ExceptionHelper } | |
| function ExceptionHelper.Describe: string; | |
| var | |
| lStackTrace: string; | |
| begin | |
| Result := inherited ToString(); | |
| if Self is EInOutError then | |
| if Result = System.RTLConsts.SInvalidFileName then | |
| Result := System.SysConst.SInvalidFileName; | |
| if Assigned(StackInfo) then | |
| lStackTrace := StackTrace | |
| else | |
| lStackTrace := 'empty'; | |
| Result := Format('Exception'#13#10'%s at $%p: %s'#13#10'with StackTrace'#13#10'%s', [ClassName, ExceptAddr, Result, lStackTrace]); | |
| end; | |
| class function ExceptionHelper.GetStackTrace: string; | |
| begin | |
| try | |
| Result := 'Get StackTrace via Exception.'; | |
| raise EStackTraceException.Create(Result) at ReturnAddress; | |
| except | |
| on E: EStackTraceException do | |
| Result := E.StackTrace; | |
| end; | |
| end; | |
| class procedure ExceptionHelper.RaiseNotImplementedException(const aClass: TClass; const aMethodName: string); | |
| begin | |
| raise ENotImplemented.CreateFmt('Method %s.%s is not implemented.', [aClass.ClassName, aMethodName]); | |
| end; | |
| end. |
Posted in Delphi, Development, FastMM, Software Development | Leave a Comment »
Posted by jpluimers on 2018/06/01
I had to find strings containing ” of object”, but not starting with a “)”, so the regex became this:
[^)] of object
Source: [WayBack] Regex – Does not contain certain Characters – Stack Overflow
–jeroen
Posted in Development, RegEx, Software Development | Leave a Comment »