mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Update to new API
2006-08-26 Soren Sandmann <sandmann@daimi.au.dk> * elfparser.c: Update to new API * binparser.h: Delete commented out declarations. Add new functions. * binparser.c: Delete ParserFrame, replace with one current offset. (convert_uint): Make static (bin_parser_get_uint): Delete this function (bin_parser_get_string): Change this function to use current offset instead of frame offset. (bin_parser_goto): New function (bin_parser_align): New function (bin_parser_get_uint32): New function (bin_parser_begin): Delete this function (bin_parser_end): Delete this function (bin_parser_index): Delete this function (bin_record_get_string_indirect): Make this function use _goto() instead of _begin()/_end() (bin_parser_get_offset): Make this function return current offset
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
54862afc74
commit
e44c9a0167
21
elfparser.c
21
elfparser.c
@ -483,29 +483,18 @@ elf_parser_get_debug_link (ElfParser *parser, guint32 *crc32)
|
||||
{
|
||||
const Section *debug_link = find_section (parser, ".gnu_debuglink");
|
||||
const gchar *result;
|
||||
gsize crc_offset;
|
||||
|
||||
if (!debug_link)
|
||||
return NULL;
|
||||
|
||||
bin_parser_begin (parser->parser, NULL, debug_link->offset);
|
||||
bin_parser_goto (parser->parser, debug_link->offset);
|
||||
|
||||
result = bin_parser_get_string (parser->parser);
|
||||
bin_parser_end (parser->parser);
|
||||
|
||||
crc_offset = strlen (result) + 1;
|
||||
crc_offset = (crc_offset + 3) & ~3;
|
||||
bin_parser_align (parser->parser, 4);
|
||||
|
||||
/* FIXME: This is broken for two reasons:
|
||||
*
|
||||
* (1) It assumes file_endian==machine_endian
|
||||
*
|
||||
* (2) It doesn't check for file overrun.
|
||||
*
|
||||
* The fix is to make binparser capable of dealing with stuff
|
||||
* outside of records.
|
||||
*/
|
||||
|
||||
*crc32 = *(guint32 *)(result + crc_offset);
|
||||
*crc32 = bin_parser_get_uint32 (parser->parser);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user