Bug 25357 - .mdb has invalid scopes
Summary: .mdb has invalid scopes
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2014-12-12 17:07 UTC by David Karlaš
Modified: 2015-01-02 21:09 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Evaluation of PdbFunction in pdb2mdb program (36.99 KB, image/png)
2014-12-12 17:07 UTC, David Karlaš
Details

Description David Karlaš 2014-12-12 17:07:53 UTC
Created attachment 9063 [details]
Evaluation of PdbFunction in pdb2mdb program

If scopes in .mdb file are invalid XS Debugger(or debugger-libs) can't determine which "e" is correct one.

First code example:
using System.IO;
using System;

namespace ExceptionEvalFails
{
  class MainClass
  {
    public static void Main (string[] args)
    {
      try {
        throw new Exception ();
      } catch (IOException e) {
        Console.WriteLine (e);
      } catch (Exception e) {
        Console.WriteLine (e);//Breakpoint here
      }
    }
  }
}

This method has 2 variables named "e" but in different scopes. See attachment for PDB scopes of program above.

This is mdbdump output for pdb2mdb(used by Windows Android):
<?xml version="1.0" encoding="ibm852"?>
<symbols>
  <files>
    <file id="1" name="Program.cs" checksum="bf0b21f7862de771d9a5114f4982257b" />
  </files>
  <methods>
    <method token="0x6000001" signature="System.Void ExceptionEvalFails.MainClass::Main(System.String[])">
      <sequencepoints>
        <entry il="0x0" row="9" col="3" end_row="9" end_col="4" file_ref="1" />
        <entry il="0x1" row="10" col="8" end_row="10" end_col="9" file_ref="1" />
        <entry il="0x2" row="11" col="5" end_row="11" end_col="28" file_ref="1" />
        <entry il="0x8" row="12" col="6" end_row="12" end_col="27" file_ref="1" />
        <entry il="0x9" row="12" col="28" end_row="12" end_col="29" file_ref="1" />
        <entry il="0xa" row="13" col="5" end_row="13" end_col="27" file_ref="1" />
        <entry il="0x11" row="14" col="4" end_row="14" end_col="5" file_ref="1" />
        <entry il="0x12" row="14" col="0" file_ref="1" />
        <entry il="0x14" row="14" col="6" end_row="14" end_col="25" file_ref="1" />
        <entry il="0x15" row="14" col="26" end_row="14" end_col="27" file_ref="1" />
        <entry il="0x16" row="15" col="5" end_row="15" end_col="27" file_ref="1" />
        <entry il="0x1d" row="16" col="4" end_row="16" end_col="5" file_ref="1" />
        <entry il="0x1e" row="16" col="0" file_ref="1" />
        <entry il="0x20" row="16" col="0" file_ref="1" />
        <entry il="0x21" row="17" col="3" end_row="17" end_col="4" file_ref="1" />
      </sequencepoints>
      <locals>
        <entry name="e" il_index="0" scope_ref="0" />
        <entry name="e" il_index="1" scope_ref="0" />
      </locals>
      <scopes />
    </method>
  </methods>
</symbols>

And this is by mcs.exe(notice that it has 3 scopes but both variables are in 0 scope):
<?xml version="1.0" encoding="ibm852"?>
<symbols>
  <files>
    <file id="1" name="Program.cs" checksum="70feb5658988698896c6888b83696faf" />
    <file id="2" name="AssemblyInfo.cs" checksum="53e1ea137859b9367e3248e7436133cc" />
  </files>
  <methods>
    <method token="0x6000001" signature="System.Void ExceptionEvalFails.MainClass::.ctor()">
      <sequencepoints />
      <locals />
      <scopes />
    </method>
    <method token="0x6000002" signature="System.Void ExceptionEvalFails.MainClass::Main(System.String[])">
      <sequencepoints>
        <entry il="0x0" row="9" col="5" file_ref="1" />
        <entry il="0x1" row="10" col="11" file_ref="1" />
        <entry il="0x2" row="11" col="15" file_ref="1" />
        <entry il="0x8" row="12" col="9" file_ref="1" />
        <entry il="0x9" row="12" col="31" file_ref="1" />
        <entry il="0xa" row="13" col="9" file_ref="1" />
        <entry il="0xb" row="13" col="17" file_ref="1" />
        <entry il="0x10" row="14" col="7" file_ref="1" />
        <entry il="0x11" row="14" col="9" file_ref="1" />
        <entry il="0x17" row="14" col="29" file_ref="1" />
        <entry il="0x18" row="15" col="9" file_ref="1" />
        <entry il="0x19" row="15" col="17" file_ref="1" />
        <entry il="0x1e" row="16" col="7" file_ref="1" />
        <entry il="0x24" row="17" col="5" file_ref="1" />
      </sequencepoints>
      <locals>
        <entry name="e" il_index="0" scope_ref="0" />
        <entry name="e" il_index="1" scope_ref="0" />
      </locals>
      <scopes>
        <entry index="0" start="0x2" end="0x8" />
        <entry index="1" start="0xa" end="0x10" />
        <entry index="2" start="0x18" end="0x1e" />
      </scopes>
    </method>
  </methods>
</symbols>
Comment 1 Zoltan Varga 2014-12-12 17:30:10 UTC
Isn't this an mcs problem then, i.e. it should put the variables into different scopes ? pdb2mdb should probably do the same.
Comment 2 David Karlaš 2014-12-12 17:35:10 UTC
I will open new bug for mcs.exe part and keep this one open for pdb2mdb.
Comment 3 Zoltan Varga 2015-01-02 20:34:16 UTC
Can you attach the .pdb file for the testcase above ?
Comment 4 Zoltan Varga 2015-01-02 21:09:16 UTC
Fixed in mono master f9bcd25048a43f958e14855661375c6d8c2b0159.

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.


Create a new report for Bug 25357 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Related Links: