CN105700861A - Embedded program run symbol table generation method and apparatus - Google Patents

Embedded program run symbol table generation method and apparatus Download PDF

Info

Publication number
CN105700861A
CN105700861A CN201410699769.7A CN201410699769A CN105700861A CN 105700861 A CN105700861 A CN 105700861A CN 201410699769 A CN201410699769 A CN 201410699769A CN 105700861 A CN105700861 A CN 105700861A
Authority
CN
China
Prior art keywords
symbol table
file
embedded program
embedded
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410699769.7A
Other languages
Chinese (zh)
Inventor
陈小松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201410699769.7A priority Critical patent/CN105700861A/en
Publication of CN105700861A publication Critical patent/CN105700861A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses an embedded program run symbol table generation method and apparatus, and relates to the field of embedded software applications. In an embedded program run symbol table generation process, the problem of low symbol table generation efficiency caused by adoption of secondary link is relieved. A specific embodiment provided by the invention comprises the steps of obtaining symbol information from an embedded target file; according to the symbol information, generating a symbol table source file; compiling the symbol table source file into a symbol table target file; and linking the embedded program target file and the symbol table target file to generate an embedded program run symbol table. The technical scheme provided by the embodiment of the invention is mainly applied to the embedded program run symbol table generation process.

Description

A kind of generation method of embedded program operation symbol table and device
Technical field
The present invention relates to embedded software application, particularly relate to generation method and the device of a kind of embedded program operation symbol table。
Background technology
Along with the increase of network system complexity, in network system, the on-the-spot adjustable ability of equipment is more aobvious important, and symbol table is the important technology of device context debugging。By embedded program operation symbol table information, the information such as commissioning staff can carry out function call operation by title, the call stack checking the information of global variable, print progress, thus obtaining the running status of equipment, and then commissioning staff can be allowed to position the reason that equipment goes wrong faster。
By foregoing description, in the debugging process of equipment, the effect of embedded program operation symbol table is significant, and this is accomplished by generating an embedded program operation symbol table。At present, the method linked by secondary carries out the generation of embedded program operation symbol table, in concrete execution process, need one null symbol table source file of structure, and compile it as null symbol table file destination, undertaken file destination compiled in advance in embedded OS and null symbol table file destination linking for the first time, obtain the first hyperlink target file, this the first hyperlink target file is analyzed, obtain symbol table source file, further this symbol table source file is converted to symbol table file destination, finally file destination compiled in advance in symbol table file destination and embedded OS is carried out second time link, ultimately generate embedded program operation symbol table。
In actual application, inventor have found that in the generation process of existing embedded program operation symbol table, secondary have to be adopted to link, this adds increased the time of compiling, and current embedded system is more and more huger, so last link time accounts for total compiling link time significant proportion, and it is long that increase once links the shared time, causes that the formation efficiency of embedded program operation symbol table is low。
Summary of the invention
Embodiments of the invention provide generation method and the device of a kind of embedded program operation symbol table, in the generation process of embedded program operation symbol table, alleviate and adopt secondary to link the problem that the symbol table formation efficiency caused is low。
For reaching above-mentioned purpose, embodiments of the invention adopt the following technical scheme that
A kind of generation method of embedded program operation symbol table, described method includes:
Obtaining symbolic information from embedded target file, described symbolic information at least includes: symbol is at the relative address of place section, designation, name section;
Symbol table source file is generated according to described symbolic information;
Described symbol table source file is compiled as symbol table file destination;
Described embedded program file destination and described symbol table file destination are linked, generates embedded program operation symbol table。
A kind of generation device of embedded program operation symbol table, described device includes:
Acquiring unit, for obtaining symbolic information from embedded target file, described symbolic information at least includes: symbol is at the relative address of place section, designation, name section;
File generating unit, generates symbol table source file for the described symbolic information obtained according to described acquiring unit;And described symbol table source file is compiled as symbol table file destination;
Link unit, links for the described symbol table file destination that described embedded program file destination and described file generating unit are generated, generates embedded program operation symbol table。
The generation method of a kind of embedded program operation symbol table that the embodiment of the present invention provides and device, symbolic information is obtained from embedded target file, and generate symbol table source file according to symbolic information, and then this symbol table source file is compiled as symbol table file destination, again embedded program file destination and symbol table file destination are linked, generate embedded program operation symbol table。With in the generation process of prior art embedded program operation symbol table, it is necessary to adopting the method for secondary link to compare, the embodiment of the present invention has only to carry out once link and is generated as embedded program operation symbol table, alleviates the problem that symbol table formation efficiency is low。
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, the accompanying drawing used required in embodiment or description of the prior art will be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the premise not paying creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings。
A kind of method flow diagram generating embedded program operation symbol table that Fig. 1 provides for one embodiment of the invention;
A kind of method flow diagram generating embedded program operation symbol table that Fig. 2 provides for another embodiment of the present invention;
A kind of method flow diagram generating embedded program operation symbol table based on instantiation that Fig. 3 provides for another embodiment of the present invention;
Fig. 4 generates the structure composition schematic diagram of device for a kind of embedded program operation symbol table that another embodiment of the present invention provides;
Fig. 5 generates the structure composition schematic diagram of device for the another kind of embedded program operation symbol table that another embodiment of the present invention provides。
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only a part of embodiment of the present invention, rather than whole embodiments。Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under not making creative work premise, broadly fall into the scope of protection of the invention。
One embodiment of the invention provides a kind of generation method of embedded program operation symbol table, and this method applies execution in embedded OS, as it is shown in figure 1, the method includes:
101, from embedded target file, symbolic information is obtained。
Wherein, symbolic information at least includes: symbol is at the relative address of place section, designation, name section。
What deserves to be explained is, symbol is present in a section, and when not setting up link, the initial address of this section is 0, then the symbol obtained address in this section is: symbol is in the relative address of place section。
102, symbol table source file is generated according to symbolic information。
103, symbol table source file is compiled as symbol table file destination。
104, embedded program file destination and symbol table file destination are linked, generate embedded program operation symbol table。
The generation method of a kind of embedded program operation symbol table that the embodiment of the present invention provides, symbolic information is obtained from embedded target file, and generate symbol table source file according to symbolic information, and then this symbol table source file is compiled as symbol table file destination, again embedded program file destination and symbol table file destination are linked, generate embedded program operation symbol table。With in the generation process of prior art embedded program operation symbol table, it is necessary to adopting the method for secondary link to compare, the embodiment of the present invention has only to carry out once link and is generated as embedded program operation symbol table, alleviates the problem that symbol table formation efficiency is low。
Another embodiment of the present invention provides a kind of generation method of embedded program operation symbol table, just how to be described in detail according to symbolic information generation symbol table source file in the present embodiment, namely having made to illustrate for above-mentioned steps 102, this step 102 specifically includes following two and performs step:
The first step: obtain symbol table information by symbolic information。
What deserves to be explained is, description in conjunction with above-mentioned steps 101, after getting symbolic information, symbol table is generated by symbolic information, symbol table at least includes: designation, symbolic address, three kinds of information of name section, certainly can also include in this symbol table: symbol size, sign pattern。Symbolic address in symbol table is: symbol is at the variable of the relative address+segment base of place section, and the variable of segment base assignment when link, namely the variable of this segment base when link according to the code dynamic assignment such as how much。
Second step: generate symbol table source file by symbol table information。
What deserves to be explained is, in conjunction with above-mentioned method flow as shown in Figure 1, before performing step 104, the method also includes:
A, structure link script。
Wherein, link script includes segment base variable, and the independent section in this link script deposits symbol table, the symbol table that namely this symbol table gets above by symbolic information。
B, by link script embedded program file destination and symbol table file destination are linked。
What deserves to be explained is, the step a that this place describes is carried out the flow process before step 104, and the step b that performs thereafter is actual is the step 104 actual execution flow process when two file destinations link。
Another embodiment of the present invention provides a kind of generation method of embedded program operation symbol table, describes the entirety generating embedded program operation symbol table in this embodiment and performs flow process, as in figure 2 it is shown, the method includes:
201, it is an embedded program file destination by embedded program compilation of source code。
202, from embedded program file destination, extract symbolic information, generate symbol table source file。
Wherein, in the present embodiment, it is necessary to the symbolic information obtained from embedded program file destination at least includes: designation, symbol are the relative address of place section, name section three kinds。But symbolic information can also have: symbol size, sign pattern。
203, symbol table source file is compiled as symbol table file destination。
204, embedded program file destination and symbol table file destination are linked, generate the embedded program comprising symbol table。
In above-mentioned steps 204, the embedded program comprising symbol table of generation i.e. embedded program operation symbol table。
Description in conjunction with above-mentioned method flow as shown in Figure 2, the invention provides an instantiation and carry out the generation of embedded program operation symbol table, in this example, it is that image object file Image.o illustrates for the embedded program file destination of generation, and in conjunction with the description of above-mentioned steps 202, obtain symbolic information in the present embodiment to include: designation, symbol are in the relative address of place section, symbol size, sign pattern, 5 kinds of information of name section, as it is shown on figure 3, the method includes:
301, the original rule according to embedded software is compiled, and produces embedded program file destination Image.o。
What deserves to be explained is, multiple file can be produced after embedded software compiling, including library file (.a file) and file destination (.o file), such as can have: embedded system library file lib_os.a, embedded Driver Library file libdrv.a, Embedded Application library file lib_app.a, initial target file: start.o etc.。Further, the file after these compilings is synthesized, synthesizes an Image.o, in the present embodiment during synthesis file destination Image.o, it is possible to be by any one or multiple library file, or any one or more file destination synthesizes。The present embodiment with, synthesizing Image.o file by start.olib_os.alibdrv.alib_app.a is that example illustrates, and the generation process of this Image.o can be realized by following code:
gccstart.olib_os.alibdrv.alib_app.a-oImage.o
302, resolve Image.o, obtain symbolic information, and generate symbol table source file according to symbolic information。
What deserves to be explained is, in conjunction with the above-mentioned description to this example, the symbolic information obtained in this step includes: designation, symbol are at the relative address of place section, symbol size, sign pattern, segment information。Further, after getting this symbolic information, these symbolic information are inserted symbol table source file, thus generating symbol table source file。
In the present embodiment, provide three class symbols, designation is respectively as follows: function fun1, function fun2, variable var1, and gets these symbols respectively: symbol is at the relative address of place section, symbol size, sign pattern, name section, and concrete content is as follows:
Function fun1, symbol in the relative address of place section is: 0x1000, and symbol size is: 0x300, and sign pattern is: overall situation function, name section be: text text。
Function fun2, symbol in the relative address of place section is: 0x5000, and symbol size is: 0x600, and sign pattern is: local functions, name section be: text _ application text_app。
Variable var1, symbol in the relative address of place section is: 0x6000, and symbol size is: 0x4, and sign pattern is: variable, name section be: data data。
Symbolic information further, in conjunction with the description of the symbolic information to above-mentioned three types, as follows, that symbol table should comprise:
Wherein, text_start, text_app_start, data_start are defined in link script, represent the initial address of text section respectively, the initial address of text_app section, data section initial address, these variablees when link according to the code dynamic assignment such as how much。
What deserves to be explained is, symtbl segment table shows, when link, symbol table is put into an independent section, does not so affect the address distribution of other intrasegmental parts and the name title that symbol table place section is simply set by symtbl here。
303, compiling symTbl.c is symTbl.o。
Wherein, symTbl.o is symbol table file destination。
304, link Image.o and symTbl.o, generation can perform embedded program operation symbol table。
What deserves to be explained is, in step 04 in the link process of two file destinations, link script link.os can be used, and by link instruction (ld), perform following operation:
LdImage.osymTbl.o-Tlink.os-oosimage/* by Image.o and symTbl.o by link script link.os link, generate target mirror as osimage*/
Therein, target mirror is the embedded program operation symbol table in the present embodiment as osimage。
Tellable, in the present embodiment, embedded software is divided into text section, text_app section, data section, symtbl section。Certainly in actual application, according to practical situation, the section that embedded software can be divided into does not limit above-mentioned four kind, and in four kinds of above-mentioned sections, first three therein is can selections, symtbl section is the section that must comprise in this link script, and only comprises symbol table in this section, but the concrete title of this section is represented and does not limit in actual application。
There is the symtbl section last explanation at link script of symbol table in the present embodiment for compiling, be originally embodiment links script link.os to comprise herein below:
What deserves to be explained is, in embodiments of the present invention, before carrying out Object linking, from embedded program file destination, just extract the symbol relative address in place section, and then the initial address of section is obtained by linking script, it is thus possible to indirectly determine the absolute address of symbol, generate embedded program operation symbol table。
Another embodiment of the present invention provides the generation device of a kind of embedded program operation symbol table, and as shown in Figure 4, this device includes: acquiring unit 41, file generating unit 42, link unit 43。
Acquiring unit 41, for obtaining symbolic information from embedded target file。
Wherein, symbolic information at least includes: symbol is at the relative address of place section, designation, name section。
File generating unit 42, generates symbol table source file for the symbolic information obtained according to acquiring unit 41, and symbol table source file is compiled as symbol table file destination。
Link unit 43, links for the symbol table file destination that embedded program file destination and file generating unit 42 are generated, generates embedded program operation symbol table。
In the optional constituted mode of one of the device of the present embodiment offer, as it is shown in figure 5, file generating unit file generating unit 42 includes: obtaining subelement 421, file generated subelement 422, device also includes: structural unit 44。
Obtain subelement 421, for obtaining symbol table information by symbolic information。
Wherein, symbol table information at least includes: designation, name section, symbolic address, and the symbolic address in this symbol table information is: symbol is at the relative address+segment base variable of place section。
File generated subelement 422, generates symbol table source file for the symbol table information obtained by obtaining subelement 421。
Structural unit 44, is used for constructing link script。
Wherein, link script includes segment base variable, and the independent section compiling in link script has symbol table。
Link unit 43, is additionally operable to the link script by structural unit 44 constructs and embedded program file destination and symbol table file destination is linked。
File generating unit 42, is additionally operable to, before acquiring unit obtains symbolic information from embedded target file, embedded program compilation of source code be become embedded program file destination。
Present invention device as shown in Figure 4 and Figure 5 is used for realizing above-mentioned method flow as shown in Figure 1 to Figure 3, the explanation of relevant parameter or content in this device embodiment, can refer to above-mentioned related content in Fig. 1 to Fig. 3 accompanying method flow process and describes。
The embodiment of the present invention provides the generation device of a kind of embedded program operation symbol table, from embedded target file, symbolic information is obtained by acquiring unit, and generated symbol table source file by file generating unit according to symbolic information, and then by link unit, this symbol table source file is compiled as symbol table file destination, again embedded program file destination and symbol table file destination are linked, generate embedded program operation symbol table。With in the generation process of prior art embedded program operation symbol table, it is necessary to adopting the method for secondary link to compare, the embodiment of the present invention has only to carry out once link and is generated as embedded program operation symbol table, alleviates the problem that symbol table formation efficiency is low。
Through the above description of the embodiments, those skilled in the art is it can be understood that can add the mode of required common hardware by software to the present invention and realize, naturally it is also possible to by hardware, but in a lot of situation, the former is embodiment more preferably。Based on such understanding, the part that prior art is contributed by technical scheme substantially in other words can embody with the form of software product, this computer software product is stored in the storage medium that can read, floppy disk such as computer, hard disk or CD etc., including some instructions with so that a computer equipment (can be personal computer, server, or the network equipment etc.) performs the method described in each embodiment of the present invention。
The above; being only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, any those familiar with the art is in the technical scope that the invention discloses; change can be readily occurred in or replace, all should be encompassed within protection scope of the present invention。Therefore, protection scope of the present invention should be as the criterion with described scope of the claims。

Claims (8)

1. the generation method of an embedded program operation symbol table, it is characterised in that described method includes:
Obtaining symbolic information from embedded target file, described symbolic information at least includes: symbol is at the relative address of place section, designation, name section;
Symbol table source file is generated according to described symbolic information;
Described symbol table source file is compiled as symbol table file destination;
Described embedded program file destination and described symbol table file destination are linked, generates embedded program operation symbol table。
2. method according to claim 1, it is characterised in that described according to described symbolic information generate symbol table source file include:
Obtaining symbol table information by described symbolic information, described symbol table information at least includes: described designation, described name section, symbolic address, and described symbolic address is described symbol relative address+segment base variable in place section;
Described symbol table source file is generated by described symbol table information。
3. method according to claim 2, it is characterised in that described method also includes:
Structure link script, described link script includes described segment base variable, and the independent section compiling in described link script has symbol table;
By described link script, described embedded program file destination and described symbol table file destination are linked。
4. the method according to claim 1-3 any one, it is characterised in that obtaining before symbolic information from embedded target file described, described method also includes:
Embedded program compilation of source code is become described embedded program file destination。
5. the generation device of an embedded program operation symbol table, it is characterised in that described device includes:
Acquiring unit, for obtaining symbolic information from embedded target file, described symbolic information at least includes: symbol is at the relative address of place section, designation, name section;
File generating unit, generates symbol table source file for the described symbolic information obtained according to described acquiring unit;And described symbol table source file is compiled as symbol table file destination;
Link unit, links for the described symbol table file destination that described embedded program file destination and described file generating unit are generated, generates embedded program operation symbol table。
6. device according to claim 5, it is characterised in that described file generating unit includes:
Obtain subelement, for obtaining symbol table information by described symbolic information, described symbol table information at least includes: described designation, described name section, symbolic address, and described symbolic address is described symbol relative address+segment base variable in place section;
File generated subelement, generates described symbol table source file for the described symbol table information obtained by described acquisition subelement。
7. device according to claim 6, it is characterised in that described device also includes:
Structural unit, is used for constructing link script, and described link script includes described segment base variable, and the independent section compiling in described link script has symbol table;
Described link unit, is additionally operable to the link script by described structural unit constructs and described embedded program file destination and described symbol table file destination is linked。
8. according to any one described device of claim 5-7, it is characterised in that
Described file generating unit, is additionally operable to, before described acquiring unit obtains symbolic information from embedded target file, embedded program compilation of source code become described embedded program file destination。
CN201410699769.7A 2014-11-27 2014-11-27 Embedded program run symbol table generation method and apparatus Pending CN105700861A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410699769.7A CN105700861A (en) 2014-11-27 2014-11-27 Embedded program run symbol table generation method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410699769.7A CN105700861A (en) 2014-11-27 2014-11-27 Embedded program run symbol table generation method and apparatus

Publications (1)

Publication Number Publication Date
CN105700861A true CN105700861A (en) 2016-06-22

Family

ID=56294522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410699769.7A Pending CN105700861A (en) 2014-11-27 2014-11-27 Embedded program run symbol table generation method and apparatus

Country Status (1)

Country Link
CN (1) CN105700861A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110275756A (en) * 2018-03-13 2019-09-24 华为技术有限公司 Virtualize the dispositions method and device of network element

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339507A (en) * 2008-08-15 2009-01-07 中兴通讯股份有限公司 Method for creating embedded program operation symbol table
CN101706735A (en) * 2009-11-26 2010-05-12 中兴通讯股份有限公司 Embedded system and method for acquiring symbol table by same
US8028268B2 (en) * 2005-06-21 2011-09-27 International Business Machines Corporation System and method for building software package for embedded system
CN102508880A (en) * 2011-10-18 2012-06-20 广东威创视讯科技股份有限公司 Method for joining files and method for splitting files
CN102831178A (en) * 2012-07-30 2012-12-19 华为技术有限公司 Method and device for redeploying multilevel storage

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8028268B2 (en) * 2005-06-21 2011-09-27 International Business Machines Corporation System and method for building software package for embedded system
CN101339507A (en) * 2008-08-15 2009-01-07 中兴通讯股份有限公司 Method for creating embedded program operation symbol table
CN101706735A (en) * 2009-11-26 2010-05-12 中兴通讯股份有限公司 Embedded system and method for acquiring symbol table by same
CN102508880A (en) * 2011-10-18 2012-06-20 广东威创视讯科技股份有限公司 Method for joining files and method for splitting files
CN102831178A (en) * 2012-07-30 2012-12-19 华为技术有限公司 Method and device for redeploying multilevel storage

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110275756A (en) * 2018-03-13 2019-09-24 华为技术有限公司 Virtualize the dispositions method and device of network element
CN110275756B (en) * 2018-03-13 2023-04-18 华为技术有限公司 Method and device for deploying virtualized network element

Similar Documents

Publication Publication Date Title
CN103744709B (en) patch loading method and device
EP2721513B1 (en) Live browser tooling in an integrated development environment
US8239823B2 (en) Generating libraries for reflection without project compilation
CN103473067A (en) Embedded Linux partitioning and data recovery method, embedded Linux partitioning and data recovery system and system development method
CN105446712A (en) Defect mending method and device for application program
CN105094836A (en) Method and device for generating description document
CN107632828A (en) More dts files support method, compilation device and embedded device
CN108197440A (en) A kind of Code obfuscation method, equipment and computer readable storage medium
US8209662B2 (en) Application retargeting
CN103077038B (en) The method of dynamic generation and compiling .NET project
CN107015903A (en) A kind of generation method, device and the electronic equipment of interface detection program
CN103955354A (en) Relocation method and device
CN103645888A (en) System and method for automatically building operation system
CN104881396A (en) Graphical-program compile file forming method
CN103077011B (en) A kind of method and apparatus of pre-generatmg machine code instruction in JavaScript script
JP2020060919A (en) System migration support device, system migration support method and program
CN105700861A (en) Embedded program run symbol table generation method and apparatus
CN103176903A (en) Testing method and testing device of MapReduce distributed system program
US9417871B2 (en) Automatic generation of certificate of origin (COO) for software systems
CN105843659A (en) Implementation method and system of embedded C compiler
Klint et al. Rascal, 10 years later
CN109656556B (en) Method and device for generating self-adaptive page
CN109960497A (en) Call method and device between a kind of script file
JP6175306B2 (en) Control program dividing apparatus, control program dividing method and recording medium therefor
JP2018022433A (en) Control program, apparatus, and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160622

RJ01 Rejection of invention patent application after publication