swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copy an object ....


From: Benedikt Stefansson
Subject: Re: copy an object ....
Date: Sun, 11 Oct 1998 17:19:24 -0700

> when I call:
> [[list getMember] aMethod];
> then it works OK, here aMethod is a method for the
> respective object.
> However, if I use the following procedure:
> id ob;
> ob = [list getMember];
> [ob aMethod];
> it will not work anymore. I can not figure out why?

The quick answer to your question is that there is no difference between
the two versions of the call to aMethod, whether you create an
intermediate variable ob or nest the two calls as in the first version.

I'm not going to state the obvious, which is that -getMember is not a
method in List, I assume you implemented it yourself.  Often these types
of problems have a very silly answer, such as that you actually changed
something in the getMember function or something changed otherwise in
the program so that getMember returns nil or an object that doesn't
respond to -aMethod.

Put in a printf function between the call to the list and call to ob to
investigate some property of ob or use gdb. You can for example break on
the ob = [list getMember] line and then issue xprint(ob) to see the
class info for ob. The command sequence would be

unix-promt$ gdb yourprogram
(GDB blurb appears)
> break Name.m:X (where Name is the object file containing the code and
X line #)
> run
(after gdb breaks on the line:)
> xprint(ob)

An ObjC aware version of GDB is available on the Swarm website, both as
binary for Redhat Linux or as source code. It doesn't work with output
from GCC 2.8.x or egcs however. There is a GDB somewhere in the
distribution for Cygnus or Swarm for Win/NT, but it isn't ObjC aware. A
doc on the Swarm website shows how to get around that with clever (but
tedious) tricks.

Regards,
-Benedikt

----------------
Benedikt Stefansson                 address@hidden
Department of Economics, UCLA       Fax. (310) 825-9528
Los Angeles, CA 90095-1477          Tel. (310) 825-1777



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]