dnSpy调试工具断点信息是保存在哪里的呢

2023-12-28 14:36:23

本人是C#开发,dnSpy工具用的比较多,有时候想把有用的断点信息保留下来,挪到别的机器上也能使用。我做这个事情的主要目标是在调试我们公司的程序时,顺带把访问的sql也进行输出,就可以偷懒不用每次都去查阅代码了,类似的效果如下:

一开始怀疑该断点信息是保存在dnSpy程序的运行目录下,找了一下没找到有;接着去找注册表,也没找到,没办法,只能阅读dnSpy的源码了,经过一翻努力,被我找到了

要找打它,步骤如下:

1? 在运行(快捷方式:window键+R键)中输入"%AppData%",如下图:

2? ?在打开的目录中,我们可以看到一个名为dnSpy的目录(如果没有这个目录,要先打开dnSpy.exe后关闭就可以看到该目录了)

3? 打开dnSpy目录,可以看到一个名为dnSpy.xml的配置文件,我们的断点调试信息就保存在这个文件下,当然,那天你看得不爽了,可以直接删掉这个配置文件,下次还会自动生成的。如下图:

xml文本如下:

<?xml version="1.0" encoding="utf-8"?>
<settings>
  <section _="071cf92d-acfa-46a1-8eef-dfac1d01e644" />
  <section _="1ace15fd-d689-40dc-b1e7-6eec25b3116f" />
  <section _="2366a90d-c708-4a10-81af-7887976bc3fb" />
  <section _="33e1988b-8eff-4f4c-a064-fa99a7d0c64d">
    <section _="MainWindowControlState">
      <section _="Horizontal" horizontal="True">
        <section _="Length" l="250" />
        <section _="Length" l="6" />
        <section _="Length" l="1.05*" />
      </section>
      <section _="Location" g="5495ee9f-1ef2-45f3-a320-22a89bfdf731" l="Left" />
      <section _="Location" g="e5745d58-4dcb-4d92-b786-4e1635c86eed" l="Bottom" />
      <section _="ToolWindow" index="0" is-horizontal="False" location="Left">
        <section _="Group" index="0">
          <section _="Content" g="5495ee9f-1ef2-45f3-a320-22a89bfdf731" />
        </section>
        <section _="StackedContent" horizontal="True">
          <section _="Length" l="0.95*" />
        </section>
      </section>
      <section _="ToolWindow" index="-1" is-horizontal="False" location="Right">
        <section _="StackedContent" horizontal="True" />
      </section>
      <section _="ToolWindow" index="-1" is-horizontal="False" location="Top">
        <section _="StackedContent" horizontal="True" />
      </section>
      <section _="ToolWindow" index="0" is-horizontal="False" location="Bottom">
        <section _="Group" index="0">
          <section _="Content" g="e5745d58-4dcb-4d92-b786-4e1635c86eed" />
        </section>
        <section _="StackedContent" horizontal="True">
          <section _="Length" l="0.95*" />
        </section>
      </section>
      <section _="Vertical" horizontal="False">
        <section _="Length" l="0.95*" />
        <section _="Length" l="6" />
        <section _="Length" l="250" />
      </section>
    </section>
    <section _="SavedWindowState" Bounds="-53,120,1300,730" IsFullScreen="False" WindowState="Maximized" />
  </section>
  <section _="34cf0af5-d265-4393-bc68-9b8c9b8ea622" ShowAllThemes="False" ThemeGuid="64efbb2c-0aca-467c-8389-9fa350376f3f" />
  <section _="3643ce93-84d5-455a-9183-94b58bc80942" />
  <section _="3e04abe0-fd5e-4938-b40c-f86aa0fa377d" />
  <section _="42cb1310-641d-4eb7-971d-16dc5cf9a40d" />
  <section _="4d05c47d-3f6a-429e-9cb3-232e10d45468" />
  <section _="53863c11-df95-43f2-8f86-5e9dfcce6893">
    <section _="FileLists" name="(Default)">
      <section _="FileList" name="(Default)">
        <section _="File" name="D:\张祥裕\代码\lib\Spring.Data.dll" />
      </section>
    </section>
    <section _="TabGroupWindow" index="-1" is-horizontal="False" name="Main">
      <section _="StackedContent" horizontal="True" />
    </section>
  </section>
  <section _="642b9276-3c9a-4efe-9b3b-d62046824b18" />
  <section _="6745457f-254b-4b7b-90f1-f948f0721c3b" />
  <section _="686c5cfb-ff63-4aa5-8c92-e08607ae5146" />
  <section _="6a7e565d-dc09-4aae-a7c8-e86a835fcbfc" />
  <section _="91f1ed94-1bea-4853-9240-b542a7d022ca" />
  <section _="b744ae6d-24e0-47a3-acf6-388eccb1c65a" />
  <section _="d9809eb3-1605-4e05-a84f-6ee241faad6c" />
  <section _="dd6752b1-5336-4601-a9b2-0879e18ae9f3" />
  <section _="f1634589-21ad-42dc-a729-e23cbd7072d2" />
   <section _="fbc6039c-8a7a-49dc-9c32-52c1b73de0a3">
         <section _="Breakpoint" IsEnabled="True">
                <section _="BPL" __BPT="DotNet" AssemblyFullName="Spring.Data, Version=1.3.2.20943, Culture=neutral, PublicKeyToken=65e474d141e25e07" Method="T Spring.Data.Generic.AdoTemplate::QueryWithResultSetExtractor&lt;T&gt;(System.Data.CommandType,System.String,Spring.Data.Generic.IResultSetExtractor`1&lt;T&gt;,Spring.Data.Common.IDbParameters)" ModuleName="D:\张祥裕\代码\lib\Spring.Data.dll" Offset="0" Token="100664314" />
                <section _="Trace" Message="&quot;Spring输出的sql:&quot;+{cmdText}" />
         </section>
         <section _="Breakpoint" IsEnabled="True">
                      <section _="BPL" __BPT="DotNet" AssemblyFullName="Oracle.DataAccess, Version=2.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" Method="System.Void Oracle.DataAccess.Client.OracleCommand::set_CommandText(System.String)" ModuleName="C:\Windows\assembly\GAC_32\Oracle.DataAccess\2.122.19.1__89b483f429c47342\Oracle.DataAccess.dll" Offset="48" Token="100665772" />
                      <section _="Trace" Message="&quot;输出的sql:&quot;+{m_commandText}" />
         </section>
         <section _="Breakpoint" IsEnabled="True">
                      <section _="BPL" __BPT="DotNet" AssemblyFullName="Oracle.DataAccess, Version=2.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" Method="System.Int32 Oracle.DataAccess.Client.OracleParameterCollection::Add(System.Object)" ModuleName="C:\Windows\assembly\GAC_32\Oracle.DataAccess\2.122.19.1__89b483f429c47342\Oracle.DataAccess.dll" Offset="43" Token="100666661" />
                      <section _="Trace" Message="参数:  {oracleParameter.m_paramName},{oracleParameter.m_value}" />
         </section>

    </section>
</settings>

当然,要挪到别的机器,需要把ModuleName进行修改

文章来源:https://blog.csdn.net/zxy13826134783/article/details/135266644
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。