Skip to content

Commit fc51f91

Browse files
committed
Fixing too-long lines and indent mistakes and
trailing whitespace. modified: src/lib/libdwarf/dwarf_fission_to_cu.c modified: src/lib/libdwarf/dwarf_loc.c Also removed #if 0 dead code. modified: src/lib/libdwarf/dwarf_loclists.c modified: src/lib/libdwarf/dwarf_rnglists.c
1 parent 716db1e commit fc51f91

File tree

4 files changed

+69
-152
lines changed

4 files changed

+69
-152
lines changed

src/lib/libdwarf/dwarf_fission_to_cu.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
#include "dwarf_loclists.h"
5050
#include "dwarf_rnglists.h"
5151

52-
/* RETURNS DW_DLV_OK and sets values
53-
through the return-value pointers.
54-
Or returns DW_DLV_NO_ENTRY */
52+
/* RETURNS DW_DLV_OK and sets values
53+
through the return-value pointers.
54+
Or returns DW_DLV_NO_ENTRY */
5555
int
5656
_dwarf_has_SECT_fission(Dwarf_CU_Context ctx,
5757
unsigned int SECT_number,
@@ -63,15 +63,13 @@ _dwarf_has_SECT_fission(Dwarf_CU_Context ctx,
6363

6464
fis = &ctx->cc_dwp_offsets;
6565
if (fis->pcu_type && fis->pcu_size[fisindex]) {
66-
*loclistsbase = fis->pcu_offset[fisindex];
67-
*hasfissionoffset = TRUE;
66+
*loclistsbase = fis->pcu_offset[fisindex];
67+
*hasfissionoffset = TRUE;
6868
return DW_DLV_OK;
6969
}
7070
return DW_DLV_NO_ENTRY;
7171
}
7272

73-
74-
7573
/* ASSERT: dbg,cu_context, and fsd are non-NULL
7674
as the caller ensured that.
7775
With no DW_AT_loclists_base this computes one. */

src/lib/libdwarf/dwarf_loc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ dwarf_get_loclist_c(Dwarf_Attribute attr,
16341634
if (form == DW_FORM_loclistx || form == DW_FORM_sec_offset) {
16351635
/* Aimed at DWARF5 and later */
16361636
res = dwarf_global_formref_b(attr,&attr_val,
1637-
&offset_is_info,error);
1637+
&offset_is_info,error);
16381638
if (res != DW_DLV_OK) {
16391639
return res;
16401640
}
@@ -1651,7 +1651,8 @@ dwarf_get_loclist_c(Dwarf_Attribute attr,
16511651
} else if (DBG_HAS_SECONDARY(dbg)){
16521652
dbg = dbg->de_secondary_dbg;
16531653
CHECK_DBG(dbg,error,
1654-
"dwarf_loclists_get_lle_head() via attribute(sec)");
1654+
"dwarf_loclists_get_lle_head() "
1655+
"via attribute(sec)");
16551656
}
16561657
} else {
16571658
/* attr_val is .debug_loclists[.dwo]

src/lib/libdwarf/dwarf_loclists.c

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ _dwarf_internal_read_loclists_header(Dwarf_Debug dbg,
501501
} /* else no offset table */
502502

503503
buildhere->lc_offsets_off_in_sect = offset+localoff;
504-
buildhere->lc_first_loclist_offset =
504+
buildhere->lc_first_loclist_offset =
505505
buildhere->lc_offsets_off_in_sect + lists_len;
506506
buildhere->lc_loclists_header = startdata;
507507
buildhere->lc_endaddr = startdata + buildhere->lc_length;
@@ -949,7 +949,7 @@ int dwarf_get_loclist_lle(Dwarf_Debug dbg,
949949

950950
/* We have more data than we need here if the compiler
951951
provided a loclists_base_address or provided
952-
a DW_SECT_LOCLISTS Per_CU value set for loclists.
952+
a DW_SECT_LOCLISTS Per_CU value set for loclists.
953953
Or we plucked an offset from .debug_addr. */
954954
static int
955955
_dwarf_which_loclists_context(Dwarf_Debug dbg,
@@ -976,29 +976,28 @@ _dwarf_which_loclists_context(Dwarf_Debug dbg,
976976
return DW_DLV_NO_ENTRY;
977977
}
978978
if (count == 1) {
979-
*index = 0;
979+
*index = 0;
980980
return DW_DLV_OK;
981981
}
982982

983-
984983
if (ctx->cc_loclists_base_present) {
985984
loclists_base_present = ctx->cc_loclists_base_present;
986985
loclists_base = ctx->cc_loclists_base;
987986
found_base = TRUE;
988987
chosen_offset = loclists_base;
989-
}
988+
}
990989
if (!found_base) {
991-
res = _dwarf_has_SECT_fission(ctx,
992-
DW_SECT_LOCLISTS,
993-
&loclists_base_present,&loclists_base);
994-
if (res == DW_DLV_OK) {
995-
found_base = TRUE;
996-
chosen_offset = loclists_base;
997-
}
990+
res = _dwarf_has_SECT_fission(ctx,
991+
DW_SECT_LOCLISTS,
992+
&loclists_base_present,&loclists_base);
993+
if (res == DW_DLV_OK) {
994+
found_base = TRUE;
995+
chosen_offset = loclists_base;
996+
}
998997
}
999998
if (!found_base) {
1000-
loclists_base = loclist_offset;
1001-
chosen_offset = loclist_offset;
999+
loclists_base = loclist_offset;
1000+
chosen_offset = loclist_offset;
10021001
}
10031002

10041003
rcx = array[i];
@@ -1039,21 +1038,21 @@ _dwarf_which_loclists_context(Dwarf_Debug dbg,
10391038
dwarfstring_destructor(&m);
10401039
return DW_DLV_ERROR;
10411040
}
1042-
}
1041+
}
10431042
{
1044-
dwarfstring m;
1043+
dwarfstring m;
10451044

1046-
dwarfstring_constructor(&m);
1047-
dwarfstring_append_printf_u(&m,
1048-
"DW_DLE_LOCLISTS_ERROR: loclist base of "
1049-
" 0x%" DW_PR_XZEROS DW_PR_DUx ,chosen_offset);
1050-
dwarfstring_append(&m,
1051-
" was not found anywhere in .debug_loclists[.dwo] "
1052-
"data. Corrupted data?");
1053-
_dwarf_error_string(dbg,error,
1054-
DW_DLE_LOCLISTS_ERROR,
1055-
dwarfstring_string(&m));
1056-
dwarfstring_destructor(&m);
1045+
dwarfstring_constructor(&m);
1046+
dwarfstring_append_printf_u(&m,
1047+
"DW_DLE_LOCLISTS_ERROR: loclist base of "
1048+
" 0x%" DW_PR_XZEROS DW_PR_DUx ,chosen_offset);
1049+
dwarfstring_append(&m,
1050+
" was not found anywhere in .debug_loclists[.dwo] "
1051+
"data. Corrupted data?");
1052+
_dwarf_error_string(dbg,error,
1053+
DW_DLE_LOCLISTS_ERROR,
1054+
dwarfstring_string(&m));
1055+
dwarfstring_destructor(&m);
10571056
}
10581057
return DW_DLV_ERROR;
10591058
}
@@ -1233,7 +1232,7 @@ _dwarf_loclists_fill_in_lle_head(Dwarf_Debug dbg,
12331232
Dwarf_Unsigned secsize = 0;
12341233

12351234
if (theform == DW_FORM_loclistx) {
1236-
is_loclistx = TRUE;
1235+
is_loclistx = TRUE;
12371236
} else {
12381237
offset_in_loclists = attr_val;
12391238
}
@@ -1281,7 +1280,7 @@ _dwarf_loclists_fill_in_lle_head(Dwarf_Debug dbg,
12811280
}
12821281
/* A */
12831282
if (ctx->cc_loclists_base_present) {
1284-
offset_in_loclists = ctx->cc_loclists_base;
1283+
offset_in_loclists = ctx->cc_loclists_base;
12851284
} else {
12861285
offset_in_loclists = attr_val;
12871286
}
@@ -1291,11 +1290,11 @@ _dwarf_loclists_fill_in_lle_head(Dwarf_Debug dbg,
12911290
"DW_DLE_LLE_ERROR: a .debug_loclists offset "
12921291
"is greater than the loclists section size");
12931292
return DW_DLV_ERROR;
1294-
}
1293+
}
12951294
/* B */
12961295
{
12971296
res = _dwarf_which_loclists_context(dbg,ctx,
1298-
offset_in_loclists,
1297+
offset_in_loclists,
12991298
&loclists_contextnum,error);
13001299
if (res == DW_DLV_OK) {
13011300
/* FALL THROUGH */

src/lib/libdwarf/dwarf_rnglists.c

Lines changed: 31 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,8 @@ dwarf_get_rnglist_offset_index_value(
779779
localoffset = offsetentry_index*offset_len;
780780
if (localoffset >= con->rc_length) {
781781
_dwarf_error_string(dbg,error, DW_DLE_RLE_ERROR,
782-
"DW_DLE_RLE_ERROR: a .debug_rnglists[.dwo] section offset "
782+
"DW_DLE_RLE_ERROR: a .debug_rnglists[.dwo] "
783+
"section offset "
783784
"is greater than this rnglists table length");
784785
return DW_DLV_ERROR;
785786
}
@@ -1072,10 +1073,8 @@ _dwarf_which_rnglists_context(Dwarf_Debug dbg,
10721073
Dwarf_Bool found_base = FALSE;
10731074
Dwarf_Unsigned chosen_offset = 0;
10741075

1075-
1076-
10771076
array = dbg->de_rnglists_context;
1078-
count = dbg->de_rnglists_context_count;
1077+
count = dbg->de_rnglists_context_count;
10791078

10801079
if (!array) {
10811080
return DW_DLV_NO_ENTRY;
@@ -1089,27 +1088,25 @@ _dwarf_which_rnglists_context(Dwarf_Debug dbg,
10891088
rnglists_base = ctx->cc_rnglists_base;
10901089
found_base = TRUE;
10911090
chosen_offset = rnglists_base;
1092-
}
1091+
}
10931092
if (!found_base) {
1094-
res = _dwarf_has_SECT_fission(ctx,
1095-
DW_SECT_RNGLISTS,
1096-
&rnglists_base_present,&rnglists_base);
1097-
if (res == DW_DLV_OK) {
1098-
found_base = TRUE;
1099-
chosen_offset = rnglists_base;
1100-
}
1093+
res = _dwarf_has_SECT_fission(ctx,
1094+
DW_SECT_RNGLISTS,
1095+
&rnglists_base_present,&rnglists_base);
1096+
if (res == DW_DLV_OK) {
1097+
found_base = TRUE;
1098+
chosen_offset = rnglists_base;
1099+
}
11011100
}
11021101
if (!found_base) {
1103-
rnglists_base = rnglist_offset;
1104-
chosen_offset = rnglist_offset;
1102+
rnglists_base = rnglist_offset;
1103+
chosen_offset = rnglist_offset;
11051104
}
11061105

11071106
rcx = array[i];
11081107
rcxoff = rcx->rc_header_offset;
11091108
rcxend = rcxoff + rcx->rc_length;
11101109

1111-
1112-
11131110
{
11141111
/* We look at the location of each rnglist context
11151112
to find one with the offset we want */
@@ -1143,57 +1140,21 @@ _dwarf_which_rnglists_context(Dwarf_Debug dbg,
11431140
dwarfstring_destructor(&m);
11441141
return DW_DLV_ERROR;
11451142
}
1146-
}
1147-
#if 0
1148-
else {
1149-
/* We have a DW_AT_rnglists_base (cc_rnglists_base),
1150-
let's use it. */
1151-
Dwarf_Unsigned lookfor = 0;;
1152-
1153-
lookfor = ctx->cc_rnglists_base;
1154-
for ( i = 0 ; i < count; ++i) {
1155-
dwarfstring m;
1156-
Dwarf_Rnglists_Context rcx = array[i];
1157-
1158-
if (rcx->rc_offsets_off_in_sect == lookfor){
1159-
*index = i;
1160-
return DW_DLV_OK;
1161-
}
1162-
if (rcx->rc_offsets_off_in_sect < lookfor){
1163-
continue;
1164-
}
1165-
1166-
dwarfstring_constructor(&m);
1167-
dwarfstring_append_printf_u(&m,
1168-
"DW_DLE_RNGLISTS_ERROR: rnglists base of "
1169-
" 0x%" DW_PR_XZEROS DW_PR_DUx ,chosen_offset);
1170-
dwarfstring_append_printf_u(&m,
1171-
" was not found though we are now at base "
1172-
" 0x%" DW_PR_XZEROS DW_PR_DUx ,
1173-
rcx->rc_offsets_off_in_sect);
1174-
_dwarf_error_string(dbg,error,
1175-
DW_DLE_RNGLISTS_ERROR,
1176-
dwarfstring_string(&m));
1177-
dwarfstring_destructor(&m);
1178-
return DW_DLV_ERROR;
1179-
}
1180-
{
1181-
#endif
1182-
1143+
}
11831144
{
1184-
dwarfstring m;
1145+
dwarfstring m;
11851146

1186-
dwarfstring_constructor(&m);
1187-
dwarfstring_append_printf_u(&m,
1188-
"DW_DLE_RNGLISTS_ERROR: rnglist base of "
1189-
" 0x%" DW_PR_XZEROS DW_PR_DUx ,chosen_offset);
1190-
dwarfstring_append(&m,
1191-
" was not found anywhere in .debug_rnglists[.dwo] "
1192-
"data. Corrupted data?");
1193-
_dwarf_error_string(dbg,error,
1194-
DW_DLE_RNGLISTS_ERROR,
1195-
dwarfstring_string(&m));
1196-
dwarfstring_destructor(&m);
1147+
dwarfstring_constructor(&m);
1148+
dwarfstring_append_printf_u(&m,
1149+
"DW_DLE_RNGLISTS_ERROR: rnglist base of "
1150+
" 0x%" DW_PR_XZEROS DW_PR_DUx ,chosen_offset);
1151+
dwarfstring_append(&m,
1152+
" was not found anywhere in .debug_rnglists[.dwo] "
1153+
"data. Corrupted data?");
1154+
_dwarf_error_string(dbg,error,
1155+
DW_DLE_RNGLISTS_ERROR,
1156+
dwarfstring_string(&m));
1157+
dwarfstring_destructor(&m);
11971158
}
11981159
return DW_DLV_ERROR;
11991160
}
@@ -1533,42 +1494,7 @@ _dwarf_fill_in_rle_head(Dwarf_Debug dbg,
15331494

15341495
/* A */
15351496
if (ctx->cc_rnglists_base_present) {
1536-
offset_in_rnglists = ctx->cc_rnglists_base;
1537-
#if 0
1538-
else if (originalctx->cc_is_dwo) {
1539-
/* Generate a base and set as 'present'
1540-
by looking at the location offset
1541-
table that we are supposedly indexing into.
1542-
finding what the table value is.
1543-
An implicit rnglists_base.
1544-
Will not work with multiple rnglists! */
1545-
int ires = 0;
1546-
Dwarf_Unsigned ibase = 0;
1547-
1548-
ires = _dwarf_implicit_rnglists_base(dbg,
1549-
attr_val,&ibase);
1550-
if (ires != DW_DLV_OK) {
1551-
dwarfstring m;
1552-
1553-
dwarfstring_constructor(&m);
1554-
dwarfstring_append_printf_u(&m,
1555-
"DW_DLE_RNGLISTS_ERROR: rnglists table"
1556-
" index of"
1557-
" %u" ,attr_val);
1558-
dwarfstring_append(&m,
1559-
" is unusable, there is no default "
1560-
" rnglists base address ");
1561-
_dwarf_error_string(dbg,error,
1562-
DW_DLE_RNGLISTS_ERROR,
1563-
dwarfstring_string(&m));
1564-
dwarfstring_destructor(&m);
1565-
return DW_DLV_ERROR;
1566-
}
1567-
ctx->cc_rnglists_base_present = TRUE;
1568-
ctx->cc_rnglists_base = ibase;
1569-
offset_in_rnglists = ibase;
1570-
}
1571-
#endif
1497+
offset_in_rnglists = ctx->cc_rnglists_base;
15721498
} else {
15731499
offset_in_rnglists = attr_val;
15741500
}
@@ -1596,16 +1522,7 @@ _dwarf_fill_in_rle_head(Dwarf_Debug dbg,
15961522
} else {
15971523
return res;
15981524
}
1599-
16001525
}
1601-
#if 0
1602-
else {
1603-
/* For DWO rnglists use gcc/clang approach missing
1604-
DW_AT_rnglists_base.
1605-
Examples seem to have just 1 rnglists_context.*/
1606-
rnglists_contextnum = 0;
1607-
}
1608-
#endif
16091526
/* C */
16101527
array = localdbg->de_rnglists_context;
16111528
rctx = array[rnglists_contextnum];
@@ -1667,14 +1584,16 @@ _dwarf_fill_in_rle_head(Dwarf_Debug dbg,
16671584
table_entry,offsetsize,error,enddata);
16681585
if (table_entryval >= secsize) {
16691586
_dwarf_error_string(dbg,error, DW_DLE_RLE_ERROR,
1670-
"DW_DLE_RLE_ERROR: a .debug_rnglists[.dwo] table entry "
1587+
"DW_DLE_RLE_ERROR: a .debug_rnglists[.dwo] "
1588+
"table entry "
16711589
"value is impossibly large");
16721590
return DW_DLV_ERROR;
16731591
}
16741592
if ((rctx->rc_offsets_off_in_sect +
16751593
table_entryval) >= secsize) {
16761594
_dwarf_error_string(dbg,error, DW_DLE_RLE_ERROR,
1677-
"DW_DLE_RLE_ERROR: a .debug_rnglist[.dwo]s table entry "
1595+
"DW_DLE_RLE_ERROR: a .debug_rnglist[.dwo]s "
1596+
"table entry "
16781597
"value + section offset is impossibly large");
16791598
return DW_DLV_ERROR;
16801599
}

0 commit comments

Comments
 (0)