[PATCH] D28635: [libFuzzer] Portably disassemble and find calls to "sanitizer_cov_trace_pc_guard".

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 13:28:53 PST 2017

Fair enough.  There is even more we can do in case this isn't sufficient
(you can see clang if you're curious, but there are various environment
variables and registry keys we could look at if we wanted to try *really*
hard to find dumpbin).  But it's probably not worth the trouble unless this
turns out to be a real problem.

On Tue, Jan 17, 2017 at 1:14 PM Marcos Pividori <mpividori at google.com>

> @zturner, yes, it is not well documented. Because of that I propose yo
> consider `dumpbin` first, and `link  /dump /disasm` as second option in
> case we don't find `dumpbin`.
> On Tue, Jan 17, 2017 at 10:00 AM, Zachary Turner <zturner at google.com>
> wrote:
> By `link`, do you mean the MSVC  linker?  I didn't know it supported /dump
> and /disasm options, and when I run link /help I don't see those options
> listed.
> On Fri, Jan 13, 2017 at 1:53 PM Marcos Pividori via Phabricator <
> reviews at reviews.llvm.org> wrote:
> mpividori added inline comments.
> ================
> Comment at: lib/Fuzzer/FuzzerTracePC.cpp:162
> +      size_t PcOffsetEnd = S.find(':');
> +      if (PcOffsetEnd == std::string::npos) continue;
> +      S.resize(PcOffsetEnd);
> ----------------
> zturner wrote:
> > Can you put the `continue` on a new line?
> Ok, I will do that. But, in line 169, the continue is in the same line
> too. Do you want me to update that too?
> ================
> Comment at: lib/Fuzzer/FuzzerUtilWindows.cpp:181
> +std::string DisassembleCmd(const std::string &FileName) {
> +  return "dumpbin /disasm " + FileName;
> +}
> ----------------
> zturner wrote:
> > `dumpbin` is not guaranteed to be in the user's path.  Is this going to
> cause a problem?  Also I believe `dumpbin` will use Intel syntax for the
> disassembly.  Does objdump use AT&T syntax by default?  If so, will this
> cause a problem?
> @zturner you are right. I didn't realize of that since I was using a
> terminal with the VS environment.
> We can use :  `link /dump /disasm` , which is included in PATH, but I
> couldn't find information if the `/dump` option is a new option or it is
> also included in old versions.
> Also, I think we should consider the case when users only using llvm
> tools, so in that case we could look for: `llvm-objdump`
> So, I propose to do this:
> First: See if `dumpbin` is present in PATH,
> Else: See if `link`  is present in PATH,
> Else: See if `llvm-objdump` is present in PATH,
> Else: Fail
> Would you agree?
> Repository:
>   rL LLVM
> https://reviews.llvm.org/D28635
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170117/c7a0395e/attachment.html>

More information about the llvm-commits mailing list