Homonymy processing method and device, equipment and storage medium

By parsing the executable files of iOS applications, identifying methods with the same name in multiple categories, solving the problem of method with the same name overlay in Objective-C development, and achieving efficient and stable application operation.

CN119883279AActive Publication Date: 2025-04-25BEIJING 58 INFORMATION TTECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411960572.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

When developing iOS applications using the Objective-C programming language, there are cases where methods have the same name in multiple categories of the same class, which causes the methods defined later to override the methods defined previously, affecting the stability of the application. The prior art detects the same name method by scanning source code, but this method takes a long time and has an impact on computer performance.

Method used

By obtaining the executable file of the target application and parsing it layer by layer based on the file header, multiple categories of the target class and their corresponding method information are determined, thereby identifying methods with the same name in multiple categories. This method does not require obtaining source code or writing scripts, which improves work efficiency and does not occupy computer performance resources.

Benefits of technology

It realizes the rapid and efficient identification and handling of the same-named method in multiple categories, without scanning the complete source code, avoiding the impact on computer performance, and ensuring the stable operation of the application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883279A_ABST
    Figure CN119883279A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a homonymy processing method and device, equipment and a storage medium. The method comprises the steps that an executable file of a target application program is obtained, the executable file is obtained by compiling a set programming language, and the executable file comprises a file header used for storing file basic information and executable codes executed when the target application program runs on set equipment; determining classification information of a plurality of classifications corresponding to a target class of the set programming language based on the file header; according to the classification information, determining method information of a method corresponding to each of the plurality of classifications, the method being used for executing a set operation when the target application runs; and according to the method information corresponding to the plurality of classifications, determining the same-name methods in the plurality of classifications. According to the scheme, in the homonymy processing process, source codes of the target application program do not need to be obtained, scripts do not need to be written, the working efficiency is high, and the computer performance cannot be affected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for processing homonyms. Background Art

[0002] When using the Objective-C programming language to design and develop applications for the iOS operating system, if multiple categories are added to the same class, and there are methods with the same name in the methods corresponding to the multiple categories, it is easy to cause the later defined methods to overwrite the previously defined methods, thereby affecting the stability of the application. Among them, a class can be understood as a collection of objects with the same properties and methods, and each object in the object collection has the properties and methods defined by the class. Classification is a new method added on the basis of an existing class. For ease of understanding, for example, a class can correspond to multiple categories, and each category contains multiple methods. For example, in the first category of the target class, it contains two methods, rendering and live broadcasting, and in the second category of the target class, it contains two methods, rendering and sayhello. Then, it can be understood that there will be a method with the same method name in the first category and the second category, namely "rendering". In addition, if it is known that the method in the second category is defined later than the method in the first category, the "rendering" in the second category will overwrite the "rendering" in the first category.

[0003] In view of this, the prior art generally writes scripts to scan the source code of the application, thereby summarizing the method names corresponding to all categories of the target class to determine whether there are duplicate method names. However, this method requires scanning the entire application source code, which is time-consuming and inefficient. In addition, the running of the script will occupy a certain amount of CPU and memory resources. If the script is run frequently (for example, the same name detection is performed for each class in this way), it will have a certain impact on the computer performance. Summary of the invention

[0004] The embodiments of the present invention provide a method, apparatus, device and storage medium for processing homonyms. The entire process does not require obtaining the source code of the target application program or writing scripts, which not only has high work efficiency but also does not affect computer performance.

[0005] In a first aspect, an embodiment of the present invention provides a method for processing homonyms, including:

[0006] Obtaining an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic file information, and an executable code that is executed when the target application is running on a set device;

[0007] Based on the file header, determining classification information of multiple classifications corresponding to the target class of the set programming language;

[0008] Determining method information of methods corresponding to each of the multiple categories according to the classification information, wherein the methods are used to perform a setting operation when the target application is running;

[0009] Methods with the same name in the multiple categories are determined according to the method information corresponding to each of the multiple categories.

[0010] In a second aspect, an embodiment of the present invention provides a homonymous processing device, including:

[0011] An acquisition module, used for acquiring an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic information of the file, and an executable code executed when the target application is running on a set device;

[0012] A determination module is used to determine, based on the file header, classification information of multiple categories corresponding to the target class of the set programming language, and to determine method information of methods corresponding to each of the multiple categories according to the classification information, and to determine methods with the same name in the multiple categories according to the method information corresponding to each of the multiple categories, wherein the method is used to perform a set operation when the target application is running.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a communication interface; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the same-name processing method as described in the first aspect.

[0014] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor executes the processing method of the same name as described in the first aspect.

[0015] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer program, which, when executed by a processor of an electronic device, enables the processor to execute the processing method of the same name as described in the first aspect.

[0016] The same-name processing method provided by the embodiment of the present invention can obtain the method information of the methods corresponding to multiple categories by obtaining the executable file of the target application and parsing the executable file layer by layer (the specific layer-by-layer parsing process is as follows: first, based on the file header of the executable file, determine the classification information of multiple categories corresponding to the target class of the set programming language, and then determine the method information of the methods corresponding to the multiple categories based on the classification information), and then determine the methods with the same name in multiple categories based on the method information. The whole process does not need to obtain the source code of the target application or write scripts, which not only has high work efficiency but also does not affect computer performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 A flowchart of a method for processing the same name provided by an embodiment of the present invention;

[0019] Figure 2 A specific application flow chart of a same-name processing method provided by an embodiment of the present invention;

[0020] Figure 3 Another specific application flow chart of a same-name processing method provided by an embodiment of the present invention;

[0021] Figure 4 A schematic diagram of an application of a same-name processing method provided by an embodiment of the present invention;

[0022] Figure 5 A schematic diagram of the structure of a processing device of the same name provided by an embodiment of the present invention;

[0023] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0026] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0027] First, the terms or concepts involved in the embodiments of the present invention are explained:

[0028] Mach Object (Mach-O for short): is a file format used for executable files, object code, dynamic libraries, and kernel dumps.

[0029] Objective-C: is an object-oriented programming language that is based on the C language and extends its object-oriented capabilities. It is mainly used in the development of iOS and Mac OS X systems.

[0030] When using the Objective-C programming language to design and develop applications for the iOS operating system, if multiple categories are added to the same class, and there are methods with the same name in the methods corresponding to the multiple categories, it is easy to cause the later defined methods to overwrite the previously defined methods, thereby affecting the stability of the application. Among them, a class can be understood as a collection of objects with the same properties and methods, and each object in the object collection has the properties and methods defined by the class. Classification is a new method added on the basis of an existing class. For ease of understanding, for example, a class can correspond to multiple categories, and each category contains multiple methods. For example, in the first category of the target class, it contains two methods, rendering and live broadcasting, and in the second category of the target class, it contains two methods, rendering and sayhello. Then, it can be understood that there will be a method with the same method name in the first category and the second category, namely "rendering". In addition, if it is known that the method in the second category is defined later than the method in the first category, the "rendering" in the second category will overwrite the "rendering" in the first category.

[0031] At present, scripts are generally written to scan the source code of the application, so as to summarize the method names corresponding to all categories of the target class to determine whether there are duplicate method names. However, this method requires scanning the entire application source code, which is time-consuming and inefficient. In addition, the running of the script will occupy a certain amount of CPU and memory resources. If the script is run frequently (for example, the same name detection is performed for each class in this way), it will have a certain impact on computer performance.

[0032] In view of this, the embodiment of the present invention provides a method for processing same-named methods, which solves the above-mentioned problem through the following ideas: obtaining the executable file of the target application, parsing the executable file layer by layer, specifically, first determining the classification information of multiple classifications corresponding to the target class of the set programming language based on the file header of the executable file, and then determining the method information (i.e., method name) of the methods corresponding to each of the multiple classifications based on the classification information. At this time, the methods with the same name in multiple classifications can be determined based on the method information, so that the developer can perform subsequent processing on the methods with the same name. In this process, there is no need to obtain the source code of the target application, nor to write scripts, which not only has high work efficiency, but also does not affect computer performance.

[0033] The following describes the method for processing same-name information provided by the embodiment of the present invention in combination with specific embodiments.

[0034] The same-name processing method provided in the embodiment of the present application can be executed by an electronic device, which can be a terminal device such as a PC, a laptop, a smart phone, or a server. The server can be a physical server including an independent host, or a virtual server, or a cloud server or a server cluster.

[0035] Figure 1 A flowchart of a method for processing the same name provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method comprises the following steps:

[0036] 101. Obtain an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic file information, and executable code that is executed when the target application runs on a set device.

[0037] 102. Based on the file header, determine classification information of multiple classifications corresponding to the target class of the set programming language.

[0038] 103. Determine method information of methods corresponding to each of the multiple categories according to the classification information, wherein the methods are used to perform setting operations when the target application is running.

[0039] 104. Determine methods with the same name in multiple categories based on method information corresponding to each of the multiple categories.

[0040] It should be noted that the target application can be an office application, a game application, a music application, etc., which is not limited here. The executable file of the target application can be a Mach-O file, and the format of the data in the Mach-O file is binary format. For ease of understanding, the following is a specific description using the Mach-O file as an example:

[0041] In actual applications, the standard file I / O functions of C language or Objective-C can be used to read the Mach-O file of the target application. It is understandable that the Mach-O file contains a file header for storing basic information of the file, and the executable code executed when the target application runs on the set device. Among them, the file header at least includes the magic number of the file (used to identify the file type, such as 0xfeedface for 32-bit Mach-O file, 0xfeedfacf for 64-bit Mach-O file), CPU type (that is, to determine which CPU architecture the file is compiled for), file type (used to indicate whether the file is an executable file, dynamic library, static library or other type), the number of load commands (the number of load commands immediately following the file header, which describe how to load various parts of the file), etc., which are not listed here one by one.

[0042] After obtaining the above-mentioned executable file, based on the file header of the executable file, the classification information of multiple categories corresponding to the target class of the set programming language is determined. The specific process is as follows: based on the file header information, the target architecture type of the set device is determined; under the target architecture type, based on the file header, the classification information of multiple categories corresponding to the target class of the set programming language is determined.

[0043] In specific implementation, the file header can be parsed to obtain the cputype field in the file header, and the target architecture type of the setting device can be determined according to the value of the cputype field. For example, if the value of the cputype field is CPU_TYPE_ARM64, the target architecture type is determined to be ARM64. Based on the advantages of the ARM64 architecture, such as greater memory addressing capability, higher performance, and better energy efficiency, the target architecture type in the embodiment of the present invention can preferably be the ARM64 architecture type, but it is not limited thereto, and it can also be the ARMv7 architecture type, etc. Among them, the setting device can be a terminal device such as a mobile phone or a tablet computer.

[0044] Furthermore, after determining the target architecture type, the classification information of multiple categories corresponding to the target class of the set programming language can be determined based on the file header under the ARM64 architecture. The specific steps are as follows: in the target field in the file header, determine the target classification data segment. The target field is used to store data segments related to the class and classification of the set programming language. The target classification data segment contains the classification information of multiple categories corresponding to the target class of the set programming language. By determining the target classification data segment in the target field in the file header, further parsing of the executable file is achieved, laying the foundation for subsequent acquisition of method information of methods corresponding to each of the multiple classifications.

[0045] It is understandable that, in addition to the above-mentioned example contents, the file header may also include a target field, which stores data segments related to the class and classification of the set programming language, and its specific form may be a _DATA field, which contains multiple data segments.

[0046] In specific implementation, multiple data segments in the _DATA field can be traversed to find the target classification data segment, which contains classification information of multiple classifications corresponding to the target class of the set programming language, and its specific form can be the _objc_catlist segment. At this time, the offset address and size of the objc_catlist segment are obtained. For ease of understanding, for example, assuming that there are 3000 bytes of data in the _DATA field, of which the _objc_catlist segment occupies the 1700th to 2000th bytes, then it can be determined that the starting address of the _objc_catlist segment is the address of the 1700th byte, its offset address is the address of the 2000th byte, and its size is 300 bytes.

[0047] The target classification data segment includes a plurality of structures for storing classification information, and the structures correspond to the classifications one by one.

[0048] For ease of understanding, the following example uses the target classification data segment, which is the _objc_catlist segment, as an example:

[0049] The _objc_catlist segment contains the category_t structures corresponding to multiple categories. The specific example of the category_t structure is as follows:

[0050]

[0051] Assuming that the target class is A, its corresponding categories may include A1, A2, A3...A100 (i.e., category information). Each category corresponds to a category_t structure. Through the category_t structure, you can get the method names contained in multiple categories. The specific process is as follows: In the structures corresponding to the multiple categories, determine the method-related fields; based on the index information in the method-related fields, get the method names (i.e., method information) contained in the multiple categories, where the methods are used to perform set operations when the target application is running, such as rendering, live broadcast, sayhello, etc.

[0052] Take one of the multiple categories (assuming A1) as an example, the "category name" in the corresponding category_t structure is A1, and the "extended class" is A. The methods included in the instance method list and / or class method list may include: method a, method b, method c. Among them, all or part of method a, method b, and method c can be instance methods or class methods. Among them, "*" can be understood as index information, and its specific form can be a pointer.

[0053] In actual application, by parsing the category_t structure of each category, the pointer to the instance method list corresponding to each category and the pointer to the class method list (i.e., method-related fields) can be extracted. Since the instance method list and the class method list point to the method_list_t field through pointers (if the above example is continued, it can also be called the method64_list_t field here), by parsing the method64_list_t field, the detailed information of the method64_t structure can be obtained, including: name field, types field, and imp field. Among them, the name field is a pointer to the method name string, the types field contains the type signature information of the method (such as parameter type, return value type, etc.), and the imp field is a pointer to the method implementation code. By parsing the name field, the method name corresponding to each method in the category can be obtained.

[0054] By determining the method-related fields in the structures corresponding to multiple categories and obtaining the method names contained in multiple categories based on the index information in the method-related fields, the layer-by-layer analysis of the executable file was successfully completed, so that it can be quickly determined whether there are methods with the same name in multiple categories based on the method names contained in multiple categories.

[0055] For the specific process of determining whether there are methods with the same name in multiple categories, for example, you can create a dictionary (or similar data structure) with the method name as the key and an object containing detailed information about the method (such as method name, type signature, implementation address, category, etc.) as the value. Traverse the collected method information corresponding to the methods in each of the multiple categories and fill this dictionary. After that, traverse the dictionary to check whether there are multiple values ​​corresponding to the same key (i.e., method name). For methods with the same name in two categories, compare their type signatures and implementation addresses. If the type signature and implementation address are the same, it means that the two methods are the same method with the same name, and if the type signature and / or implementation address are different, it means that the two methods are different methods.

[0056] The same-name processing method provided by the embodiment of the present invention can obtain the method information of the methods corresponding to multiple categories by obtaining the executable file of the target application and parsing the executable file layer by layer (the specific layer-by-layer parsing process is as follows: first, based on the file header of the executable file, determine the classification information of multiple categories corresponding to the target class of the set programming language, and then determine the method information of the methods corresponding to the multiple categories based on the classification information), and then determine the methods with the same name in multiple categories based on the method information. The whole process does not need to obtain the source code of the target application or write scripts, which not only has high work efficiency but also does not affect computer performance.

[0057] In addition, it is understandable that in IOS application development, the codes used by developers are all natural languages, and when they are finally applied, the natural languages ​​need to be converted into a binary format that can be understood by the development device. The embodiment of the present invention can effectively avoid the format conversion process by using binary executable files, thereby further improving work efficiency.

[0058] Figure 2 A specific application flow chart of a same-name processing method provided by an embodiment of the present invention, such as Figure 2 As shown, the method comprises the following steps:

[0059] 201. Obtain an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic file information, and executable code that is executed when the target application runs on a set device.

[0060] 202. Based on the file header, determine classification information of multiple classifications corresponding to the target class of the set programming language.

[0061] 203. Determine method information of methods corresponding to each of the multiple categories according to the classification information, wherein the methods are used to perform setting operations when the target application is running.

[0062] 204. Determine methods with the same name in multiple categories according to method information corresponding to each of the multiple categories.

[0063] 205. If it is determined that a first target method with the same name exists in a first category and a second category among the multiple categories, the first target method in the first category or the second category is deleted.

[0064] The specific execution process of step 201 to step 204 can be referred to the above embodiment, which will not be repeated here. For step 205, for ease of understanding, in specific implementation, for example, assuming that the target class A has a first category A1 and a second category A2, and the first category A1 includes methods a, c and d, and the second category A2 includes methods a, b and e. The first category and the second category have a first target method with the same name (i.e., method a). At this time, you can choose to delete method a in the first category A1 or delete method a in the second category A2.

[0065] By deleting the first target method in the first category or the second category when it is determined that the first target method with the same name exists in the first category and the second category in multiple categories, the problem of method with the same name is effectively solved and the stable operation of the application is ensured.

[0066] Figure 3 Another specific application flow chart of a same-name processing method provided by an embodiment of the present invention is as follows: Figure 3 As shown, the method comprises the following steps:

[0067] 301. Obtain an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic file information, and executable code that is executed when the target application runs on a set device.

[0068] 302. Based on the file header, determine classification information of multiple classifications corresponding to the target class of the set programming language.

[0069] 303. Determine method information of methods corresponding to each of the multiple categories according to the classification information, wherein the methods are used to perform setting operations when the target application is running.

[0070] 304. Determine methods with the same name in multiple categories according to method information corresponding to each of the multiple categories.

[0071] 305. If it is determined that the first category and the second category in the multiple categories have the same first target method, modify the method name of the first target method in the first category or the second category so that the names of the first target method in the first category and the second category are different.

[0072] Among them, the specific execution process of steps 301-304 can refer to the above embodiment and will not be repeated here. For step 305, for ease of understanding, during the specific implementation, for example, assume that the target class A has a first category A1 and a second category A2, and the first category A1 includes methods a, c and d, and the second category A2 includes methods a, b and e. The first category and the second category have a first target method with the same name (i.e., method a). At this time, you can choose to modify the name of method a in the first category A1, such as changing its name to method f, or you can choose to modify the name of method a in the second category A2, such as changing its name to method j, as long as it can be ensured that the names of method a in the first category and the second category are no longer the same.

[0073] By modifying the method name of the first target method in the first category or the second category when it is determined that the first target method with the same name exists in the first category and the second category in multiple categories, the problem of the method with the same name is effectively solved and the stable operation of the application is ensured.

[0074] In addition, it should be noted that in actual applications, not only can a classification include multiple corresponding methods, but the target class to which multiple classifications belong can also contain multiple methods. Therefore, if the target class and its corresponding multiple classifications have the same method name (for example, target class A contains methods a and b, and its classification A1 contains methods a and c, then it can be determined that target class A and its corresponding classification A1 have the same method name, namely method a), the problem of method coverage will also occur.

[0075] In view of this, Figure 4 A schematic diagram of an application of a same-name processing method provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the method comprises at least the following steps:

[0076] 401. In the target field of the file header, determine the target class data segment, the target class data segment includes the method corresponding to the target class of the set programming language.

[0077] 402. Compare the method corresponding to the target class with the method included in the classification corresponding to the target class to determine a second target method with the same method name.

[0078] In specific implementation, the target class data segment can be determined from the target field of the file header (i.e., the above-mentioned _DATA field), and the target class data segment contains the method corresponding to the target class of the set programming language, and its specific form can be the _objc_classlist segment. In the _objc_classlist segment, the method information of the target class is generally stored in the class_ro_t structure. By reading the method field of the class_ro_t structure and comparing these method fields with the method fields (i.e., "instance_methods" and "class_methods") previously read from the objc_catlist segment by method name or unique identifier (such as selector), the second target method with the same method name in the target class and its corresponding multiple categories can be determined.

[0079] By using the above method to determine the second target method, developers can be warned in time to remind them that there is a second target method with the same method name, so that developers can handle the second target method with the same method name accordingly, thereby effectively avoiding method coverage and ensuring the stable operation of the application.

[0080] In summary, the same-name processing method provided by the embodiment of the present invention can obtain the method information of the methods corresponding to multiple categories by obtaining the executable file of the target application and parsing the executable file layer by layer (the specific layer-by-layer parsing process is as follows: first, based on the file header of the executable file, determine the classification information of multiple categories corresponding to the target class of the set programming language, and then determine the method information of the methods corresponding to the multiple categories based on the classification information), and then determine the methods with the same name in multiple categories based on the method information. The whole process does not require obtaining the source code of the target application or writing scripts, which is not only efficient but also does not affect the computer performance. By using data segments such as _objc_catlist and method64_list_t, the required data can be accurately located, meaningless data traversal and redundant processing can be avoided, and the extraction and analysis of classification methods can be quickly completed.

[0081] The following will describe in detail the processing devices of the same name in one or more embodiments of the present invention. Those skilled in the art will appreciate that these devices can be configured using commercially available hardware components through the steps taught in this solution.

[0082] Figure 5 A schematic diagram of the structure of a processing device of the same name provided by an embodiment of the present invention, such as Figure 5 As shown, the device includes: an acquisition module 11 and a determination module 12.

[0083] The acquisition module 11 is used to acquire the executable file of the target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic file information, and executable code executed when the target application runs on a set device.

[0084] The determination module 12 is used to determine the classification information of multiple categories corresponding to the target class of the set programming language based on the file header, and determine the method information of the methods corresponding to each of the multiple categories based on the classification information, and determine the methods with the same name in multiple categories based on the method information corresponding to each of the multiple categories, wherein the method is used to perform the set operation when the target application is running.

[0085] Optionally, the device further includes: a deleting module, configured to delete the first target method in the first category or the second category if it is determined that the first target method in the first category and the second category among the multiple categories has the same first target method name.

[0086] Optionally, the device also includes: a modification module, which is used to modify the method name of the first target method in the first category or the second category if it is determined that there is a first target method with the same name in the first category and the second category among the multiple categories, so that the naming of the first target method in the first category and the second category is different.

[0087] Among them, optionally, the determination module 12 is specifically used to: determine the target architecture type of the set device based on the file header information; under the target architecture type, determine the classification information of multiple categories corresponding to the target class of the set programming language based on the file header, and determine the target classification data segment in the target field in the file header, the target field is used to store data segments related to the class and classification of the set programming language, and the target classification data segment contains the classification information of multiple categories corresponding to the target class of the set programming language.

[0088] Among them, optionally, the target classification data segment contains multiple structures for storing classification information, and the structures correspond one-to-one to the classifications; the determination module 12 is also specifically used to: determine method-related fields in the structures corresponding to each of the multiple classifications; and obtain the method names contained in each of the multiple classifications based on the index information in the method-related fields.

[0089] Among them, optionally, the determination module 12 is also specifically used to: determine a target class data segment in the target field of the file header, the target class data segment containing the method corresponding to the target class of the set programming language; compare the method corresponding to the target class with the method contained in the classification corresponding to the target class, and determine a second target method with the same method name.

[0090] Optionally, the format of the data in the executable file is binary format.

[0091] Figure 5 The device shown can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.

[0092] In one possible design, the above Figure 5 The structure of the processing device of the same name shown can be implemented as an electronic device. Figure 6 As shown, the electronic device may include: a processor 21, a memory 22, and a communication interface 23. The memory 22 stores executable codes, and when the executable codes are executed by the processor 21, the processor 21 can at least implement the processing method of the same name provided in the above-mentioned embodiment.

[0093] In addition, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of an electronic device, the processor can at least implement the processing method of the same name provided in the aforementioned embodiment.

[0094] In addition, an embodiment of the present invention provides a computer program product, which includes: a computer program, when the computer program is executed by a processor of an electronic device, the processor can at least implement the processing method of the same name provided in the above embodiment.

[0095] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0096] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and application programs. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for processing homonyms, characterized in that: include: Obtaining an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic file information, and an executable code that is executed when the target application is running on a set device; Based on the file header, determining classification information of multiple classifications corresponding to the target class of the set programming language; Determining method information of methods corresponding to each of the multiple categories according to the classification information, wherein the methods are used to perform a setting operation when the target application is running; Methods with the same name in the multiple categories are determined according to the method information corresponding to each of the multiple categories.

2. The method according to claim 1, characterized in that Also includes: If it is determined that a first target method with the same name exists in a first category and a second category among the multiple categories, the first target method in the first category or the second category is deleted.

3. The method according to claim 1, characterized in that Also includes: If it is determined that the first category and the second category among the multiple categories have a first target method with the same name, the method name of the first target method in the first category or the second category is modified so that the names of the first target method in the first category and the second category are different.

4. The method according to claim 1, characterized in that: The determining, based on the file header, classification information of multiple classifications corresponding to the target class of the set programming language includes: Determining a target architecture type of the setting device based on the file header information; Under the target architecture type, based on the file header, classification information of multiple classifications corresponding to the target class of the set programming language is determined.

5. The method according to claim 1, characterized in that The determining, based on the file header, classification information of multiple classifications corresponding to the target class of the set programming language includes: In the target field in the file header, a target classification data segment is determined. The target field is used to store data segments related to the classes and classifications of the set programming language. The target classification data segment contains classification information of multiple classifications corresponding to the target class of the set programming language.

6. The method according to claim 5, characterized in that The target classification data segment includes a plurality of structures for storing classification information, and the structures correspond to the classifications one by one; and determining method information corresponding to each of the plurality of classifications according to the classification information includes: Determining method-related fields in the structures corresponding to the multiple categories respectively; Based on the index information in the method-related field, the method name contained in each of the multiple categories is obtained.

7. The method according to claim 5, characterized in that Also includes: In the target field of the file header, determining a target class data segment, the target class data segment including a method corresponding to the target class of the set programming language; The method corresponding to the target class is compared with the methods included in the classification corresponding to the target class to determine a second target method with the same method name.

8. The method according to any one of claims 1 to 7, characterized in that: The format of the data in the executable file is binary format.

9. A homonymous processing device, characterized in that: include: An acquisition module, used for acquiring an executable file of a target application, wherein the executable file is compiled by a set programming language, and the executable file includes a file header for storing basic information of the file, and an executable code executed when the target application is running on a set device; A determination module is used to determine, based on the file header, classification information of multiple categories corresponding to the target class of the set programming language, and to determine method information of methods corresponding to each of the multiple categories according to the classification information, and to determine methods with the same name in the multiple categories according to the method information corresponding to each of the multiple categories, wherein the method is used to perform a set operation when the target application is running.

10. An electronic device, characterized in that: include: A memory, a processor, and a communication interface; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the processing method of the same name as described in any one of claims 1 to 8.

11. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the processing method of the same name as claimed in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Malicious software detection method and device

    CN113961919A

  • Test method and device based on test case identification, electronic equipment and medium

    CN117215965A

  • Application code processing method and device, equipment and storage medium

    CN117472381A

  • Report generation method and device, equipment and medium

    CN118821739A

  • Dispersed storage network frame protocol header

    US20110261838A1