使用Symchk来离线需要的Symbol文件

2023-10-26

我们在工作中会经常遇到离线环境,这时候就需要准备好离线符号,我们使用安装windbg时候自带的工具SymChk.exe
微软的官方说明在下面

使用起来也很简单,下面是一个使用示例:

使用 SymChk.exe 实用程序下载 Windows\System32 文件夹中所有组件的符号文件,请使用以下命令行命令:
symchk /r c:\windows\system32 /s SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
在此示例中:
“/r c:\windows\system32”查找 System32 文件夹和所有子文件夹中的所有符号文件。
“/s SRVc:*http://msdl.microsoft.com/download/symbols”指定用于符号解析的符号路径。在此例中,“c:\symbols”是将在其中从符号服务器复制符号的本地文件夹。


如果你的机器已经处于离线状态还可以使用SymChk.exe生成一个所需要符号的清单文件,然后将这个文件移动到可以联网的环境进行下载

Using SymChk

  • Article
  • 02/04/2022
  • 4 minutes to read
  • 1 contributor

Feedback

The basic syntax for SymChk is as follows:

ConsoleCopy

symchk [/r] FileNames /s SymbolPath 

FileNames specifies one or more program files whose symbols are needed. If FileNames is a directory and the /r flag is used, this directory is explored recursively, and SymChk will try to find symbols for all program files in this directory tree. SymbolPath specifies where SymChk is to search for symbols.

There are many more command-line options. For a full listing, see SymChk Command-Line Options.

Obtaining symchk

Symchk, like other debugging tools, ship as part of the debugger. For more information, see Download Debugging Tools for Windows.

Once the debugging tools are installed, symchk is available in this directory for 64 bit Windows.

C:\Program Files (x86)\Windows Kits\10\Debuggers\x64

Example Usage

The symbol path specified can include any number of local directories, UNC directories, or symbol servers. Local directories and UNC directories are not searched recursively. Only the specified directory and a subdirectory based on the executable's extension are searched. For example, the query

ConsoleCopy

symchk thisdriver.sys /s g:\symbols 

will search g:\mysymbols and g:\mysymbols\sys.

You can specify a symbol server by using either of the following syntaxes as part of your symbol path:

ConsoleCopy

srv*DownstreamStore*\\Server\Share
srv*\\Server\Share

This is very similar to using a symbol server in the debugger's symbol path. For details on this, see Using Symbol Servers and Symbol Stores.

If a downstream store is specified, SymChk will make copies of all valid symbol files found by the symbol server and place them in the downstream store. Only symbol files that are complete matches are copied downstream.

SymChk always searches the downstream store before querying the symbol server. Therefore you should be careful about using a downstream store when someone else is maintaining the symbol store. If you run SymChk once and it finds symbol files, it will copy those to the downstream store. If you then run SymChk again after these files have been altered or deleted on the symbol store, SymChk will not notice this fact, since it will find what it is looking for on the downstream store and look no further.

Note   SymChk always uses SymSrv (Symsrv.dll) as its symbol server DLL. On the other hand, the debuggers can choose a symbol server DLL other than SymSrv if one is available. (SymSrv is the symbol server included in the Debugging Tools for Windows package.)

Using SymChk to determine whether symbols are private or public

To determine whether a symbol file is private or public, use the /v parameter so that SymChk displays verbose output. Suppose MyApp.exe and MyApp.pdb are in the folder c:\sym. Enter this command.

ConsoleCopy

symchk /v c:\sym\MyApp.exe /s c:\sym**

If MyApp.pdb contains private symbols, the output of SymChk looks like this.

ConsoleCopy

[SYMCHK] Searching for symbols to c:\sym\MyApp.exe in path c:\sym
...
DBGHELP: MyApp - private symbols & lines
        c:\sym\MyApp.pdb
...
SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1

If MyApp.pdb contains only public symbols, the output of SymChk looks like this.

ConsoleCopy

[SYMCHK] Searching for symbols to c:\sym\MyApp.exe in path c:\sym
...
DBGHELP: MyApp - public symbols
        c:\sym\MyApp.pdb
...
SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1

To limit your search so that it finds only public symbol files, use the s option with the /s parameter (/ss). The following command finds a match if MyApp.pdb contains only public symbols. It does not find a match if MyApp.pdb contains private symbols.

ConsoleCopy

symchk /v c:\sym\MyApp.exe /ss c:\sym

For more information, see Public and Private Symbols.

Examples

Here are some examples. The following command searches for symbols for the program Myapp.exe:

ConsoleCopy

e:\debuggers> symchk f:\myapp.exe /s f:\symbols\applications 

SYMCHK: Myapp.exe           FAILED  - Myapp.pdb is missing

SYMCHK: FAILED files = 1
SYMCHK: PASSED + IGNORED files = 0

You can try again with a different symbol path:

ConsoleCopy

e:\debuggers> symchk f:\myapp.exe /s f:\symbols\newdirectory 

SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1

The search was successful this time. If the verbose option is not used, SymChk will only list files for which it failed to find symbols. So in this example no files were listed. You can tell that the search succeeded because there is now one file listed in the "passed" category and none in the "failed" category.

A program file is ignored if it contains no executable code. Many resource files are of this type.

If you prefer to see the file names of all program files, you can use the /v option to generate verbose output:

ConsoleCopy

e:\debuggers> symchk /v f:\myapp.exe /s f:\symbols\newdirectory 

SYMCHK: MyApp.exe           PASSED

SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 1

The following command searches for a huge number of Windows symbols in a symbol server. There are a great variety of possible error messages:

ConsoleCopy

e:\debuggers> symchk /r c:\windows\system32 /s srv*\\manysymbols\windows 

SYMCHK: msisam11.dll         FAILED  - MSISAM11.pdb is missing
SYMCHK: msuni11.dll          FAILED  - msuni11link.pdb is missing
SYMCHK: msdxm.ocx            FAILED  - Image is split correctly, but msdxm.dbg i
s missing
SYMCHK: expsrv.dll           FAILED  - Checksum doesn't match with expsrv.DBG
SYMCHK: imeshare.dll         FAILED  - imeshare.opt.pdb is missing
SYMCHK: ir32_32.dll          FAILED  - Built with no debugging information
SYMCHK: author.dll           FAILED  - rpctest.pdb is missing
SYMCHK: msvcrt40.dll         FAILED  - Built with no debugging information
......
SYMCHK: FAILED files = 211
SYMCHK: PASSED + IGNORED files = 4809

Using a Manifest File with SymChk

In some cases, you might need to retrieve symbols for files that are on an isolated computer; that is, a computer that is either not on any network or is on a network that has no symbol store. In that situation, you can use the following procedure to retrieve symbols.

  1. Run SymChk with the /om parameter to create a manifest file that describes the files for which you want to retrieve symbols.

  2. Move the manifest file to a network that has a symbol store.

  3. Run SymChk with the /im parameter to retrieve symbols for the files described in the manifest file.

  4. Move the symbol files back to the isolated computer.

Example

Suppose yourApp.exe is running on an isolated computer. The following command creates a manifest file that describes all the symbols needed to debug the yourApp.exe pocess.

dbgcmdCopy

C:\>SymChk /om c:\Manifest\man.txt /ie yourApp.exe

SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 28

Now assume you have moved the manifest file to a different computer that is on a network that has access to a symbol store. The following command retrieves the symbols described in the manifest file and places them in the mySymbols folder.

dbgcmdCopy

C:\>SymChk /im c:\FolderOnOtherComputer\man.txt /s srv*c:\mysymbols*\\aServer\symbols

SYMCHK: myApp.exe             ERROR - Unable to download file. Error reported was 2
. . .
SYMCHK: FAILED files = 28
SYMCHK: PASSED + IGNORED files = 28

Now you can move the symbols to the isolated computer and use them for debugging.

如何下载离线dll的pdb

在某些情况下,可能需要检索位于独立计算机上的文件的符号;也就是说,计算机不在任何网络上,或位于没有符号存储的网络上。 在这种情况下,可以使用以下过程来检索符号。

  1. 使用 /om 参数运行 SymChk,以创建描述要检索其符号的文件的清单文件。

  2. 将清单文件移动到具有符号存储区的网络。

  3. 运行带有 /im 参数的 SymChk,以检索清单文件中所描述文件的符号。

  4. 将符号文件移回独立计算机。

示例

假设 yourApp.exe 在独立的计算机上运行。 下面的命令创建一个清单文件,用于描述调试 yourApp.exe pocess 所需的所有符号。

dbgcmd复制

C:\>SymChk /om c:\Manifest\man.txt /ie yourApp.exe

SYMCHK: FAILED files = 0
SYMCHK: PASSED + IGNORED files = 28

现在假设已将清单文件移动到可访问符号存储区的网络上的另一台计算机。 下面的命令检索清单文件中描述的符号,并将其放在 mySymbols 文件夹中。

dbgcmd复制

C:\>SymChk /im c:\FolderOnOtherComputer\man.txt /s srv*c:\mysymbols*\\aServer\symbols

SYMCHK: myApp.exe             ERROR - Unable to download file. Error reported was 2
. . .
SYMCHK: FAILED files = 28
SYMCHK: PASSED + IGNORED files = 28

现在,你可以将符号移到隔离的计算机并将其用于调试。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用Symchk来离线需要的Symbol文件 的相关文章

  • 使用 XAMPP 在 Windows 10 中安装 go-pear.phar 时出错

    我在尝试安装时总是遇到错误go pear phar 这是点击后的错误Enter对这个问题1 13 all or Enter to continue 1 13 all or Enter to continue ERROR Please ent
  • 调用 close() 后大文件没有立即刷新到磁盘?

    我正在使用 python 脚本创建大文件 超过1GB 实际上有 8 个 在创建它们之后 我必须创建将使用这些文件的进程 该脚本如下所示 This is more complex function but it basically does
  • Powershell:别名和函数有什么区别?

    Im setting up my powershell profile to create aliases of commonly used commands On Microsoft s documentation https learn
  • 适用于 Python 的旧版本 Windows 二进制库 Wheel 的存储库?

    作为很多用户 我使用很棒的Christopher 的 Windows 二进制轮子 http www lfd uci edu gohlke pythonlibs vlfd当尝试在 Windows 上安装一些 python 包 例如 GDAL
  • 数据太长,导致列错误(包含国家字符)

    我必须移植一些DBS变成独立的MySQL版本 5 0 18运行于Windows 7 64 位我遇到了一个困扰我的问题 如果我尝试将任何国家 Unicode 字符插入varchar我收到错误 ERROR 1406 22001 Data too
  • 如何检查应用程序的另一个实例是否正在运行[重复]

    这个问题在这里已经有答案了 有人可以展示如何检查程序的另一个实例 例如 test exe 是否正在运行 如果是 则停止加载应用程序 如果存在该实例 想要一些严肃的代码吗 这里是 var exists System Diagnostics P
  • 适用于 Windows 的 PHP 支持的 GUI 应用程序

    我知道 PHP 是一种解释性语言 对于基于 Web 的事物来说 不是为在实际操作系统上运行 GUI 应用程序而设计的 但是有没有办法呢 基本上 是否有一个框架 系统允许我创建 本机 基本上是二进制文件 exe 看起来像带有本机控件和所有内容
  • 关于在 Windows 上使用 WiFi Direct Api?

    我目前正在开发一个应用程序 我需要在其中创建链接 阅读 无线网络连接 在桌面应用程序 在 Windows 10 上 和平板电脑 Android 但无关紧要 之间 工作流程 按钮 gt 如果需要提升权限 gt 创建类似托管网络的 WiFi 网
  • Linux 和 Windows 上的相同计算 --> 结果不同

    我编写了以下算法来将十进制值转换为二进制 十六进制等 string toFormatFromDecimal long long t Format format int digitCount ceil log t log int format
  • git lineends redux - Mac OS git 与 Windows 用户的贡献

    我在 Mac OS X 上进行开发 我有一个用户正在贡献带有 CRLF 行结尾的代码 他目前不使用 git 我创建一个分支 然后将我的工作树切换到它 我将他的文件复制到工作树中 当我尝试暂存文件时 收到错误fatal CRLF would
  • QML 缩放不适用于非整数缩放因子

    我正在使用 QML 编写一个应用程序 当我按非整数因子缩放 GUI 时遇到麻烦 根据文档 https doc qt io qt 5 highdpi html Qt AA EnableHighDpiScaling应该启用与设备无关的像素 因此
  • MySQL 在 Windows 上将数据库文件存储在哪里以及文件的名称是什么?

    我不小心格式化了硬盘并重新安装了 Windows 却忘记备份 MySQL 服务器中的重要数据库 我现在正在尝试使用某些软件来挽救文件 但我不知道要寻找什么 文件存储的路径是什么 文件的名称是什么 我应该查找什么命名约定或文件扩展名 我相信我
  • 如何在使用 Apache 2 的 Windows 上忽略 Perl shebang?

    我已经在我的 Windows 机器上设置了本地 Perl Web 环境 我正在开发的应用程序最初来自 Linux 服务器 因此源代码的 shebang pl文件看起来像这样 usr bin perl 这会导致我的 Windows 开发机器上
  • 为什么加载程序无法加载到所需位置

    据说有时加载器加载 exe 的地址与链接器假定的地址不同 当加载程序这样做时 可能会出现什么情况 基本上 这发生在以下情况 图像要加载的地址已被占用 例如 那里可能已经加载了另一个图像 要加载的图像已编译ASLR http en wikip
  • 如何使用 Windows 上运行的 Java 服务检测用户活动?

    我的目标是使用 Java 创建一个系统监控应用程序 我想知道用户何时在 Windows PC 上进行活动 结果会是这样的 8 00 8 15 活动 9 12 10 29 活动 12 24 15 34 活动 我对任何其他信息 按下了哪个键 使
  • 插入新的 USB 设备时会发生什么?

    我有一个带有 USB 连接的嵌入式设备 当用户将设备插入 PC Windows OSX 时 操作系统如何发现要安装哪些驱动程序 如何得到my驱动程序被选择 它们可以驻留在某个中央服务器上 由操作系统供应商运行 吗 这是针对 Windows
  • 防止单个可执行文件的多个进程实例

    我正在使用 NET 和 C 我想阻止同一可执行文件的两个实例同时运行 但我不想阻止从另一个文件夹运行的同一进程 例如 我有一个位于两个不同位置的可执行文件 C MyProject Master Program exe C MyProject
  • 为什么 RDP 与其他远程控制软件相比如此快?

    我使用基于 RDP 的 Windows 远程客户端桌面实用程序从笔记本电脑连接到桌面 它比 TeamViewer 等远程控制应用程序更快 更美观 出于好奇 为什么 RDP 更好 谢谢 RDP 是一种允许传输低级屏幕绘制操作的特定协议 它还知
  • 使用 C# winforms 与 Windows 中的其他桌面应用程序交互

    我想知道是否可以与使用我的程序的其他程序进行交互 例如 单击另一个程序上的按钮等 我不确定这是否可能 但如果可能的话 有人可以提供一些 C 示例代码 Thanks 您可以创建消息并将其发送到其他进程 为此 您必须在 C 代码中使用 P In
  • 在 cmd 上使用 Cygwin 命令进行彩色输出

    操作系统 Windows XP SP3 不幸的是 我已经下载并安装了最新版本的 Cygwin 和 Git 我还配置了我的环境 以在系统路径中包含每个文件夹的 bin 文件夹 并设置用户变量 TERM msys 我现在可以进入 cmd 并使用

随机推荐

  • CollAFL: Path Sensitive Fuzzing 模糊测试论文阅读

    CollAFL Path Sensitive Fuzzing 会议 S P2018 这是一篇内容十分饱满的Fuzz文章 受益匪浅 1 Abstract and Introduction 对于覆盖率引导的模糊测试来说 跟踪覆盖率是至关重要的
  • IT风投案例分析——facebook

    Facebook 虽然Facebook对于中国人来说是一个不存在的网站 但这并不能妨碍它成为世界前列的互联网公司 Facebook是很特殊的 它的创始人扎克伯格1984年出生 在2004年就开始创建Facebook 当时他只有仅仅二十岁 那
  • Vivado软件的一些报错总结

    1 Synth 8 2543 port connections cannot be mixed ordered and named E FPGA project Xilinx ZYNQ three days sobel 032 face o
  • 渗透测试概述与流程

    渗透测试概述 渗透测试是一种通过模拟攻击的技术与方法 挫败目标系统的安全控制措施并获得控制访问权的安全测试方法 网络渗透测试主要依据CVE已经发现的安全漏洞 模拟入侵者的攻击方法对网站应用 服务器系统和网络设备进行非破坏性质的攻击性测试 C
  • 华为od 安全测试岗 简谈机试面试【更新完】

    PS 准备慢慢更新下最近我在od的机试题以及一二轮面试题和hr面 主管面 最后成功拿到offer 但不打算去了 然后成功让对接人破防 od懂得都懂 流程是 机试 gt 一面 gt 中间穿插了性格测试考试 gt 二面 gt HR面 gt 综面
  • 关于微信小程序的生命周期

    关于微信小程序的生命周期 onLaunch 官网App vue App uvue uni app官网 问题描述 我现在有个小程序 取名为a 有个用户b 从来没有打开过小程序 那么他第一次打开小程序的时候会触发onLaunch 然后用户b退出
  • flask+mysql+ECharts+ajax+百度地图实现数据可视化

    思路 1 后台连接数据库创建session对象 2 创建表关系映射 3 查询数据 4 将数据封装成特定格式 json 5 前台通过ajax请求指定路由异步加载数据并在地图上展示 先来看一下效果 地图参考 https gallery echa
  • uniapp tabbar底部栏 子组件页面不刷新解决方案

    场景 uniapp 来回切换底部栏tabbar 页面初始化数据 当前子组件页面会发送数据请求 再次切换进入 当前页面的子组件不发送请求 解决方案 1 父组件在onShow钩子里面中向子组件传递随机数 2 子组件接收数据 并进行watch监听
  • Android 系统设置中显示设置之休眠和屏保设置篇

    Android 系统设置中显示设置之休眠和屏保设置篇 在上一篇中我们学习了Android系统设置中字体大小和屏幕旋转设置基本内容 在这一篇中我们继续学习显示设置中的休眠和屏保设置 1 休眠设置 首先我们来看一下休眠设置在界面中的定义 1
  • js--for循环99乘法表的四种样式

  • Eclipse/Code blocks/PyCharm连接MySQL数据库初尝试

    第一次使用MySQL 在此罗列我搭配环境的一些路程 我最终Code blocks和Eclipse成功了 Pycharm一直因为版本不合适未成功 我也把我试过的未成功的方法罗列在此 希望可以得到最终的解决 Code blocks 我在用cod
  • Cocos Creator组件化开发之——地图类缩放拖动点击组件

    好记性不如烂笔头 记录开发过程中的点点滴滴 xshu 书写是对思维的缓存 佚名 进入正题 在游戏开发过程中经常会遇到渲染元素的尺寸大于你所能展示的区域 需要玩家自行进行操作 拖动以及点击 比如地图通常会超出玩家所示区域 这个时候需要一个能够
  • STM32F103ZET6+IIC+SGP30气体传感

    STM32F103ZET6 IIC SGP30气体传感 为了加深对IIC协议的理解和应用 接下来 使用STM32驱动SGP30气体传感传感器 准备IIC协议 用的还是之前的那些代码 只是把GPIO引脚口改了一下而已 1 声明GPIO和IIC
  • 虚拟地址空间和物理地址空间

    1 概念 物理地址 物理地址空间是实在的存在于计算机中的一个实体 在每一台计算机中保持唯一独立性 我们可以称它为物理内存 如在32位的机器上 物理空间的大小理论上可以达到2 32字节 4GB 但如果实际装了512的内存 那么其物理地址真正的
  • 如何让一句话木马绕过waf的检测 ?

    一 什么是一句话木马 一句话木马就是只需要一行代码的木马 短短一行代码 就能做到和大马相当的功能 为了绕过waf的检测 一句话木马出现了无数中变形 但本质是不变的 木马的函数执行了我们发送的命令 二 我们如何发送命令 发送的命令如何执行 我
  • 爬虫逆向实战(33)-某联社数据(webpack)

    一 数据接口分析 主页地址 某联社 1 抓包 通过抓包可以发现数据接口是 nodeapi telegraphList 2 判断是否有加密参数 请求参数是否加密 通过查看 载荷 模块可以发现有一个sign加密参数 请求头是否加密 无 响应是否
  • CSS盒子模型

    CSS盒子模型 课程目标 1 常用样式 2 盒子模型 3 CSS3常见效果 盒子模型介绍 引用百度百科 层叠样式表其实就是对静态页面进行装饰 但是 特别要注意的点是 通常建议表现形式与页面内容分离 例如 人就是内容 穿着打扮就是表现形式 常
  • 使用MQTT客户端连接阿里云MQTT服务器

    本文是转载的 原文请戳这里查看 摘要 物联网全栈教程 从云端到设备 八 一 这一篇文章零妖老哥将给你展示两个电脑软件的使用方法 将极大地方便你调试与MQTT有关的物联网项目 一个叫MQTT客户端用来模拟设备向云端发送数据和接收云端的数据 另
  • linux常用命令

    Linux目录结构简介 目录结构 说明 bin 是Binary的缩写 这个目录存放着最经常使用的命令 sbin s就是Super User的意思 这里存的系统管理员使用的系统管理程序 home 存放普通用户的主目录 在Linux中每个用户都
  • 使用Symchk来离线需要的Symbol文件

    我们在工作中会经常遇到离线环境 这时候就需要准备好离线符号 我们使用安装windbg时候自带的工具SymChk exe 微软的官方说明在下面 使用起来也很简单 下面是一个使用示例 使用 SymChk exe 实用程序下载 Windows S