Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VXWorks Newbie Question

Status
Not open for further replies.

paul51

Programmer
May 19, 2000
38
0
0
US
Hello,

I am debugging an IC that has is running VxWorks. Using the lkup command, I am able to find some functions that I would like to run.

An example is:

SomeClass::SomeTest(var1,var2)

I am unable to run the SomeTest.
The response I receive is that it is not a known symbol.

Does anyone know how to start this SomeTest?

Thanks,
Paul
 
If a method is part of a class, as it is here, then you cannot execute it from the shell as it has no reference to the object itself.
 
Thanks for the info.

Why does it appear from the lkup command if there is not reference to it?

Is there a way to load it into the shell?

Thanks
 
I think you missed the meaning, there is a reference to the method, i.e. there is a symbol in the symbol table, that is all. A class however is like a template, you need to create an object from that template to work on, and those methods need to know which object it's using.

Think of it this way, in your example, SomeClass may have a member variable called x that defaults to 10, so when I create an object of that class, it contains a reference to a variable x of value 10. But there may also be a method
SomeClass::SetX(var1) that I can call to change x to some other value var1, say 20.

Now if SomeClass::SomeTest(var1,var2) takes var1, adds it to var2, then adds x, you can see that when you call SomeTest() you also need to tell it which object you're calling it from (because it needs to know what the value of x is). There can be 1000's of objects of type SomeClass created in the system, each of which may have set x to a different value.

It's not (that I know of) possible to give a reference to the particular object you want to use, to the direct method call.
 
Thanks again. I think I am getting closer to understanding. A last question, if you do not mind (I do appreciate the help!)


There are other commands that I found with the lookup command that I am able to run. They do not contain the ::. Do you have any idea why these commands are runnable?

Also, you mentioned that I need to create an object. Why not

SomeClass S1;
S1.SomeTest;

Thanks.
 
Anything with a :: is C++, anything with out it is a C function, therefore callable from the shell.

Why not? Because that's code. You'll need to compile and download it of course. But even then, what you've written will execute SomeTest on your object S1, which will tell you little of the system.

BTW, it's ill-advised to randomly execute functions from the shell.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top