Thread overview
AAs
Apr 27, 2005
John Demme
Apr 27, 2005
Ben Hinkle
Apr 27, 2005
John Demme
Apr 27, 2005
Ben Hinkle
Apr 27, 2005
Ant
April 27, 2005
I don't understand how Associative Arrays work.  I'm getting a segfault
on a line that puts a new entry in an AA.  Here's the stacktrace:
#0  0x00000009 in ?? ()
#1  0x08072e80 in ti_C.TypeInfo_C.compare(void*, void*) ()
#2  0x0804ed1d in
com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getLinkedChildrenOf(com.neuralnexus.nnnode.INode, com.neuralnexus.nnnode.INode) ()
#3  0x08066ed0 in
com.neuralnexus.client.ConnectorNode.getAttribute(com.neuralnexus.nnnode.INode) ()
#4  0x08066e81 in
com.neuralnexus.client.ConnectorNode.getFirstAttribute(com.neuralnexus.nnnode.INode) ()
#5  0x08066e3e in
com.neuralnexus.client.ConnectorNode.getFirstAttributeString(com.neuralnexus.nnnode.INode) ()
#6  0x08072e02 in ti_C.TypeInfo_C.getHash(void*) ()
#7  0x08067fac in _aaGet ()
#8  0x0804a1b3 in
com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getNodeStruct(mango.xml.rpc.objects.MethodResponse) ()
#9  0x0804bdd5 in _aaApply210treewalkerFPS3aaA3aaAZi ()
#10 0x0806857d in _aaApply2 ()
#11 0x0804f77a in
com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getNodeStruct(mango.xml.rpc.objects.MethodResponse) ()
#12 0x0804f16c in
com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getRelationships(com.neuralnexus.nnnode.INode) ()
#13 0x08066f69 in
com.neuralnexus.client.ConnectorNode.getRelationships() ()
#14 0x080540a0 in D main ()
#15 0x08067eaf in main ()

Obviously, it's my own code that's segfaulting, but I don't understand why all these functions are being run.  The line that puts the new entry in the AA is in frame #11- getNodeStruct.  The key value overrides toHash, opEquals, and opCmp.

Can someone explain this stack trace?

Thanks
John Demme

April 27, 2005
"John Demme" <me@teqdruid.com> wrote in message news:1114572104.9518.9.camel@localhost.localdomain...
>I don't understand how Associative Arrays work.  I'm getting a segfault
> on a line that puts a new entry in an AA.  Here's the stacktrace:
> #0  0x00000009 in ?? ()
> #1  0x08072e80 in ti_C.TypeInfo_C.compare(void*, void*) ()
> #2  0x0804ed1d in
> com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getLinkedChildrenOf(com.neuralnexus.nnnode.INode,
> com.neuralnexus.nnnode.INode) ()
> #3  0x08066ed0 in
> com.neuralnexus.client.ConnectorNode.getAttribute(com.neuralnexus.nnnode.INode)
> ()
> #4  0x08066e81 in
> com.neuralnexus.client.ConnectorNode.getFirstAttribute(com.neuralnexus.nnnode.INode)
> ()
> #5  0x08066e3e in
> com.neuralnexus.client.ConnectorNode.getFirstAttributeString(com.neuralnexus.nnnode.INode)
> ()
> #6  0x08072e02 in ti_C.TypeInfo_C.getHash(void*) ()
> #7  0x08067fac in _aaGet ()
> #8  0x0804a1b3 in
> com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getNodeStruct(mango.xml.rpc.objects.MethodResponse)
> ()
> #9  0x0804bdd5 in _aaApply210treewalkerFPS3aaA3aaAZi ()
> #10 0x0806857d in _aaApply2 ()
> #11 0x0804f77a in
> com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getNodeStruct(mango.xml.rpc.objects.MethodResponse)
> ()
> #12 0x0804f16c in
> com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getRelationships(com.neuralnexus.nnnode.INode)
> ()
> #13 0x08066f69 in
> com.neuralnexus.client.ConnectorNode.getRelationships() ()
> #14 0x080540a0 in D main ()
> #15 0x08067eaf in main ()
>
> Obviously, it's my own code that's segfaulting, but I don't understand why all these functions are being run.  The line that puts the new entry in the AA is in frame #11- getNodeStruct.  The key value overrides toHash, opEquals, and opCmp.
>
> Can someone explain this stack trace?
>
> Thanks
> John Demme

Is the key type an interface? I notice the inputs to getLinkedChildrenOf are
INode which looks like interfaces. The ti_C.TypeInfo_C.compare is the
comparison function for Object references. So it looks like the interface
reference is being cast to void* and then to Object* and jumping to a random
routine where Object.opCmp would be.
That's just a guess. More information like a code example or dmd version
info would help.


April 27, 2005
In article <1114572104.9518.9.camel@localhost.localdomain>, John Demme says...
>
>I don't understand how Associative Arrays work.  I'm getting a segfault on a line that puts a new entry in an AA.  Here's the stacktrace:

Is this windows? did you try running it on linux?

Ant


April 27, 2005
Sorry.  Forgot the usual stuff.  This is DMD .120 on Linux.  Both the
key and the values are, in fact, interfaces.  Below is the code for the
INode interface:
public interface INode
{
	public INode createChild();
	public void makeChild(INode child);
	public UText getFirstAttributeString(INode attributeType);
	public void addAttribute(INode attributeType, UText string);
	public void setAttribute(INode attributeType, UText string);
	public INode getFirstAttribute(INode attributeType);
	public INode[] getAttribute(INode attributeType);
	public NNNodeID getID();
	public INode[] getImmediateChildren();
	public INode[] getImmediateParents();
	public INode[] getRelatedNodes();
	public void setData(NNNodeData data);
	public bool isChildOf(INode searchParent);
	public NNNodeData getData();
	public INode[INode] getRelationships();

	public int opEquals(Object o);
	public int opCmp(Object o);
	public uint toHash();
}

I have a Class called ConnectorNode which implements this INode.  Here's
the code that does the AA stuff (my debug version)
	protected INode[INode] getNodeStruct(MethodResponse mr) {
		Value[] params = mr.getParams();
		assert(params.length == 1);
		assert(params[0].getValueType() == ValueType.Struct);
		Struct s = params[0].getStruct();
		INode[INode] table;
		foreach (UText key, Value value; s.getValues()) {
			NNNodeID kid = new nnNodeID(key);
			writefln("a");
			ConnectorNode kn = new ConnectorNode(kid, this);
			writefln("b");
			ConnectorNode vn = new ConnectorNode(new NNNodeID(value.getString()),
this);
			writefln("c");
			INode kin = kn;
			writefln("d");
			INode vin = vn;
			writefln("e");
			table[kin] = vin;
			writefln("f");
		}
		return table;
	}

Any ideas?

Thanks
John Demme

On Wed, 2005-04-27 at 08:50 -0400, Ben Hinkle wrote:
> "John Demme" <me@teqdruid.com> wrote in message news:1114572104.9518.9.camel@localhost.localdomain...
> >I don't understand how Associative Arrays work.  I'm getting a segfault
> > on a line that puts a new entry in an AA.  Here's the stacktrace:
> > #0  0x00000009 in ?? ()
> > #1  0x08072e80 in ti_C.TypeInfo_C.compare(void*, void*) ()
> > #2  0x0804ed1d in
> > com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getLinkedChildrenOf(com.neuralnexus.nnnode.INode,
> > com.neuralnexus.nnnode.INode) ()
> > #3  0x08066ed0 in
> > com.neuralnexus.client.ConnectorNode.getAttribute(com.neuralnexus.nnnode.INode)
> > ()
> > #4  0x08066e81 in
> > com.neuralnexus.client.ConnectorNode.getFirstAttribute(com.neuralnexus.nnnode.INode)
> > ()
> > #5  0x08066e3e in
> > com.neuralnexus.client.ConnectorNode.getFirstAttributeString(com.neuralnexus.nnnode.INode)
> > ()
> > #6  0x08072e02 in ti_C.TypeInfo_C.getHash(void*) ()
> > #7  0x08067fac in _aaGet ()
> > #8  0x0804a1b3 in
> > com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getNodeStruct(mango.xml.rpc.objects.MethodResponse)
> > ()
> > #9  0x0804bdd5 in _aaApply210treewalkerFPS3aaA3aaAZi ()
> > #10 0x0806857d in _aaApply2 ()
> > #11 0x0804f77a in
> > com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getNodeStruct(mango.xml.rpc.objects.MethodResponse)
> > ()
> > #12 0x0804f16c in
> > com.neuralnexus.xmlrpc.connector.XmlRpcConnector.getRelationships(com.neuralnexus.nnnode.INode)
> > ()
> > #13 0x08066f69 in
> > com.neuralnexus.client.ConnectorNode.getRelationships() ()
> > #14 0x080540a0 in D main ()
> > #15 0x08067eaf in main ()
> >
> > Obviously, it's my own code that's segfaulting, but I don't understand why all these functions are being run.  The line that puts the new entry in the AA is in frame #11- getNodeStruct.  The key value overrides toHash, opEquals, and opCmp.
> >
> > Can someone explain this stack trace?
> >
> > Thanks
> > John Demme
> 
> Is the key type an interface? I notice the inputs to getLinkedChildrenOf are
> INode which looks like interfaces. The ti_C.TypeInfo_C.compare is the
> comparison function for Object references. So it looks like the interface
> reference is being cast to void* and then to Object* and jumping to a random
> routine where Object.opCmp would be.
> That's just a guess. More information like a code example or dmd version
> info would help.
> 
> 

April 27, 2005
"John Demme" <me@teqdruid.com> wrote in message news:1114624472.31952.3.camel@localhost.localdomain...
> Sorry.  Forgot the usual stuff.  This is DMD .120 on Linux.  Both the key and the values are, in fact, interfaces.  Below is the code for the INode interface:
[snip]
>
> Any ideas?

nothing jumps out. I tried using an interface key in an AA on Windows dmd121 and it worked ok.