Jerry Feldman wrote:
On Wed, 25 Aug 2004 16:00:16 +0100 expatriate
wrote: Hello VxWorks literati
We're considering moving to Linux and one of the questions that was asked is: How do you emulate what's best of the VxWorks shell?
In VxWorks, the shell interpreter can call any library function currently loaded and execute it on the spot. For example, one can type
at the shell:
printf("Val = %d\n",x)
and the library function printf will be executed and the current value of x will be searched in the symbol table and passed on to the printf function.
Although this is a trivial example, perhaps the intended use would be more appropriate. Suppose a function called "foo(int a, double b)"
exists in a shared library used by a currently executing process. Is there an "easy" way to ask the process to search its symbol table and execute foo(a,b) for us?
Perhaps there's no easy way and each process now needs some form of IPC glued to it so we can funnel a command into it. Is there a Linux command to get the function pointer from a symbol table search?
Am I making any sense?
I think I understand what you want, but I don't know VxWorks. The gdb debugger allows you to examine any value and call any function. It also allows you to examine any variable in your code. You can use the GDB call command to call any function in any library loaded with your program. (gdb) display x 1: x = 5 (gdb) call time(0) $2 = 1093463095
There are several very good IDEs for Linux. I like DDD which is layered on gdb. I'm not sure this is what you want, but you might take a look at IDEs such as Kdevelop.
Unfortunately gdb is a debugger whose main task is to figure out what's wrong with a program. The VxWorks shell's main task is to find out what's wrong with the system. One can invoke gdb within the VxWorks environment but the power of the shell is the ability to make any function call. For example, imagine you could type the following in a bash shell: fil = fopen("/dev/myDriver","r") ioctl(fil,0x55) val = malloc(1000) stat = read(fil,val,100) printf("%s\n",val) Of course this is an unusual example. Our field service engineers use the VxWorks shell to call functions we have written (and pass arguments to them) in order to troubleshoot our machines. If we migrate to Linux, we would have to provide similar functionality and it appears that we would have to write a master control program that takes in commands and doles them out. ---sigh--- clerical engineering.