最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

Symbol table

工作和技术 crifan 1737浏览 0评论

Symbol table

From Wikipedia, the free encyclopedia

Jump to: navigation, search

In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program’s source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.

Contents

[hide]

[edit] Implementation

A common implementation technique is to use a hash table implementation. A compiler may use one large symbol table for all symbols or use separated, hierachical symbol tables for different scopes.

[edit] Uses

An object file will contain a symbol table of the identifiers it contains that are externally visible. During the linking of different object files, a linker will use these symbol tables to resolve any unresolved references.

A symbol table may only exist during the translation process, or it may be embedded in the output of that process for later exploitation, for example, during an interactive debugging session, or as a resource for formatting a diagnostic report during or after execution of a program.

[edit] Example

The symbol table of a small program is listed below. The table itself was generated using the GNU binutils’ nm utility. There is one data symbol, holaamigosh (noted by the "D" type), and many functions (self defined as well as from the standard library). The first column is where the symbol is located in the memory, the second is "The symbol type" and the third is the name of the symbol. By passing suitable parameters, the symbol table was made to sort on basis of address.

Example table
AddressTypeName
00000020aT_BIT
00000040aF_BIT
00000080aI_BIT
20000004tirqvec
20000008tfiqvec
2000000ctInitReset
20000018T_main
20000024tEnd
20000030TAT91F_US3_CfgPIO_useB
2000005ctAT91F_PIO_CfgPeriph
200000b0Tmain
20000120TAT91F_DBGU_Printk
20000190tAT91F_US_TxReady
200001c0tAT91F_US_PutChar
200001f8TAT91F_SpuriousHandler
20000214TAT91F_DataAbort
20000230TAT91F_FetchAbort
2000024cTAT91F_Undef
20000268TAT91F_UndefHandler
20000284TAT91F_LowLevelInit
200002e0tAT91F_DBGU_CfgPIO
2000030ctAT91F_PIO_CfgPeriph
20000360tAT91F_US_Configure
200003dctAT91F_US_SetBaudrate
2000041ctAT91F_US_Baudrate
200004ectAT91F_US_SetTimeguard
2000051ctAT91F_PDC_Open
2000059ctAT91F_PDC_DisableRx
200005c8tAT91F_PDC_DisableTx
200005f4tAT91F_PDC_SetNextTx
20000638tAT91F_PDC_SetNextRx
2000067ctAT91F_PDC_SetTx
200006c0tAT91F_PDC_SetRx
20000704tAT91F_PDC_EnableRx
20000730tAT91F_PDC_EnableTx
2000075ctAT91F_US_EnableTx
20000788T__aeabi_uidiv
20000788T__udivsi3
20000884T__aeabi_uidivmod
2000089cT__aeabi_idiv0
2000089cT__aeabi_ldiv0
2000089cT__div0
200009a0D_data
200009a0A_etext
200009a0Dholaamigosh
200009a4A__bss_end__
200009a4A__bss_start
200009a4A__bss_start__
200009a4A_edata
200009a4A_end

[edit] See also

[edit] External links

转载请注明:在路上 » Symbol table

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
79 queries in 0.162 seconds, using 22.16MB memory