question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReadDebugHeader method change causing a SymbolsNotMatchingException

See original GitHub issue

Hi,

In https://github.com/jbevain/cecil/pull/349 the ReadDebugHeader method was changed, and we now check


if (directory.AddressOfRawData == 0) {
	entries [i] = new ImageDebugHeaderEntry (directory, Empty<byte>.Array);
	continue;
}

inside

void ReadDebugHeader ()
{
	if (image.Debug.IsZero) {
		image.DebugHeader = new ImageDebugHeader (Empty<ImageDebugHeaderEntry>.Array);
		return;
	}

	MoveTo (image.Debug);

	var entries = new ImageDebugHeaderEntry [(int) image.Debug.Size / ImageDebugDirectory.Size];

	for (int i = 0; i < entries.Length; i++) {
		var directory = new ImageDebugDirectory {
			Characteristics = ReadInt32 (),
			TimeDateStamp = ReadInt32 (),
			MajorVersion = ReadInt16 (),
			MinorVersion = ReadInt16 (),
			Type = (ImageDebugType) ReadInt32 (),
			SizeOfData = ReadInt32 (),
			AddressOfRawData = ReadInt32 (),
			PointerToRawData = ReadInt32 (),
		};

		if (directory.AddressOfRawData == 0) {
			entries [i] = new ImageDebugHeaderEntry (directory, Empty<byte>.Array);
			continue;
		}

		var position = Position;
		try {
			MoveTo ((uint) directory.PointerToRawData);
			var data = ReadBytes (directory.SizeOfData);
			entries [i] = new ImageDebugHeaderEntry (directory, data);
		} finally {
			Position = position;
		}
	}

	image.DebugHeader = new ImageDebugHeader (entries);
}

We have a scenario in which we use il-repack to merge dlls (together with pdbs). Currently il-repack is using the old version of Cecil and this part works. We want to unfork cecil in https://github.com/gluck/il-repack/pull/236 and use the current version but it seems that symbol files for IKVM’ed dlls are not read correctly now.

I tracked down the issue to that part of the code. In our IKVM symbol file the AddressOfRawData is 0. But the PointerToRawData is correct and if we skip that check (using debugger) then the behavior works as before.

Is that check necessary? Can we remove it?

Unfortunately I can’t add the dll plus pdb which are problematic but I will try to generate dummy dlls and attach them here.

Thank you

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jbevaincommented, Jun 4, 2019

Thanks for the test, unfortunately it’s not self contained and requires to resolve at least IKVM.Runtime, so I can’t take the test as it is. I’ve pushed a quick fix, but would love a self contained test.

0reactions
tephecommented, Jun 5, 2019

Another quick question, do you know when 0.11 will be released? Perhaps even a beta version we could reference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

a matching symbol file was not found in this folder
In my case, I made a new configuration called "Developer" and by default debug was turned off. Right click the project in question;...
Read more >
Strange symbol in VS debugger and missing method ...
Having stated my setup, I want to state that my setup is working, no problem until some recent changes. I've added some new...
Read more >
Debug feature broken on Android 9 with VS2019 & VS2022
When debugging sometimes the debugger crashes with an exception: EXCEPTION: Mono.Debugger.Soft.VMNotSuspendedException: The vm is not suspended.
Read more >
Debugging Application Verifier Stops - Windows drivers
If you are performing remote debugging through remote.exe, the symbol files should be on the computer with the debugger.
Read more >
Reading Symbols from Paged-Out Headers
If a module's header is paged out to disk, the debugger will not load symbols ... See Symbol Path for the ways to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found