Project

General

Profile

Feature #13280

CTF: provide option to truncate and continue

Added by Andy Fiddaman 26 days ago. Updated 12 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

See also: https://smartos.org/bugview/OS-6510

When converting some ELF objects, ctfconvert aborts because the CTF format is not able to accommodate structs, unions or enums with a large number of members since the format stores the object size in 10 bits.

% ctfconvert -o /dev/null ~/ctf/libperl.so
ctfconvert: CTF conversion failed: Limit on number of dynamic type members reached

In the case of libperl.so, there is an enumeration in charclass_invlists.h with ~1200 members.

typedef enum {
        PERL_BIN_PLACEHOLDER = 0, /* So no real value is zero */
        UNI_ADLM,
        UNI_AEGEANNUMBERS,
        UNI_AGE__10,
        UNI_AGE__11,
...
        UNI__PERL_NCHAR,
        UNI__PERL_PATWS,
        UNI__PERL_PROBLEMATIC_LOCALE_FOLDEDS_START,
        UNI__PERL_PROBLEMATIC_LOCALE_FOLDS,
        UNI__PERL_QUOTEMETA,
        UNI__PERL_SURROGATE
} binary_invlist_enum;

It would be nice if there was an option to accept truncation here and continue converting what we can, rather than ending up with an object that contains no CTF data at all.

#1

Updated by Andy Fiddaman 26 days ago

  • Description updated (diff)
#2

Updated by Electric Monk 25 days ago

  • Gerrit CR set to 1037
#3

Updated by Andy Fiddaman 12 days ago

I tested the attached with the problematic libperl.so and with a number of regression test cases.:

% ctfconvert -o /dev/null ~/ctf/libperl.so
ctfconvert: failed to add enumerator UNI_SC__HANO (1023) to <anon> (396)
ctfconvert: CTF conversion failed: Limit on number of dynamic type members reached

% ctfconvert -so test ~/ctf/libperl.so
ctfconvert: WARNING: truncating enumeration UNI_SC__HANO at <anon>

% ctfdump -S test
ctfdump: failed to dump labels: File does not contain any labels

- CTF Statistics ----------------------------------------------------------------

  total number of data objects        = 1782
...

Since the new warning callback introduced with this change is now used for each CU that is missing debug data, here's that output too:

% ctfconvert -o /dev/null ~/ctf/test
ctfconvert: WARNING: file test2.c is missing debug information
ctfconvert: WARNING: file test3.c is missing debug information
ctfconvert: CTF conversion failed due to missing debug data; use -m to override

% ctfconvert -mo test ~/ctf/test
ctfconvert: WARNING: file test2.c is missing debug information
ctfconvert: WARNING: file test3.c is missing debug information

% ctfdump -S test
ctfdump: failed to dump labels: File does not contain any labels

- CTF Statistics ----------------------------------------------------------------

  total number of data objects        = 22

Also available in: Atom PDF