The present disclosure provides a method, device, medium and device for obtaining the hidden assertion information, which includes: opening the dynamic library and mapping it to memory; finding the section header information section headers and the section table string table shstrtab through the ELF file header information elf header, wherein the section table string table shstrtab is used to describe the character information in the section headers ; traverse the section headers to obtain the symbol table symtab and the string table strtab, which are used to describe the string information corresponding to the symbol table symtab; traverse the symbol table symtab to obtain the hidden variables in the symbol table symtab. Through the above method, the hidden variables of the system can be obtained through layer by layer analysis of ELF files, and then the assertion information under Android system can be obtained. Through the assertion information analysis, the crash problem can be solved. This method provides a convenient way for engineers to develop, test, analyze and solve the crash problem, and improves the efficiency of software development.
【技术实现步骤摘要】
一种隐藏断言信息的获取方法、装置、介质和设备
本公开涉及计算机
,具体而言,涉及一种隐藏断言信息的获取方法、装置、介质和电子设备。
技术介绍
在代码的编写过程中,为了调试方便,有时会在可能出现异常的地方加一些断言,系统在运行过程中,一旦命中断言条件就会输出断言信息,紧接着系统就会崩溃。工程师通过断言信息就可以分析和解决系统崩溃的问题。对于安卓系统,同样也存在大量的断言信息,在断言信息存在的地方,就可能会随之产生大量的崩溃事件,因此需要在安卓系统崩溃后准确的获得断言信息,以分享相关问题。目前安卓系统下的断言信息都存放在隐藏的变量当中,而对于隐藏变量的获取,只有安卓系统本身才能获取,对于各种在安卓系统下运行的应用程序无法获取隐藏变量,也就无法获取位于隐藏变量中的断言信息,无法获得系统崩溃的原因,这对于应用程序的质量平台搭建来说是一个严重的缺陷。公开内容本公开的目的在于提供一种隐藏断言信息的获取方法、装置、介质和电子设备,能够解决上述提到的至少一个技术问题。具体方案如下:根据本公开的具体实施方式,第一方面,本公开提供一种隐藏断言信息的获取方法,包括:打开动态库并映射到内存;通过ELF文件的头信息ELFHeader,查找节头信息SectionHeaders和段表字符串表shstrtab,其中,所述段表字符串表shstrtab用于描述所述节头信息SectionHeaders中字符信息;遍历所述节头信息SectionHeaders,获取符号表symtab和字符串表strtab ...
【技术保护点】
1.一种隐藏断言信息的获取方法,其特征在于,包括:/n打开动态库并映射到内存;/n通过ELF文件的头信息ELF Header,查找节头信息Section Headers和段表字符串表shstrtab,其中,所述段表字符串表shstrtab用于描述所述节头信息Section Headers中字符信息;/n遍历所述节头信息Section Headers,获取符号表symtab和字符串表strtab,所述字符串表strtab用于描述所述符号表symtab对应的字符串信息;/n遍历所述符号表symtab,获取所述符号表symtab中的隐藏变量。/n
【技术特征摘要】
1.一种隐藏断言信息的获取方法,其特征在于,包括:
打开动态库并映射到内存;
通过ELF文件的头信息ELFHeader,查找节头信息SectionHeaders和段表字符串表shstrtab,其中,所述段表字符串表shstrtab用于描述所述节头信息SectionHeaders中字符信息;
遍历所述节头信息SectionHeaders,获取符号表symtab和字符串表strtab,所述字符串表strtab用于描述所述符号表symtab对应的字符串信息;
遍历所述符号表symtab,获取所述符号表symtab中的隐藏变量。
2.如权利要求1所述的方法,其特征在于,所述遍历所述符号表symtab,获取所述符号表symtab中的隐藏变量,之后还包括:
获取所述隐藏变量指向的隐藏断言信息,所述隐藏断言信息用于说明潜在的崩溃风险;
发送所述隐藏断言信息,供开发人员分析所述崩溃风险。
3.如权利要求2所述的方法,其特征在于,所述遍历所述符号表symtab,获取所述符号表symtab中的隐藏变量,包括:
遍历所述符号表symtab,查找隐藏变量白名单;
通过所述白名单获取所述符号表symtab中的隐藏变量。
4.如权利要求2所述的方法,其特征在于,所述打开动态库并映射到内存,包括:
通过应用程序调用所述动态库,并使所述动态库映射到内存。
5.一种隐藏断言信息的获取装置,其特征在于,包括:
映射单元,用于打开动态库并映射到内存;
第一获取单元,用于通过ELF文件的头信息ELFHead...
【专利技术属性】
技术研发人员:朴英敏,
申请(专利权)人:北京字节跳动网络技术有限公司,
类型:发明
国别省市:北京;11
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。