Symbol Table of VxWorks

Source: Internet
Author: User
Tags error code

symbol Table Initialization The           symbol table is used to establish the relationship between symbolic names, types, and values. Where the name is a null-terminated arbitrary string; the type is an integer that identifies the various symbols; the value is a character pointer. The symbol table is primarily used as the basis for loading the target module, but it is used at any time when the name and value associations are required. In the           operation system, there are two symbol table structures syssymtbl and STATSYMTBL in general. SYSSYMTBL is a system symbol table for the target machine, and symbols for the symbol module of the target module dynamically loaded by the program or Tshell are added to the symbol table, and the SYSSYMTBL and statsymtbl two identity itself pages are included in the system symbol table. The STATSYMTBL contains errno information, which must be included if the Printerrno command is used in Tshell. The target server of the          host uses only one symbol table to see the TGTSYMTBL access through the global variable.          vxworks the symbol table function library Symlib, which provides related functions for symbol table operations. System symbol table allows the same name conflict, the same name symbol back to join the symbol table without error, when referencing the symbol, the system uses Symfindbyname to find the default, so the most recently added symbols are always found first, instead of the old symbol to complete the reference. The presence of a symbol with the same name also poses another problem, and cannot ensure that the found symbol is loaded by itself, i.e. the group number cannot be guaranteed. The Host Symlib library function is used to maintain the host symbol table TGTSYMTBL.           VxWorks symbol table with compiler symbol table bar, VxWorks symbol table is dynamically present in the system, The functions provided by Symlib are maintained, and symbols can be added and removed during operation, mainly for dynamic loading of the target module, regardless of the format of the target module. While the symbol table in the compiler is static, it is generated and used by the compiler and the connector when the program image is established, primarily for static parsing of symbols, to help establish the image, their format and the target type. Cross-debugger source code debugging, the page is supported by the static symbol table, this symbol table occupies a veryLarge program image space, which can be removed when the program is published (do not use the-G option).         VxWorks requires the host tool to do some preparatory work during image generation to create a system symbol table, Syssymtbl and Statsymtbl correspond to two host tools MakeSymTbl.exe and MakeStatTbl.exe, which are used to generate a symbol array to compile into the program image. Tool MakeSymTbl.exe is used to create an SYMTBL.C file containing an array of symbol types, containing the name, address, and type of all global symbols in the target module, the global array name is STANDTBL, and its size is standtblsize. stored in the data segment of the program image. The tool MakeStatTbl.exe is used to create a status code symbol array that contains the names and values of all status codes defined in the header file, with all status codes beginning with "S", as defined in the General library header file. , the global array name becomes STATTBL, and the size of STATTBLSIZE,STATSYMTBL is primarily used by the Printerrno function, or it can be used by the application to output state information that determines meaning and is stored in the data segment of the program image.          symbol table Initial mode has build-in and downloaded two ways, when using the built-in symbol table, when the symbol VxWorks part of the program image The download symbol table is separated from the VxWorks image, and the target machine downloads the sym file to get the symbol separately. If using the download symbol table, using the Host tool Xsym, generate the symbol module file Vxworks.sym, the same file as the normal target module, just no data and BSS segments, downloaded to the target machine, and the normal target module as dynamic loading, the symbol in the module is added to the system symbol table.          Target machine Symbol table when the dynamic loading, connection, and debugging of the auxiliary mechanism, the image has no symbol table does not affect the normal operation of the program, debugging, As long as the target module is not dynamically loaded from the target machine, the program image symbol is statically connected, the target machine can also be unsigned, and the host development tool uses the host symbol table TGTSYMTBL to complete the cross-debugging.         Symbol Table Synchronization The          host and target machine use different symbol tables, the various tools used on the host are not able to access all the content on the target machine, the tool is on the host Neither the host nor the target machine can directly access the symbolic information of the target agent when the server communicates with it. Both the host and the target machine maintain their own symbol table, when adding symbols, adding symbols to one of the tables, the symbols added on Wshell to the host symbol table, and the symbols added on the Tshell to the target machine symbol table, by default two tables are not shared. You can------include_sym_tbl_sync by adding a symbol table synchronization component so that the symbol is well-off between the host and the target machine, and the two symbol tables are updated synchronously. The           host and target machine use different symbol tables, the content of the two symbols table is the same when the system starts, when the target module is loaded dynamically, the two symbol tables are inconsistent. After loading the target module from Wshell, but want to reference the module symbol from Tshell, or after loading from Tshell, want to debug the module with the host tool, because Wshell or Tshell can not see the other loaded module, the following error may occur:             error:module contains undefined symbol             unresolved symbol             Fatal error:unresolvable symbol          To solve this problem you need to use the symbol table synchronization mechanism, VxWorks provides the Symsynclib library to complete the symbol table synchronization, the system is running, from the host or target machine added symbols can be seen by the other side, Symsynclib will create a synchronization task TSYMSYC on the target machine, the task is treated as a WTX tool and the target of the host Server is connected, and the symbol table is synchronized as soon as the task starts. If you no longerTo synchronize the symbol table, you can hang the tsymsync manually to improve the performance of the target machine.               Error Status           If there is a problem with the VxWorks library function, the function returns the error value and sets the fault status to indicate the specific cause and location.           Error State Library errnolib is used to get and set error status values for tasks and interrupts errno, VxWorks each task and interrupt has its own errno, the errno of the task is stored in the TCB, the task is private, the interrupted errno is stored in the interrupt stack, as long as the word interrupt handler function errno are valid.          VxWorks errno value is composed of 4byte, high character indicates the library with error, the corresponding value of each library is "taget/h/vwmodnum.h" , the low word indicates the specific error that occurred in the library, as defined in the header file of the corresponding library. Convention VxWorks System modules use high-character values, the range is 1~500, other values can be used by the application module, the low-word value is not specified.          Usrlib provides Printerrno functions to display specific error messages, Printerrno based on the input errno value, The corresponding error message is found in the STATSYMTBL and is displayed on the standard output.         ----> Printerrno 0xd0003           0xd0003 = s_ioslib_invalid_file_descriptor          "S_" indicates the state, Ioslib is the name of the library where the error occurred, Invalid_file_descriptor represents the library specific error.          If you want to call Printerrno in a Tshell or program to display an error message, you need to include the error code component in the program image---Include_stat_sym_tblTo establish STATSYMTBL on the target machine. ' If you can't use Printerrno, you can also manually find the header file to get error messages, such as "d0003", first find "D" in the corresponding library, "D" into the decimal "13", found M_ioslib: #defin E M_ioslib (<< 16) to Ioslib Library's own header file IosLib.h to find the specific error, where "0003" corresponding to the macro definition is: # define S_ioslib_i Nvalid_file_descriptor (M_ioslib | 3) The macro definition name is the error message that the user wants to know.

Form:http://hi.baidu.com/yinux/blog/item/8058a21e41c5301e4134178f.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.