tim-lebedkov / map2dbg

Automatically exported from code.google.com/p/map2dbg
0 stars 0 forks source link

IndexOutOfRangeException raised when processing certain files #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

First thank you for this tool which looks really promising.

I use it to generate PDB files for my binaries in order to have valid stack 
traces under WinDBG.

First remark - it does not seems to like DLL files : I got the following fatal 
error when trying to produce a PDB file from a FILENAME.DLL :

Exception non gérée : System.IO.FileNotFoundException: Impossible de trouver 
le fichier 'c:\PATH\FILENAME.exe'.
Nom du fichier : 'c:\PATH\FILENAME.exe'
   à System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   à System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, In
t32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions op
tions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, F
ileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean b
FromProxy)
   à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, F
ileShare share)
   à System.IO.File.Open(String path, FileMode mode, FileAccess access)
   à pdbbind.PdbBind.Bind(String exefname, String pdbfname, Int32 timestamp, Gui
d guid, Int32 age)
   à tds2pdbproto.PdbWriter.WritePdb(List`1 tglobals, ModuleInfo[] modules, Stri
ng pdbname, String exename)
   à tds2pdbproto.Program.Main(String[] args)

(basically, it says in French that it cannot find FILENAME.EXE instead of 
searching for FILENAME.DLL).

Well, it seems that using the ".EXE" extension for the library file worked. But 
for some files the program crashes with the following stack trace :

Exception non gérée : System.IndexOutOfRangeException: L'index se trouve en 
dehors des limites du tableau.
   à pdbbind.PdbBind.Bind(String exefname, String pdbfname, Int32 timestamp, Gui
d guid, Int32 age)
   à tds2pdbproto.PdbWriter.WritePdb(List`1 tglobals, ModuleInfo[] modules, Stri
ng pdbname, String exename)
   à tds2pdbproto.Program.Main(String[] args)

I was wondering if you're aware of this issue and if I could help you to fix it.

Thanks.

Adrien

Original issue reported on code.google.com by adrien.reboisson on 10 May 2012 at 12:12

GoogleCodeExporter commented 9 years ago
No, but it is possible that the code has some rough edges.
(not tested that much, also not using it very much)

You can try to fix it yourself by grabbing the code and run it in VisualStudio 
Express 2010.

You can also send me your files, so I can take a look when I have some time 
(you have to wait more time...)

Original comment by andre.mussche on 10 May 2012 at 12:18

GoogleCodeExporter commented 9 years ago
Believe me or not, your code is incredibly useful, at least for me :D

Here is the file that generates the exception. The following commands can be 
used to reproduce the issue :

tdstrp32.exe -s SMART.exe
tds2pdbproto.exe SMART.TDS

I understand that this project is not on the top of your priorities, but if you 
have some time, one day...

Anyway thank your for your work.

Adrien

Original comment by adrien.reboisson on 10 May 2012 at 12:45

Attachments:

GoogleCodeExporter commented 9 years ago
I get an error when running your exe:
"SMART.exe is not a valid Win32 application."

Original comment by andre.mussche on 10 May 2012 at 1:14

GoogleCodeExporter commented 9 years ago
Hi,

To avoid the FileNotFoundException exception, it changed the file extension 
from ".DLL" to ".EXE". You can rename it "SMART.dll" to exhibit the problem.

Thanks,

Adrien

Original comment by adrien.reboisson on 10 May 2012 at 2:32

GoogleCodeExporter commented 9 years ago
fixed, see new download:
http://map2dbg.googlecode.com/files/tds2pdb101.zip

(note: the dll misses a .rdata section so it cannot bind the pdb to the dll)

Original comment by andre.mussche on 11 May 2012 at 7:51

GoogleCodeExporter commented 9 years ago
Thanks for finding time to fix the problem !

Adrien

Original comment by adrien.reboisson on 11 May 2012 at 7:53