<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [PATCH] llvm-pdbutil explain command fails due to unsigned long parser not existing"
   href="https://bugs.llvm.org/show_bug.cgi?id=41499">41499</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PATCH] llvm-pdbutil explain command fails due to unsigned long parser not existing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mike.auty@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21773" name="attach_21773" title="Patch to add unsigned long parser template for llvm-pdbutil explain">attachment 21773</a> <a href="attachment.cgi?id=21773&action=edit" title="Patch to add unsigned long parser template for llvm-pdbutil explain">[details]</a></span>
Patch to add unsigned long parser template for llvm-pdbutil explain

Hiya,

Attempting to use llvm-pdbutil explain failed with:


$ llvm-pdbutil explain -offset 0x0 some.pdb
llvm-pdbutil: for the -offset option: Cannot find option named '0x0'!


I also noticed that other items which take a value have an = symbol after them
in the help, but not so for offset.  I checked the code and couldn't see why it
wouldn't work and a near-identical list of uints (such as dump-id for another
section) would work.  Then I realized that all the other lists were uint32_t,
but that explain's offsets were uint64_t.  I believe explain is the only place
this occurs which is why I filed it under here.

I looked for a uint64_t parser, but could only find an unsigned long long
parser, and an unsigned long parser.  Some more digging revealed that compilers
on x64 do not convert uint64_t to unsigned long long on those platforms, but to
unsigned long.  I added an unsigned long parser (patch attached) and the
explain parser started giving me the expected output:


Explaining file offset 0 of file '/path/to/some.pdb'.
Block:Offset = 0:0000.
Address is in block 0 (allocated).
  This corresponds to offset 0 of the MSF super block, 
  which is part of the MSF file magic.


I don't know if that's the best way of resolving the issue, or if it should be
filed under a different component.  It could be that the parser template should
actually be uint64_t rather than unsigned long long, but I didn't want to
disrupt anything that currently worked (and my C++ is rudimentary at best), so
I just added the unsigned long parser in addition to the existing one.  Let me
know if there's any additional information required...  5:)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>