good.but not support delphi7's map

Issue #7 resolved
William C ramos created an issue

a greak tools!but not support delphi7's map

Comments (17)

  1. Anders@Melander

    Zip and attach a Delphi 7 map file and I will look into it - or you could just modify debug.map.reader.pas yourself so it can handle your map file.

  2. William C ramos reporter

    OK.map2dbg can “support“ Delphi7’s map,but is limite(like not include source code line),and must use cv2pdb conver the dbg to pdb,your tools is greak!

  3. Anders@Melander

    Thanks.

    I can see that this is a duplicate of issue #1 but I will see if I can do something about it regardless.

  4. Anders Melander repo owner

    Enabled fix for #7 which was accidentally disabled in previous commit.

    Improved logging when handling legacy map files. Calculated offset of overlapping segment are now aligned to $1000 just to make the offset "look better". Fixes #7

    → <<cset c2617faeedd1>>

  5. William C ramos reporter

    My english is poor:)It works now, thank you very much. Also ask two small questions. 1. After adding it to the IDE toolbar, it always prompts "Fatal: Cannot open file "x:\xxxxxxxxxxx\Client\$EXENAME" when executing. The system cannot find the specified file.
    Error: EAbort: Operation aborted
    Done - Press enter to continue
    ", but the pdb file is successfully generated. This problem will not occur under Delphi12, but will occur under Delphi7. 2. If the path contains a UNICODE string, the execution will fail: "Error: EEncodingError: No mapping for the Unicode character exists in the target multi-byte code page
    Done - Press enter to continue" This problem will not occur under Delphi12, but will occur under Delphi7. However, these two problems do not affect the specific use.

  6. Anders@Melander

    After adding it to the IDE toolbar, it always prompts "Fatal: Cannot open file "x:\xxxxxxxxxxx\Client\$EXENAME" when executing. The system cannot find the specified file.

    That sounds like your Tools action isn’t configured correctly since apparently it doesn’t substitute $EXENAME as it should. Either that or Delphi 7 simply doesn’t support the same macros. You will have to look it up in Delphi 7’s help.

    The parameters should look something like this: `-debug -v -pause -bind:$EXENAME $PATH($EXENAME)$NAMEONLY($EXENAME).map -include:0001`

    If the path contains a UNICODE string, the execution will fail: "Error: EEncodingError: No mapping for the Unicode character exists in the target multi-byte code page

    Done - Press enter to continue" This problem will not occur under Delphi12, but will occur under Delphi7.

    Probably same problem. Delphi 7 is pre-unicode so it might not support unicode command line parameters.

  7. William C ramos reporter

    i use it at Delphi 12,and add “-debug -v”,it Show:

    map2pdb - Copyright (c) 2021 Anders Melander
    Version 3.1.2

    Constructed a new PDB GUID: {568E0296-B1CC-4807-9EBF-537AC4FE2063}
    Output filename not specified. Defaulting to RemoteAppClient.pdb
    Reading MAP file

    • Segments
      Warning: [ 8] Empty segment: .pdata [0006:0000000000400000]
    • Modules
    • Symbols
      Warning: [ 1043] Failed to resolve symbol to module: [0005:0000000000000054] SysInit.TlsLast
      Warning: [ 1046] Failed to resolve symbol to module: [0004:00000000FFD9C000] SysInit.__ImageBase
    • Line numbers
      Warning: [34234] Line number with zero offset ignored. Module:System, Segment:0002, Source:System.pas, Line:43081
      Warning: [34604] Line number with zero offset ignored. Module:System.SysConst, Segment:0001, Source:System.SysConst.pas, Line:235
      Warning: [34624] Line number with zero offset ignored. Module:System.RTLConsts, Segment:0001, Source:System.RTLConsts.pas, Line:646
      Warning: [54124] Line number with zero offset ignored. Module:Vcl.Consts, Segment:0001, Source:Vcl.Consts.pas, Line:506
      Warning: [55976] Line number with zero offset ignored. Module:System.Win.ComConst, Segment:0001, Source:System.Win.ComConst.pas, Line:50
      Warning: [59819] Line number with zero offset ignored. Module:Vcl.ComStrs, Segment:0001, Source:Vcl.ComStrs.pas, Line:63
      Warning: [69341] Line number with zero offset ignored. Module:Vcl.OleConst, Segment:0001, Source:Vcl.OleConst.pas, Line:38
      Warning: [69889] Line number with zero offset ignored. Module:madRipeMD, Segment:0001, Source:madRipeMD.pas, Line:380
      Warning: [69893] Line number with zero offset ignored. Module:DVCClientInterface, Segment:0001, Source:DVCClientInterface.pas, Line:68
      Warning: [69897] Line number with zero offset ignored. Module:u_ChannelDefine, Segment:0001, Source:u_ChannelDefine.pas, Line:15
      Warning: [70199] Line number with zero offset ignored. Module:Unit_FrmPDFFileDownload, Segment:0001, Source:Unit_FrmPDFFileDownload.pas, Line:28
      Collected 274 modules, 14,961 symbols, 96,448 lines, 97 source files
      Debug: Module has source files but no source lines: System.SysConst
      Debug: Module has source files but no source lines: System.RTLConsts
      Debug: Module has no source files: System.Internal.ExcUtils
      Debug: Module has no source files: System.DateUtils
      Debug: Module has source files but no source lines: Vcl.Consts
      Debug: Module has no source files: System.AnsiStrings
      Debug: Module has source files but no source lines: System.Win.ComConst
      Debug: Module has source files but no source lines: Vcl.ComStrs
      Debug: Module has source files but no source lines: Vcl.OleConst
      Debug: Module has no source files: madTypes
      Debug: Module has no source files: madStrings
      Debug: Module has no source files: madTools
      Debug: Module has no source files: madDisAsm
      Debug: Module has no source files: madRemote
      Debug: Module has source files but no source lines: madRipeMD
      Debug: Module has no source files: madCodeHook
      Debug: Module has source files but no source lines: DVCClientInterface
      Debug: Module has source files but no source lines: u_ChannelDefine
      Debug: Module has source files but no source lines: Unit_FrmPDFFileDownload
      Debug: Module has no source files: RemoteAppClient
      Debug: Module has no source files: System.Generics.Defaults
      Debug: Module has no source files: System.Messaging
      Debug: Module has no source files: madTools
      Debug: Module has no source files: madRemote
      Debug: Module has no source files: madCodeHook
      Debug: Module has no source files: System
      Debug: Module has no source files: SysInit
      Debug: Module has no source files: System.Types
      Debug: Module has no source files: Winapi.Windows.PkgHelper
      Debug: Module has no source files: Winapi.Windows
      Debug: Module has no source files: System.Internal.ExcUtils
      Debug: Module has no source files: System.SysUtils
      Debug: Module has no source files: System.VarUtils
      Debug: Module has no source files: System.Variants
      Debug: Module has no source files: System.TypInfo
      Debug: Module has no source files: Winapi.ActiveX
      Debug: Module has no source files: System.Rtti
      Debug: Module has no source files: System.Classes
      Debug: Module has no source files: System.Generics.Defaults
      Debug: Module has no source files: Winapi.Wincodec
      Debug: Module has no source files: Winapi.ShellAPI
      Debug: Module has no source files: System.DateUtils
      Debug: Module has no source files: System.IOUtils
      Debug: Module has no source files: System.IniFiles
      Debug: Module has no source files: System.Win.Registry
      Debug: Module has no source files: System.UIConsts
      Debug: Module has no source files: Vcl.Graphics
      Debug: Module has no source files: Winapi.UxTheme
      Debug: Module has no source files: Winapi.MsCTF.PkgHelper
      Debug: Module has no source files: System.AnsiStrings
      Debug: Module has no source files: System.Win.ComObj
      Debug: Module has no source files: Winapi.MsCTF
      Debug: Module has no source files: Vcl.GraphUtil
      Debug: Module has no source files: Winapi.PenInputPanel
      Debug: Module has no source files: Vcl.Controls
      Debug: Module has no source files: Vcl.StdCtrls
      Debug: Module has no source files: Vcl.Printers
      Debug: Module has no source files: Vcl.ComCtrls
      Debug: Module has no source files: Vcl.Dialogs
      Debug: Module has no source files: Vcl.ExtCtrls
      Debug: Module has no source files: Vcl.Themes
      Debug: Module has no source files: Vcl.ImgList
      Debug: Module has no source files: Vcl.Menus
      Debug: Module has no source files: Vcl.Forms
      Debug: Module has no source files: Vcl.OleCtrls
      Debug: Module has no source files: MSTSCLib_TLB
      Debug: Module has no source files: madStrings
      Debug: Module has no source files: madTools
      Debug: Module has no source files: madDisAsm
      Debug: Module has no source files: madRemote
      Debug: Module has no source files: madCodeHook
      Debug: Module has no source files: u_ChannelDefine
      Debug: Module has no source files: System.Win.ComServ
      Debug: Module has no source files: DVCClientUnit
      Debug: Module has no source files: u_VirtualChannelUnit
      Debug: Module has no source files: u_IMEUntil
      Debug: Module has no source files: u_GostScriptUnit
      Debug: Module has no source files: System
      Debug: Module has no source files: SysInit
      Debug: Module has no source files: System.Types
      Debug: Module has no source files: System.UITypes
      Debug: Module has no source files: Winapi.Windows.PkgHelper
      Debug: Module has no source files: Winapi.PsAPI
      Debug: Module has no source files: System.Character
      Debug: Module has no source files: System.Internal.ExcUtils
      Debug: Module has no source files: System.SysUtils
      Debug: Module has no source files: System.VarUtils
      Debug: Module has no source files: System.Variants
      Debug: Module has no source files: System.TypInfo
      Debug: Module has no source files: System.Math
      Debug: Module has no source files: System.TimeSpan
      Debug: Module has no source files: System.Diagnostics
      Debug: Module has no source files: System.SyncObjs
      Debug: Module has no source files: System.Rtti
      Debug: Module has no source files: System.Classes
      Debug: Module has no source files: System.Generics.Defaults
      Debug: Module has no source files: System.Messaging
      Debug: Module has no source files: System.Actions
      Debug: Module has no source files: Winapi.CommCtrl
      Debug: Module has no source files: System.DateUtils
      Debug: Module has no source files: System.IOUtils
      Debug: Module has no source files: System.IniFiles
      Debug: Module has no source files: System.Win.Registry
      Debug: Module has no source files: System.UIConsts
      Debug: Module has no source files: Vcl.Graphics
      Debug: Module has no source files: Winapi.UxTheme
      Debug: Module has no source files: Vcl.ActnList
      Debug: Module has no source files: Winapi.MsCTF.PkgHelper
      Debug: Module has no source files: System.AnsiStrings
      Debug: Module has no source files: System.Win.ComObj
      Debug: Module has no source files: Vcl.GraphUtil
      Debug: Module has no source files: Vcl.Controls
      Debug: Module has no source files: Vcl.StdCtrls
      Debug: Module has no source files: Vcl.Clipbrd
      Debug: Module has no source files: Vcl.Printers
      Debug: Module has no source files: Vcl.ComCtrls
      Debug: Module has no source files: System.HelpIntfs
      Debug: Module has no source files: Vcl.Dialogs
      Debug: Module has no source files: Vcl.ExtCtrls
      Debug: Module has no source files: Vcl.Themes
      Debug: Module has no source files: Vcl.ImgList
      Debug: Module has no source files: Vcl.Menus
      Debug: Module has no source files: Winapi.FlatSB
      Debug: Module has no source files: Vcl.Forms
      Debug: Module has no source files: Vcl.AxCtrls
      Debug: Module has no source files: Vcl.OleCtrls
      Debug: Module has no source files: Vcl.OleServer
      Debug: Module has no source files: madTypes
      Debug: Module has no source files: madTools
      Debug: Module has no source files: madDisAsm
      Debug: Module has no source files: madRemote
      Debug: Module has no source files: madCodeHook
      Debug: Module has no source files: System.Win.ComServ
      Debug: Module has no source files: DVCClientUnit
      Debug: Module has no source files: u_VirtualChannelUnit
      Debug: Module has no source files: u_IMEUntil
      Debug: Module has no source files: u_GostScriptUnit
      Debug: Module has no source files: u_gsDllUnit
      Debug: Module has no source files: Unit_FrmScreen
      Debug: Module has no source files: Unit_FrmPDFFileDownload
      Debug: Module has no source files: Unit_FrmMain
      Debug: Module has no source files: System
      Debug: Module has no source files: System.SysUtils
      Debug: Module has no source files: System.SyncObjs
      Debug: Module has no source files: System.Classes
      Debug: Module has no source files: Vcl.GraphUtil
      Constructing PDB file
    • Collecting source file names
    • Module streams
    • Strings stream
      Debug: String hash table. Fill factor: 79.0%, Collisions: 76.5%
    • PDB Info stream
    • TPI stream
    • Symbols stream
      Debug: GSI hash table. Size: 4,096, Fill factor: 96.5%, Collisions: 73.6%, Average chain: 3.8, Max chain: 51
      Debug: GSI hash table. Size: 4,096, Fill factor: 0.0%, Collisions: 0.0%, Average chain: 0.0, Max chain: 0
    • DBI stream
      Debug: String hash table. Fill factor: 0.0%, Collisions: 0.0%
    • IPI stream
    • Finalizing PDB file
    • 703 blocks written in 1 intervals
      Patching PE file
    • PE32 image (32-bit)
    • PDB file name has been stored in debug data.
    • PE file has been updated.
      Elapsed time: 00:00:00.118
      Done - Press enter to continue

    For example, the above shows "Debug: Module has no source files: madCodeHook", but the dpr content is:
    program RemoteAppClient;

    uses
    Forms,
    Unit_FrmMain in 'Unit_FrmMain.pas' {FrmMain},
    Unit_FrmScreen in 'Unit_FrmScreen.pas' {FrmScreen},
    u_IMEUntil in 'u_IMEUntil.pas',
    u_VirtualChannelUnit in 'u_VirtualChannelUnit.pas',
    DVCClientUnit in 'DynamicVirtualChannels\ClientDll\DVCClientUnit.pas',
    u_ChannelDefine in '..\Common\u_ChannelDefine.pas',
    u_DeMemoryStream in '..\Common\u_DeMemoryStream.pas',
    u_gsDllUnit in 'u_gsDllUnit.pas',
    Unit_FrmPDFFileDownload in 'Unit_FrmPDFFileDownload.pas' {FrmPDFFileDownload},
    madCodeHook in 'madcodehook\madCodeHook.pas',
    madDisAsm in 'madcodehook\madDisAsm.pas',
    madRemote in 'madcodehook\madRemote.pas',
    madRipeMD in 'madcodehook\madRipeMD.pas',
    madStrings in 'madcodehook\madStrings.pas',
    madTools in 'madcodehook\madTools.pas',
    madTypes in 'madcodehook\madTypes.pas';

    Why is it prompted that the file cannot be found?

  8. Anders@Melander

    I see no problems in that output. It’s just debug messages.

    For example, the above shows "Debug: Module has no source files: madCodeHook",

    If you look at your map file you will see that the madCodeHook module occurs three times:

    0001:0008C7F0 000071D6 C=CODE     S=.text    G=(none)   M=madCodeHook ACBP=A9
    ...
    0002:00001F68 00000518 C=DATA     S=.data    G=DGROUP   M=madCodeHook ACBP=A9
    ...
    0002:00005C74 000000C4 C=BSS      S=.bss     G=DGROUP   M=madCodeHook ACBP=A9
    

    Of these three, only the first, in the CODE segment, has any source lines associated with it so the warning is about the other two module references.

    I usually add the -include:0001 command line parameter so only the CODE segment is included and the other are ignored.

  9. Log in to comment