@@ -788,42 +788,48 @@ get_uint64(const uint8_t *p)
788
788
}
789
789
790
790
static uint8_t
791
- read_uint8 (char * * ptr ) {
791
+ read_uint8 (char * * ptr )
792
+ {
792
793
const unsigned char * p = (const unsigned char * )* ptr ;
793
794
* ptr = (char * )(p + 1 );
794
795
return * p ;
795
796
}
796
797
797
798
static uint16_t
798
- read_uint16 (char * * ptr ) {
799
+ read_uint16 (char * * ptr )
800
+ {
799
801
const unsigned char * p = (const unsigned char * )* ptr ;
800
802
* ptr = (char * )(p + 2 );
801
803
return get_uint16 (p );
802
804
}
803
805
804
806
static uint32_t
805
- read_uint24 (char * * ptr ) {
807
+ read_uint24 (char * * ptr )
808
+ {
806
809
const unsigned char * p = (const unsigned char * )* ptr ;
807
810
* ptr = (char * )(p + 3 );
808
811
return (* p << 16 ) | get_uint16 (p + 1 );
809
812
}
810
813
811
814
static uint32_t
812
- read_uint32 (char * * ptr ) {
815
+ read_uint32 (char * * ptr )
816
+ {
813
817
const unsigned char * p = (const unsigned char * )* ptr ;
814
818
* ptr = (char * )(p + 4 );
815
819
return get_uint32 (p );
816
820
}
817
821
818
822
static uint64_t
819
- read_uint64 (char * * ptr ) {
823
+ read_uint64 (char * * ptr )
824
+ {
820
825
const unsigned char * p = (const unsigned char * )* ptr ;
821
826
* ptr = (char * )(p + 8 );
822
827
return get_uint64 (p );
823
828
}
824
829
825
- uint64_t
826
- read_uint (DebugInfoReader * reader ) {
830
+ static uint64_t
831
+ read_uint (DebugInfoReader * reader )
832
+ {
827
833
uint64_t v ;
828
834
if (reader -> format == 32 ) {
829
835
v = read_uint32 (& reader -> p );
@@ -833,13 +839,13 @@ read_uint(DebugInfoReader *reader) {
833
839
return v ;
834
840
}
835
841
836
- uint64_t
842
+ static uint64_t
837
843
read_uleb128 (DebugInfoReader * reader )
838
844
{
839
845
return uleb128 (& reader -> p );
840
846
}
841
847
842
- int64_t
848
+ static int64_t
843
849
read_sleb128 (DebugInfoReader * reader )
844
850
{
845
851
return sleb128 (& reader -> p );
@@ -1176,7 +1182,8 @@ debug_info_reader_read_value(DebugInfoReader *reader, uint64_t form, DebugInfoVa
1176
1182
1177
1183
/* find abbrev in current compilation unit */
1178
1184
static char *
1179
- di_find_abbrev (DebugInfoReader * reader , uint64_t abbrev_number ) {
1185
+ di_find_abbrev (DebugInfoReader * reader , uint64_t abbrev_number )
1186
+ {
1180
1187
char * p ;
1181
1188
if (abbrev_number < ABBREV_TABLE_SIZE ) {
1182
1189
return reader -> abbrev_table [abbrev_number ];
@@ -1210,7 +1217,8 @@ di_find_abbrev(DebugInfoReader *reader, uint64_t abbrev_number) {
1210
1217
1211
1218
#if 0
1212
1219
static void
1213
- div_inspect (DebugInfoValue * v ) {
1220
+ div_inspect (DebugInfoValue * v )
1221
+ {
1214
1222
switch (v -> type ) {
1215
1223
case VAL_uint :
1216
1224
fprintf (stderr ,"%d: type:%d size:%zx v:%lx\n" ,__LINE__ ,v -> type ,v -> size ,v -> as .uint64 );
@@ -1230,7 +1238,8 @@ div_inspect(DebugInfoValue *v) {
1230
1238
#endif
1231
1239
1232
1240
static DIE *
1233
- di_read_die (DebugInfoReader * reader , DIE * die ) {
1241
+ di_read_die (DebugInfoReader * reader , DIE * die )
1242
+ {
1234
1243
uint64_t abbrev_number = uleb128 (& reader -> p );
1235
1244
if (abbrev_number == 0 ) {
1236
1245
reader -> level -- ;
@@ -1249,7 +1258,8 @@ di_read_die(DebugInfoReader *reader, DIE *die) {
1249
1258
}
1250
1259
1251
1260
static DebugInfoValue *
1252
- di_read_record (DebugInfoReader * reader , DebugInfoValue * vp ) {
1261
+ di_read_record (DebugInfoReader * reader , DebugInfoValue * vp )
1262
+ {
1253
1263
uint64_t at = uleb128 (& reader -> q );
1254
1264
uint64_t form = uleb128 (& reader -> q );
1255
1265
if (!at || !form ) return NULL ;
@@ -1260,7 +1270,8 @@ di_read_record(DebugInfoReader *reader, DebugInfoValue *vp) {
1260
1270
}
1261
1271
1262
1272
static void
1263
- di_skip_records (DebugInfoReader * reader ) {
1273
+ di_skip_records (DebugInfoReader * reader )
1274
+ {
1264
1275
for (;;) {
1265
1276
DebugInfoValue v = {{}};
1266
1277
uint64_t at = uleb128 (& reader -> q );
@@ -1280,25 +1291,29 @@ typedef struct {
1280
1291
} ranges_t ;
1281
1292
1282
1293
static void
1283
- ranges_set_low_pc (ranges_t * ptr , uint64_t low_pc ) {
1294
+ ranges_set_low_pc (ranges_t * ptr , uint64_t low_pc )
1295
+ {
1284
1296
ptr -> low_pc = low_pc ;
1285
1297
ptr -> low_pc_set = true;
1286
1298
}
1287
1299
1288
1300
static void
1289
- ranges_set_high_pc (ranges_t * ptr , uint64_t high_pc ) {
1301
+ ranges_set_high_pc (ranges_t * ptr , uint64_t high_pc )
1302
+ {
1290
1303
ptr -> high_pc = high_pc ;
1291
1304
ptr -> high_pc_set = true;
1292
1305
}
1293
1306
1294
1307
static void
1295
- ranges_set_ranges (ranges_t * ptr , uint64_t ranges ) {
1308
+ ranges_set_ranges (ranges_t * ptr , uint64_t ranges )
1309
+ {
1296
1310
ptr -> ranges = ranges ;
1297
1311
ptr -> ranges_set = true;
1298
1312
}
1299
1313
1300
1314
static uintptr_t
1301
- ranges_include (DebugInfoReader * reader , ranges_t * ptr , uint64_t addr ) {
1315
+ ranges_include (DebugInfoReader * reader , ranges_t * ptr , uint64_t addr )
1316
+ {
1302
1317
if (ptr -> high_pc_set ) {
1303
1318
if (ptr -> ranges_set || !ptr -> low_pc_set ) {
1304
1319
exit (1 );
@@ -1328,7 +1343,8 @@ ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) {
1328
1343
1329
1344
#if 0
1330
1345
static void
1331
- ranges_inspect (DebugInfoReader * reader , ranges_t * ptr ) {
1346
+ ranges_inspect (DebugInfoReader * reader , ranges_t * ptr )
1347
+ {
1332
1348
if (ptr -> high_pc_set ) {
1333
1349
if (ptr -> ranges_set || !ptr -> low_pc_set ) {
1334
1350
fprintf (stderr ,"low_pc_set:%d high_pc_set:%d ranges_set:%d\n" ,ptr -> low_pc_set ,ptr -> high_pc_set ,ptr -> ranges_set );
@@ -1358,7 +1374,8 @@ ranges_inspect(DebugInfoReader *reader, ranges_t *ptr) {
1358
1374
#endif
1359
1375
1360
1376
static void
1361
- read_abstract_origin (DebugInfoReader * reader , uint64_t abstract_origin , line_info_t * line ) {
1377
+ read_abstract_origin (DebugInfoReader * reader , uint64_t abstract_origin , line_info_t * line )
1378
+ {
1362
1379
char * p = reader -> p ;
1363
1380
char * q = reader -> q ;
1364
1381
int level = reader -> level ;
@@ -1490,7 +1507,9 @@ uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr)
1490
1507
return 0 ;
1491
1508
}
1492
1509
1493
- void hexdump0 (const unsigned char * p , size_t n ) {
1510
+ static void
1511
+ hexdump0 (const unsigned char * p , size_t n )
1512
+ {
1494
1513
size_t i ;
1495
1514
fprintf (stderr , " 0 1 2 3 4 5 6 7 8 9 A B C D E F\n" );
1496
1515
for (i = 0 ; i < n ; i ++ ){
@@ -1766,7 +1785,8 @@ main_exe_path(void)
1766
1785
#endif
1767
1786
1768
1787
static void
1769
- print_line0 (line_info_t * line , void * address ) {
1788
+ print_line0 (line_info_t * line , void * address )
1789
+ {
1770
1790
uintptr_t addr = (uintptr_t )address ;
1771
1791
uintptr_t d = addr - line -> saddr ;
1772
1792
if (!address ) {
@@ -1803,7 +1823,8 @@ print_line0(line_info_t *line, void *address) {
1803
1823
}
1804
1824
1805
1825
static void
1806
- print_line (line_info_t * line , void * address ) {
1826
+ print_line (line_info_t * line , void * address )
1827
+ {
1807
1828
print_line0 (line , address );
1808
1829
if (line -> next ) {
1809
1830
print_line (line -> next , NULL );
@@ -1946,7 +1967,7 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces)
1946
1967
#define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1)
1947
1968
static inline int toupper (int c ) { return ('A' <= c && c <= 'Z' ) ? (c & 0x5f ) : c ; }
1948
1969
#define hex2ascii (hex ) (hex2ascii_data[hex])
1949
- char const hex2ascii_data [] = "0123456789abcdefghijklmnopqrstuvwxyz" ;
1970
+ static const char hex2ascii_data [] = "0123456789abcdefghijklmnopqrstuvwxyz" ;
1950
1971
static inline int imax (int a , int b ) { return (a > b ? a : b ); }
1951
1972
static int kvprintf (char const * fmt , void (* func )(int ), void * arg , int radix , va_list ap );
1952
1973
0 commit comments