Jump to content

  • Log In with Google      Sign In   
  • Create Account


brx

Member Since 28 Jan 2011
Offline Last Active Today, 06:00 AM
*****

Topics I've Started

Visual Studio 2012 Natvis files

17 December 2012 - 01:26 PM

So... this is my final attempt.

I've tried stackoverflow:
http://stackoverflow.com/questions/13748209/visual-studio-2012-natvis-skip-indexlistitems

I've tried the msdn forums:
http://social.msdn.microsoft.com/Forums/en-US/Offtopic/thread/5b788606-1dfc-4bdd-a67c-451f1dba8dcb
but so far I've received no help...

So, with VS2012 the new concept of natvis files for visualizations inside the debugger has been introduced... So far the Qt developers have failed to update their VS-plugin to work with VS2012, so I am trying to roll my own... It seems like I've gotten most of what I need to work, but I'm having a big problem with the QHash class. This is what I have so far:

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

  <Type Name="QString">
<DisplayString>{d->data,su}</DisplayString>
<StringView>d->data,su</StringView>
  </Type>

  <Type Name="QByteArray">
<DisplayString>{d->data,s}</DisplayString>
  </Type>

  <Type Name="QList&amp;amp;lt;*&amp;amp;gt;">
    <AlternativeType Name="QQueue&amp;amp;lt;*&amp;amp;gt;" />
<DisplayString>{{size = {d->end - d->begin}}}</DisplayString>
<Expand>
<Item Name="[size]">d->end - d->begin</Item>
<IndexListItems>
  <Size>d->end - d->begin</Size>
  <ValueNode>($T1*)((d->array + d->begin)[$i])</ValueNode>
</IndexListItems>
</Expand>
  </Type>

<Type Name="QVector&amp;amp;lt;*&amp;amp;gt;">
<DisplayString>{{size = {d->size}}}</DisplayString>
<Expand>
<Item Name="[size]">d->size</Item>
<Item Name="[capacity]">d->alloc</Item>
<IndexListItems>
  <Size>d->size</Size>
  <ValueNode>(p->array[$i])</ValueNode>
</IndexListItems>
</Expand>
  </Type>
<Type Name="QHashNode&amp;amp;lt;*,*&amp;amp;gt;">
<DisplayString Condition="next->next == 0">{{ key={key} value={value} h={h}}}</DisplayString>
<DisplayString>{{ key={key} value={value} h={h} withCollision }}</DisplayString>
<Expand>
  <Item Name="NextNode">reinterpret_cast&amp;amp;lt;QHashNode&amp;amp;lt;$T1,$T2&amp;amp;gt; *&amp;amp;gt;(next)</Item>
</Expand>
</Type>
<Type Name="QHash&amp;amp;lt;*,*&amp;amp;gt;">
    <DisplayString>{{ size={d->size} buckets={d->numBuckets} }}</DisplayString>
    <Expand>
	    <IndexListItems>
		    <Size>d->numBuckets</Size>
   <ValueNode Condition="reinterpret_cast&amp;amp;lt;QHashNode&amp;amp;lt;$T1,$T2&amp;amp;gt; *&amp;amp;gt;(d->buckets[$i]) != e">reinterpret_cast&amp;amp;lt;QHashNode&amp;amp;lt;$T1,$T2&amp;amp;gt; *&amp;amp;gt;(d->buckets[$i])</ValueNode>
	    </IndexListItems>
    </Expand>
</Type>
<Type Name="QSet&amp;amp;lt;*&amp;amp;gt;">
    <DisplayString>{{ size={q_hash.d->size} buckets={q_hash.d->numBuckets} }}</DisplayString>
    <Expand>
	    <IndexListItems>
		    <Size>q_hash.d->numBuckets</Size>
   <ValueNode Condition="reinterpret_cast&amp;amp;lt;QHashNode&amp;amp;lt;$T1,QHashDummyValue&amp;amp;gt; *&amp;amp;gt;(q_hash.d->buckets[$i]) != q_hash.e">reinterpret_cast&amp;amp;lt;QHashNode&amp;amp;lt;$T1,QHashDummyValue&amp;amp;gt; *&amp;amp;gt;(q_hash.d->buckets[$i])</ValueNode>

	    </IndexListItems>
    </Expand>
</Type>
<Type Name="QMapNode&amp;amp;lt;*,*&amp;amp;gt;">
<DisplayString>{{ key={key} value={value} }}</DisplayString>

</Type>
<Type Name="QMap&amp;amp;lt;*,*&amp;amp;gt;">
  <DisplayString>{{size = {d->size}}}</DisplayString>
  <Expand>
<LinkedListItems>
	  <Size>d->size</Size>
	  <HeadPointer>d->forward[0]</HeadPointer>
	  <NextPointer>forward[0]</NextPointer>
	  <ValueNode>reinterpret_cast&amp;amp;lt;QMapNode&amp;amp;lt;$T1,$T2&amp;amp;gt;* &amp;amp;gt;(reinterpret_cast&amp;amp;lt;char*&amp;amp;gt;(this) - (sizeof(QMapPayloadNode&amp;amp;lt;$T1,$T2&amp;amp;gt;) - sizeof(QMapData::Node*)))</ValueNode>
    </LinkedListItems>
</Expand>
</Type>

</AutoVisualizer>
It seems to me like all classes work as expected. But the QHash class pre-allocates some memory and only fills some if it. (The important part is the QHash and QHashNode part)

Now, my question is, whether anybody know if there is a way to just skip those values in the debugger display?

With the nativs file above, I get a lot of entries that are displayed as "<unable to display value>". With the old autoexp.dat files, values that didn't match a rule, were not displayed at all (see the linked posts). Does anybody happen to know a way to achieve the same in the new natvis format?

I am pretty pissed at the Microsoft support for saying it is a Qt problem, even though it is clearly reproducable without using Qt. So if you are running into a similar problem (or you are actually using Qt), I'd appreciate if you tell the MSDN guys that this IS a problem, and that you'd like this feature to be included (if itsn't already and I just don't know how to and the MSDN guys don't wan't to share - which I doubt).

[java] Eclipse's JarRsrcLoader and Implementation-Version attribute in manifest files

31 May 2011 - 03:52 AM

For my project I need to use the jarinjar loader of eclipse for deployment because some of the third party jars I am using need to keep their signature (namely the bouncycastle encryption library).

Now I want to add package versioning information. But after adding the "Implementation-Version" attribute to my ant file
getClass().getPackage().getImplementationVersion()
still returns null.

I have the feeling that since my main-class is the JarRsrcLoader instead of my actual main-class the Implementation-Version is not passed through to my actual package. Does anybody have an idea how to solve this, or what I am doing wrong?

Here's the excerpt of my ant build file (slightly changed for NDA reasons and for brevity ):

<jar destfile="mytool${rmversion}${buildtime}.jar">
  <manifest>
	<attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
	<attribute name="Rsrc-Main-Class" value="com.fs.Server"/>
	<attribute name="Class-Path" value="."/>
	<attribute name="Rsrc-Class-Path" value="./ bcprov-jdk16-145.jar"/>
	<attribute name="Implementation-Version" value="${rmversion}${buildtime}"/>
  </manifest>
  <zipfileset src="jar-in-jar-loader.zip"/>
  <fileset dir="work" />
  <fileset dir="WEB-INF/classes" />
  <fileset dir="WEB-INF/lib" />
</jar>
The properties rmversion and buildtime are set correctly. I also tried to embed the Implementation-Version attribute inside a section with the name of the package I want to add the information to.

Any help is highly appreciated.

PARTNERS