The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for the ‘TD32/TDS Symbol information’ Category

Drawbacks for separating TDS/TD32 symbol information in separate file for your Delphi applications? What about Visual Studio?

Posted by jpluimers on 2020/01/15

A while ago this interesting question came by: [WayBack] Delphi XE2 has got the Linking option “Place debug information in separate TDS file” … Does this have any adverse effects for Win32 Delphi executables? – Thomas Mueller (dummzeuch) – Google+

The answer is “no”.

By about mid 2018, the same holds for Visual Studio and PDB symbol information.

Delphi

Since long ago (I think about Delphi 2), the Delphi debugger understands TDS (historically also known as TD32) Turbo Debugger Symbol Information which can be either in the .EXE or in a separate .TDS file with the same name and directory as the .EXE.

Many other tools also know how to get the symbols from either place, see for instance TD32-TDS-SYMBOL-INFORMATION.

The advantage of keeping it in the EXE is that it is easier to ship to clients. Unless you do not want the clients to have it. Then it is easier to separate it in a file.

David Heffernan raises an important point though, as many people confuse these two topics:

  • the presence of Debug Symbols
  • the code generation of extra run-time checks and debug-assistance (like stack frames)

This is caused by both of the above usually being enabled in DEBUG mode and disabled in RELEASE mode.

However, nothing prevents you from generating the Debug Symbols in RELEASE mode, and they can highly help track down customer problems.

This is David’s comment:

There’s a common myth that “debug builds” perform worse than “release builds”.

Whether or not debug information is generated is completely independent from the performance of the code.

Visual Studio

For a long time, EXE files generated by Microsoft Tools could only include .DBG symbol information, but no .PDB symbol information.

[WayBack] executable – Embed .pdb debug symbol information into an .exe file in Visual Studio – Stack Overflow. Especially read the comments about:

–jeroen

Posted in Debugging, Delphi, Development, MAP Symbol Information, Software Development, TD32/TDS Symbol information | Leave a Comment »

Delphi call stack from exception…

Posted by jpluimers on 2017/08/02

Lars Fosdal:

MADExcept and Eurekalog are good products (and there is a JVCL tool as well). If you run your app in the IDE, you get the stack there – but for now, you need to acquire a third party package to get it runtime.I don’t disagree with the wish for a basic call stack tool, that works cross platform, but it would affect third party developers.

Stefan Glienke:

Whats the problem? You attach handlers to Exception.GetExceptionStackInfoProc, GetStackInfoStringProc and ` and just call a function that grabs the map or td32 info and generates the callstack – if you don’t want to spend any money for a high quality tool like madExcept (can even use it for free for non commercial use!) then use JclDebug.pas

I edited in some URLs above; the actual info is from: Why Delphi (like other developer environments) natively not included full call stack for every exception… [WayBack] (which is because it would kill even more of the Delphi 3rd party market).

And it taught me about this by madshi (of MADExcept fame):

DebugEngine is a collection of utils related to debug stuff (stack trace, CPU registers snaphot, debug info,…). Basically, I started to write a commercial error log plugin for Delphi, then I noticed that my internal framework got bigger and bigger. So I decided to share it with the community in hope it will be useful.

Source: MahdiSafsafi/DebugEngine: Delphi debug framework

And there is the JCL ExceptDlg.pas which is quite easy to use: just add it anywhere to your project and the global exception handler will show you a stack trace provided you have a .MAP file or .TDS file (which contains TD32 symbol information) in the same directory as your .EXE.

–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 Debugging, Delphi, Development, MAP Symbol Information, Software Development, TD32/TDS Symbol information | 6 Comments »

Delphi – unmangle names in BPL’s – Stack Overflow

Posted by jpluimers on 2016/10/12

Check out $(BDS)\source\cpprtl\Source\misc\unmangle.c – it contains the source code for the unmangling mechanism used by TDUMP, the debugger and the linker. (C++Builder and Delphi use the same mangling scheme.)

This has been around as long as BCC itself. However the file was called um.c instead of unmangle.c in older versions

Source: [WayBackDelphi – unmangle names in BPL’s – Stack Overflow both by User Moritz Beutel.

It’s the same mangling used in the TD32/TDS and MAP symbols.

And neede to improve https://github.com/jpluimers/map2dbg (which is my fork of https://github.com/andremussche/map2dbg) which contrary to it’s name also supports TDS/TD32 conversions in tds2pdb. The code is C# and works in virtually any Visual Studio version of 2012 and younger.

–jeroen

 

Posted in Debugging, Delphi, Development, MAP Symbol Information, Software Development, TD32/TDS Symbol information | Leave a Comment »

SmartBear AQTime links

Posted by jpluimers on 2016/06/02

Since they’re hard to find on-line, and sometimes I need them when not having access to my collective browser or email history:

Notes:

  1. The AQTimeDemo.exe is the same as the latest AQTime###.exe (functionality depends in license).
  2. The installation from Windows Explorer sometimes fails with the below message. Installation from the command-prompt works, but you need to run it from an Administrator command-prompt:

---------------------------
E:\TEMP\AQtime824.exe
---------------------------
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
---------------------------
OK
---------------------------

To get going for my special case, I watched some sample videos (which I did get to work in Internet Explorer but not in Chrome forty-something):

I needed it to do some profiling comparisons of services running under different configurations.

Read the rest of this entry »

Posted in .NET, Debugging, Delphi, Development, MAP Symbol Information, Profiling-Performance-Measurement, Software Development, TD32/TDS Symbol information, Visual Studio and tools | Leave a Comment »