zoukankan      html  css  js  c++  java
  • 探索sscli, 开启CLR 的大门——配置环境详解(转)

    配置及环境:
    一.代码分析工具
          在 sscli 茫茫的代码中确实需要一个有效的分析工具,我这里选择的是Source Insight,它可以帮助你找到相关类型,并且有效的定位到代码的声明或实现的地方。
    图1:新建一个项目,sscli,项目文件保存地点需要与你的 sscli 文件夹存放在同一个磁盘上


    2.


    3.选择sscli20中的CLR文件夹点击 AddTree 按钮,他会寻找到所有相关代码


    4.进行文件同步,source insight就会同步所有代码文件。


    3.分析后的代码


    二.CLR调试工具
          WinDbg 利用微软提供的调试 symbol 你可以真实的跟踪出具体实现的函数以及类型(从这点你就可以发现 sscli 并不是微软的实现代码)。具体配置如下:

     1.设置symbol,我这里选择的 D:\WinSymbols 文件夹你可选择别的地方


    2.加载dotnet程序进行调试,几个比较实用的命令 lm 列出所有加载的模块, ld 加载制定模块,例如:ld mscoree,列出指定模块symbol:x /n mscoree!*


    之后就可以进行 CLR 的调试。如图:调用堆栈显示 CLR 的执行过程。


    下面列表就是使用 x /n mscorjit! 命令列出 JIT 编译器实现的一部分接口(这里只粘贴了一部分):
    // 获取即时编译对象
    790a6082 mscorjit!getJit = <no type information>

    790a60a0 mscorjit!CILJit::`vftable' = <no type information>
    7906edef mscorjit!CILJit::clearCache = <no type information>
    7906114f mscorjit!CILJit::compileMethod = <no type information>                    // 编译 IL 代码 (jit层源代码保护一般来说就是在这里实现的,详情请参看我以前写的文章,MaxToCode DNGuard HVM 都可以由此分析破解)
    790610a0 mscorjit!CILJit::isCacheCleanupRequired = <no type information>


    7908f1b2 mscorjit!Compiler::EHblkDsc::CheckIsInHandlerRegion = <no type information>
    790867ff mscorjit!Compiler::EHblkDsc::CheckIsInTryRegion = <no type information>
    79085d2e mscorjit!Compiler::EHblkDsc::IsInFilterRegion = <no type information>
    790a5515 mscorjit!Compiler::EHblkDsc::IsInHandlerRegion = <no type information>
    79066e44 mscorjit!Compiler::FlatFPAllocFPState = <no type information>
    ...
    .....
    .....
    .....
    7909af92 mscorjit!Compiler::verVerifyCall = <no type information>
    7909bbf9 mscorjit!Compiler::verVerifyCond = <no type information>
    7909ba31 mscorjit!Compiler::verVerifyField = <no type information>
    790a086e mscorjit!Compiler::verVerifyLDIND = <no type information>
    790a0805 mscorjit!Compiler::verVerifySTIND = <no type information>
    7909aae3 mscorjit!Compiler::verVerifyThisPtrInitialised = <no type information>

    这里和大家分享和学习如何学IT!
  • 相关阅读:
    js学习
    console用法
    Oracle 数据库加密
    Oracle 内存结构
    Oracle 锁
    Oracle 索引
    怎么理解“平均负载”
    Oracle分区表
    Oracle 数据库表(常见的表)
    PostgreSQL 监控磁盘使用
  • 原文地址:https://www.cnblogs.com/fuchifeng/p/1304067.html
Copyright © 2011-2022 走看看