追踪哪个依赖项包含 SSE 指令

发布于 2024-11-07 19:58:55 字数 234 浏览 0 评论 0原文

我们的一位客户需要在没有 SSE 的情况下构建我们的程序,因为他使用的是相当旧的硬件。我的问题是,即使我全面修改我们的项目设置以取消所有库和应用程序的 SSE 设置。二进制文件中似乎仍然存在依赖项,该依赖项是使用 SSE 指令编译的,导致应用程序崩溃。

我的问题是:有没有办法获取二进制文件或库并检测它是否包含特定版本 SSE 的 SSE 指令?

我们使用的是 VS,语言是 C++,因此任何适用于该工具集的工具都会很棒。

One of our customers needs a build of our program without SSE as he's on quite old hardware. My problem is that even if I modify our project settings across the board to unset SSE for all libraries & binaries it would seem there's still a dependency somewhere which is compiled with SSE instructions on, causing the application to crash.

My questions is: Is there a way to take a binary or library and detect if it contains SSE instructions of a specific version of SSE or not?

We're using VS and the language is C++, so any tool applicable to that toolset would be terrific.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

合约呢 2024-11-14 19:58:55

反汇编所有涉及的二进制文件,然后在反汇编中搜索 SSE 指令助记符。

Disassemble all involved binaries, then do a search for SSE instruction mnemonics in the disassemblies.

风启觞 2024-11-14 19:58:55

由于您已经在编译器中关闭了 SSE 指令生成,因此问题出在静态库之一上。要缩小范围,基本上有两种方法:

  1. 反汇编您链接到的 .lib 或 .obj 文件。这实际上不是一个简单的解决方案,除非您碰巧能够使用专门的工具。一般来说,反汇编是一个非常复杂的过程,因为工具必须找出代码中的所有执行路径,而不实际运行它。这样做是为了将数据与代码分开。完成此类任务的最佳工具是 IDA Pro。反汇编后,您可以通过在 IDA Pro 中编写宏或将结果导出到文本文件并仅使用 grep 来搜索 SSE 指令。
  2. 一种更简单的方法是运行程序并找出崩溃的位置。您需要做两件事才能继续:找出导致崩溃的指令的地址,并使用“映射文件”来找出它所属的位置。后者很简单:在 Visual Studio 中,您必须设置编译器和链接器调试选项来生成映射文件。该文件基本上会告诉您可执行文件中所有函数的地址。查找崩溃地址通常很容易,因为 Windows 会提示您并提示类似应用程序错误指令
    在“0x635de077”...
    。您使用该地址并查看映射文件以查看它属于哪个函数。或者,您可以在调试器中运行该程序。当程序崩溃时,调试器会显示程序停止的位置。

编辑:反汇编 .lib 文件的另一种方法是使用附带的 DUMPBIN 实用程序与视觉工作室。另外,STATUS_ACCESS_DENIED 建议的小型转储方法是一个好主意。

Since you have already turned off the SSE instruction generation in the compiler, the problem is in one of the static libraries. To narrow it down, basically you have 2 ways go:

  1. Disassemble the .lib or .obj files you are linking to. It is not actually an easy solution unless you happen to have access to specialized tools. Generally, disassembly is a very complex process since the tool has to figure out all the execution paths in the code without actually running it. It does it to separate the data from the code. The best tool for such tasks is IDA Pro. After disassembly you can search for the SSE instructions either by writing a macro inside IDA Pro or exporting the results to text files and just using grep.
  2. A simpler approach is to run the program and find out where it crashes. You'll need two things to continue: finding out the address of the instruction that causes the crash and a "map file" to find out where it belongs to. The latter is simple: in Visual studio, you have to set the compiler AND the linker debug options to generate a map file. This file will basically tell you the address of all and every function in the executable file. Finding the crash address is usually easy as Windows will prompt you and says something like Application error The instruction
    at "0x635de077"...
    . You use that address and look at the map file to see in which function it belongs. Alternatively, you can run the program inside a debugger. When program crashes, the debugger shows you where program has stopped.

edit: Another method to get a disassembly of a .lib files is to use the DUMPBIN utility that comes with Visual Studio. Also, the minidump method suggested by STATUS_ACCESS_DENIED is an excellent idea.

横笛休吹塞上声 2024-11-14 19:58:55

使用此处所述的方法从客户处获取小型转储文件。即让客户运行您的构建。一旦崩溃,应该创建一个小型转储文件,您可以使用它(事后分析)来准确分析崩溃的位置。它与调试符号(和/或映射文件)一起,实际上会告诉您造成严重破坏的确切库。

这归结为 AlefSin 建议的解决方案中的第 2 点。但是,客户不必运行调试器。对于内核模式驱动程序,这通常甚至是获取有关问题的有意义信息的唯一方法。不过,用户模式代码也存在相同的功能。使用它。

Use a method as described here in order to get a minidump file from the customer. I.e. have the customer run your build. Once it crashes a minidump file should be created and you can use it - post-mortem - to analyze exactly where it crashed. Which, together with the debug symbols (and/or map file), will actually tell you the exact library that caused havoc.

It boils down to point 2 in the solution suggested by AlefSin. However, the customer will not have to run a debugger. For kernel mode drivers this is usually even the only means to get meaningful information about problems. The same facility exists for user mode code, though. Use it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文