The VxWorks symbol table, also known as the kernel symbol table (kernel), stores functions, variables, and constant information for each module in the program (also includes variables created by the shell). The symbol table consists of two types, the system symbol table and the user symbol table.
system Symbol Table:
The System symbol table contains the names and addresses of all global symbols. It will be used in the following 4 functions:
1. Kernel Object-module Loader (dynamically loading object files to the kernel)
2. Debugging Facilities (Debug function)
3. Kernel Shell (kernel shell)
4. WDB Target Agent (WDB tool)
There are two types of system symbol tables, including the build-in symbol table and the detach symbol table. build-in symbol table:
The build-in symbol table copies the symbolic information into code and then co-compiles the chain into a mirror.
1. The MAKESYMTBL.TCL tool generates symbolic information and copies it in the STANDTBL array of the SYMTBL.C file, as follows.
SYMBOL standtbl [92569] =
{
{{NULL}, ' Access_id_taskid ', (char*) &access_id_taskid, 0, 0, Sym_global | Sym_data},
{{NULL}, ' Access_id_cli_init ', (char*) access_id_cli_init, 0, 0, Sym_global | Sym_text},
{{NULL}, ' Access_id_commandinstall ', (char*) access_id_commandinstall, 0, 0, Sym_global | Sym_text},
......
{{NULL}, ' Zsend_ipv6_delete_multipath ', (char*) zsend_ipv6_delete_multipath, 0, 0, Sym_global | Sym_text},
{{NULL}, ' Zstrdup ', (char*) zstrdup, 0, 0, Sym_global | Sym_text},
};
The global array standtbl type is defined as follows, containing the name and address of the function or global variable, and the last type indicates what type of data it is:
typedef struct SYMBOL/* symbol-entry in symbol table */
{
Sl_node Namehnode; /* Hash node (must come first) */
char * name; /* pointer to symbol name */
Sym_value VALUE; /* Symbol Value */
Sym_ref Symref; /* Id of module, or predefined symref. */
Sym_group GROUP; /* Symbol Group */
Sym_type TYPE; /* Symbol Type */
} SYMBOL;
2. The symtbl.c file is properly compiled and linked to the VxWorks image, and the system symbol table is generated using the STANDTBL array when the program runs. Detach symbol Table:
The detach symbol table is compiled into a separate object file (Vxworks.sym file), which is then loaded into memory.
Shell Lookup symbol table:
You can find the symbol in the shell by using the Lkup function or the Symshow function (the related function is defined in the Symlib library):
-Lkup "Moduleshow"
Moduleshow 0x004b2c7c Text
Moduleshowinit 0x004b2a14 Text
Value = 0 = 0x0
Symshow syssymtbl, "Moduleshow"
Moduleshowinit 0x004b2a14 Text
Moduleshow 0x004b2c7c Text
Value = 0 = 0x0
User Symbol table:
For security purposes, user-defined symbols can be placed in a system symbol table instead of a user symbol table. The Symtblcreate function can create a symbol table that references the definition of the Symlib library.
This article refers to the official document "VxWorks Kernel Shell Users Guide 6.9" fourth chapter kernel Symbol Table, for their own summary, may understand wrong, for reference only.