{
    This file is part of the chelinfo library.

    Copyright (c) 2008 by Anton Rzheshevski

    Dwarf LineInfo Extractor

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
{
    2008, Anton Rzheshevski aka Cheb:
    Like dr. Frankenshtein I sewn this library together
    from the dead meat of the the FPC RTL modules
    lineinfo.pp and lnfodwrf.pp.
    These (as of Jan. 2008 / FPC 2.2.0) both didn't work
    and had several limitations (e.g. inability to be used
    from a DLL)

    }
    
{note: DON'T FORGET to compile your program with the -gw key
  Lazarus: you must type it in
    Project -> Compiler Options -> Other -> User parameters
}

{$mode delphi}
{$longstrings on}
{$ifndef unix}
  {$apptype console}
{$endif}

{$ifndef cpu32}
  {$fatal 64 bit formats not supported}
{$endif}

//extracts the line info in the dwarf format from the executable
// (Linux only)


program finalizedwrflnfo;

uses
  SysUtils, Classes, chelinfo, zstream;
  
var
  _dwarf: pointer;
  DwarfSize: Sizeint;
  f: TFileStream;
  CS: TCompressionStream;
  dllname, iname: ansistring;
  ibase: cardinal;
begin

  dllname:= ParamStr(1);
  
  WriteLn('Finalizing Dwarf line info for ', dllname);
  try
    FinalizeExtractedDwarfLineInfo(dllname);
  except
    WriteLn((ExceptObject as Exception).Message);
  end;


end.

