microsoft / microsoft/vscode-cpptools

natvis is failing to read conditional with variables with Eigen

Offen
#3,164 2 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@pieandcakes arbeitet bereits daran.

Seit 13.2.2019.

bug debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

I am running Visual Studio 2017 15.9.5
I am trying to make an addition to a natvis for the Eigen library available here

I am basically making a variant of: <Type Name="Eigen::Matrix&lt;*,-1,-1,*,*,*&gt;"> for Eigen::Map.
I used the code already in place in the natvis as a platform:

  <Type Name="Eigen::Map&lt;Eigen::Matrix&lt;*,-1,-1,*,*,*&gt;,*,*&gt;">
    <DisplayString Condition="m_data == 0">empty</DisplayString>
    <DisplayString Condition="m_data != 0">Map[{m_rows.m_value}, {m_cols.m_value}] (dynamic matrix)</DisplayString>
    <Expand>
      <ArrayItems Condition="Flags%2"> <!-- row major layout -->
        <Rank>2</Rank>
        <Size>$i==0 ? m_rows.m_value : m_cols.m_value</Size>
        <ValuePointer>m_data</ValuePointer>
      </ArrayItems>
      <ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
        <Direction>Backward</Direction>
        <Rank>2</Rank>
        <Size>$i==0 ? m_rows.m_value : m_cols.m_value</Size>
        <ValuePointer>m_data</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

Using trial and error, I know that my issue is with the line (in both locations):

<Size>$i==0 ? m_rows.m_value : m_cols.m_value</Size>

This is because if I replace either m_rows.m_value or m_cols.m_value with some constant integer, then it runs fine but not the way I want it to run, of course.

How do I get this to work?
I also have a stackoverflow questions here.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.