unstack, sort: cleanup and improvement
lets unstack (a) know about in-kernel ipc entry points and (b) be able handle >2GB symbol offsets. . sort: add -x for hex numerical sort . unstack: gnm is obsolete . unstack: datasizes is obsolete (use nm --size-sort instead) . unstack: add ipc entry points read from procfs (hex) . unstack: use sort -x to sort symbol order so the procfs ones are sorted independent of position and original ordering
This commit is contained in:
@@ -96,6 +96,7 @@ typedef struct {
|
||||
BOOL fold_case;
|
||||
BOOL ascii;
|
||||
BOOL numeric;
|
||||
BOOL hexmode;
|
||||
} FIELD;
|
||||
|
||||
/* Field declarations. A total of FILEDS_LIMIT is allowed */
|
||||
@@ -150,6 +151,7 @@ char *skip_fields(char *str, int nf);
|
||||
int compare(char *el1, char *el2);
|
||||
int cmp(unsigned char *el1, unsigned char *el2, FIELD * field);
|
||||
int digits(char *str1, char *str2, BOOL check_sign);
|
||||
int hexits(char *str1, char *str2);
|
||||
void files_merge(int file_cnt);
|
||||
void merge(int start_file, int limit_file);
|
||||
void put_line(char *line);
|
||||
@@ -250,6 +252,10 @@ register FIELD *field;
|
||||
field->numeric = TRUE;
|
||||
field->blanks = TRUE;
|
||||
break;
|
||||
case 'x':
|
||||
field->hexmode = TRUE;
|
||||
field->blanks = TRUE;
|
||||
break;
|
||||
case 'r': /* Reverse comparisons */
|
||||
field->reverse = TRUE;
|
||||
break;
|
||||
@@ -761,6 +767,8 @@ FIELD *field;
|
||||
}
|
||||
if (field->numeric) /* Compare numeric */
|
||||
return digits((char *) el1, (char *) el2, TRUE);
|
||||
if (field->hexmode) /* Compare hex */
|
||||
return hexits((char *) el1, (char *) el2);
|
||||
|
||||
for (;;) {
|
||||
while (*el1 == *el2) {
|
||||
@@ -811,6 +819,24 @@ FIELD *field;
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
int hexits(char *str1, char *str2)
|
||||
{
|
||||
unsigned long v1, v2;
|
||||
int r1, r2;
|
||||
r1 = sscanf(str1, "0x%lx", &v1);
|
||||
r2 = sscanf(str2, "0x%lx", &v2);
|
||||
|
||||
/* ordering based on reasonable hex number */
|
||||
if(r1 == 1 && r2 != 1) return HIGHER;
|
||||
if(r1 != 1 && r2 == 1) return LOWER;
|
||||
if(r1 != 1 && r2 != 1) return SAME;
|
||||
|
||||
if(v1 > v2) return HIGHER;
|
||||
if(v1 < v2) return LOWER;
|
||||
|
||||
return SAME;
|
||||
}
|
||||
|
||||
/*
|
||||
* Digits compares () the two strings that point to a number of digits followed
|
||||
* by an optional decimal point.
|
||||
|
||||
Reference in New Issue
Block a user