Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / February 2004

Tip: Looking for answers? Try searching our database.

pdb access through ISymWrapper

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt Hargett - 14 Feb 2004 04:20 GMT
Let me give a quick user story here:
I need to be able to go from a byte offset in a method body to a line
of source code reference. I need to do this statically, without the
application being run in the debugger or otherwise. I would really
like to do this with purely managed code.

That being said, I can't seem to find any way to do this in a managed
fashion. I dug into ISymWrapper.DLL, but the total lack of
documentation (and my unwillingness to reverse engineer it right now)
has brought me to a stop. I am stuck trying to figure out what to pass
for the "importer" int parameter to GerReader in SymBinder. I know I
can reference the sscli source, and the Tool Developers
Guide\DebugRef.doc. I have referenced them, and I don't see how they
help me write managed code to complete my story.

I have .NET Framework 1.2 installed (not the SDK), which has a newer
version of ISymWrapper.DLL, and I would be willing to use, but the
"longhorn" MSDN docs for it aren't any better than the ones for the
existing version of the framework.

I have Googled my brains out, searched on MSDN, etc. Can someone
please give me some hints (or better yet, sample code)?

Thanks in advance!
Conrad Zhang - 14 Feb 2004 08:06 GMT
Sorry there is no good document on System.Diagnostics.SymbolStore. But
again, they are just managed wrapper around unmanaged interfaces defined in
DebugRef.doc.

The importer parameter is a IMetaDataImport pointer, as you can see from
DebugRef.doc on the unmanaged interface. There is no managed way to get
IMetaDataImport pointer. But runtime's meta data API can give you one.
Please refer to Tool Developers Guide\metadata unmanaged API.doc. And
samples\metainfo is an example how to use metadata APIs. samples\debugger is
an example how to use unmanaged debugging APIs, including the symbol
manipulating APIs.

Hope this hopes.

> Let me give a quick user story here:
> I need to be able to go from a byte offset in a method body to a line
[quoted text clipped - 20 lines]
>
> Thanks in advance!
Matt Hargett - 14 Feb 2004 17:02 GMT
> Sorry there is no good document on System.Diagnostics.SymbolStore. But
> again, they are just managed wrapper around unmanaged interfaces defined in
> DebugRef.doc.

Do you know of sample code anywhere besides the unmanaged examples in
the tool developers reference?


> The importer parameter is a IMetaDataImport pointer, as you can see from
> DebugRef.doc on the unmanaged interface. There is no managed way to get
[quoted text clipped - 3 lines]
> an example how to use unmanaged debugging APIs, including the symbol
> manipulating APIs.

Thanks for the explanation, though I'm still quite confused. Why is
the IMetaDataImport a pointer and the managed GetReader interface
takes an int (instead of an IntPtr)? Did Microsoft leave a crucial
piece of the managed symbol wrapper out entirely? Did they not write a
small test prorgram to prove the API worked at all? I hope they
correct this in .NET Framework v1.2 (they look the same in the beta so
far).

I will check out the metadata unamanged API doc, thanks for the
pointer!

> Hope this hopes.

One can always hope ;> I'll let you know if I get any further.
Everything in .NET was so easy, even reflection, up until this point.
I don't know why these APIs appear to be the red-headed step-child of
the framework.

Thanks again!
Conrad Zhang - 15 Feb 2004 05:38 GMT
The int parameter is a bug. It should be IntPtr.

But it should be fine if your application only runs in x86. It is only a
problem in x86-64 and IA64.

> Thanks for the explanation, though I'm still quite confused. Why is
> the IMetaDataImport a pointer and the managed GetReader interface
[quoted text clipped - 8 lines]
>
> Thanks again!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.