Skip to content

Commit 6b133ed

Browse files
committed
All had trailing whitespace.
One or two had an indent error. modified: src/bin/dwarfdump/print_die.c modified: src/bin/dwarfgen/ireptodbg.cc modified: src/lib/libdwarf/dwarf_debugnames.c modified: src/lib/libdwarf/dwarf_elfread.c modified: src/lib/libdwarf/dwarf_macro5.c modified: src/lib/libdwarf/dwarf_query.c modified: src/lib/libdwarf/libdwarf.h
1 parent 42352f2 commit 6b133ed

File tree

7 files changed

+127
-87
lines changed

7 files changed

+127
-87
lines changed

src/bin/dwarfdump/print_die.c

Lines changed: 82 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4735,8 +4735,8 @@ print_attribute(Dwarf_Debug dbg, Dwarf_Die die,
47354735
case DW_AT_language_version: {
47364736
char atnamebuf[ESB_FIXED_ALLOC_SIZE];
47374737
struct esb_s langver;
4738-
4739-
if (fc != DW_FORM_CLASS_STRING) {
4738+
4739+
if (fc != DW_FORM_CLASS_CONSTANT) {
47404740
remark_wrong_string_format(attr,theform);
47414741
esb_destructor(&valname);
47424742
esb_destructor(&esb_extra);
@@ -4784,7 +4784,7 @@ print_attribute(Dwarf_Debug dbg, Dwarf_Die die,
47844784
&lv_lower_bound, &lv_version_details);
47854785
if (res == DW_DLV_OK) {
47864786
esb_append_printf_i(&valname,
4787-
"(low bound: %d",lv_lower_bound);
4787+
" (low bound: %d",lv_lower_bound);
47884788
if (lv_version_details) {
47894789
esb_append_printf_s(&valname,
47904790
" format: %s)",
@@ -8613,7 +8613,16 @@ get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
86138613
Dwarf_Bool hex_format = TRUE;
86148614
Dwarf_Half dwversion = 0;
86158615

8616-
formx_unsigned(tempud,esbp,hex_format);
8616+
if (attr == DW_AT_language_version) {
8617+
hex_format = FALSE;
8618+
formx_unsigned(tempud,esbp,hex_format);
8619+
esb_append(esbp," (");
8620+
hex_format = TRUE;
8621+
formx_unsigned(tempud,esbp,hex_format);
8622+
esb_append(esbp,")");
8623+
} else {
8624+
formx_unsigned(tempud,esbp,hex_format);
8625+
}
86178626
/* Check attribute encoding */
86188627
if (glflags.gf_check_attr_encoding) {
86198628
check_attributes_encoding(attr,theform,
@@ -8778,34 +8787,77 @@ get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
87788787
}
87798788
}
87808789
break;
8781-
case DW_FORM_sdata:
8782-
wres = dwarf_formsdata(attrib, &tempsd, err);
8783-
if (wres == DW_DLV_OK) {
8784-
Dwarf_Bool hxform=TRUE;
8785-
tempud = tempsd;
8786-
formx_unsigned_and_signed_if_neg(tempud,tempsd,
8787-
" (",hxform,esbp);
8788-
} else if (wres == DW_DLV_NO_ENTRY) {
8789-
/* nothing? */
8790-
} else {
8791-
print_error_and_continue(
8792-
"Cannot get DW_FORM_sdata value..",
8793-
wres, *err);
8794-
return wres;
8790+
case DW_FORM_sdata: {
8791+
Dwarf_Half attrs = 0;
8792+
int ares = 0;
8793+
Dwarf_Bool hxform=TRUE;
8794+
Dwarf_Error attrerr = 0;
8795+
8796+
ares = dwarf_whatattr(attrib, &attrs, &attrerr);
8797+
{ /* Do regardless of ares value! */
8798+
wres = dwarf_formsdata(attrib, &tempsd, err);
8799+
if (wres == DW_DLV_OK) {
8800+
tempud = tempsd;
8801+
if (attrs == DW_AT_language_version) {
8802+
hxform = FALSE;
8803+
formx_signed(tempsd,esbp);
8804+
esb_append(esbp," (");
8805+
hxform = TRUE;
8806+
formx_unsigned_and_signed_if_neg(tempud,tempsd,
8807+
" (",hxform,esbp);
8808+
esb_append(esbp,")");
8809+
} else {
8810+
formx_unsigned_and_signed_if_neg(tempud,tempsd,
8811+
" (",hxform,esbp);
8812+
}
8813+
} else if (wres == DW_DLV_NO_ENTRY) {
8814+
/* nothing? */
8815+
} else {
8816+
print_error_and_continue(
8817+
"Cannot get DW_FORM_sdata value..",
8818+
wres, *err);
8819+
return wres;
8820+
}
8821+
}
8822+
if (ares == DW_DLV_ERROR) {
8823+
/* leave no trace, caught elsewhere. */
8824+
dwarf_dealloc_error(dbg,attrerr);
8825+
}
87958826
}
87968827
break;
8797-
case DW_FORM_udata:
8798-
wres = dwarf_formudata(attrib, &tempud, err);
8799-
if (wres == DW_DLV_OK) {
8800-
Dwarf_Bool hex_format = TRUE;
8801-
formx_unsigned(tempud,esbp,hex_format);
8802-
} else if (wres == DW_DLV_NO_ENTRY) {
8803-
/* nothing? */
8804-
} else {
8805-
print_error_and_continue(
8806-
"Cannot get DW_FORM_udata value..",
8807-
wres, *err);
8808-
return wres;
8828+
case DW_FORM_udata: {
8829+
Dwarf_Half attru = 0;
8830+
int ares = 0;
8831+
Dwarf_Error attrerr = 0;
8832+
8833+
ares = dwarf_whatattr(attrib, &attru, err);
8834+
{ /* Do regardless of ares value! */
8835+
wres = dwarf_formudata(attrib, &tempud, err);
8836+
if (wres == DW_DLV_OK) {
8837+
Dwarf_Bool hex_format = TRUE;
8838+
if (attru == DW_AT_language_version) {
8839+
hex_format = FALSE;
8840+
formx_unsigned(tempud,esbp,hex_format);
8841+
esb_append(esbp," (");
8842+
hex_format = TRUE;
8843+
formx_unsigned(tempud,esbp,hex_format);
8844+
esb_append(esbp,")");
8845+
} else {
8846+
formx_unsigned(tempud,esbp,hex_format);
8847+
}
8848+
} else if (wres == DW_DLV_NO_ENTRY) {
8849+
/* nothing? */
8850+
} else {
8851+
print_error_and_continue(
8852+
"Cannot get DW_FORM_udata value..",
8853+
wres, *err);
8854+
return wres;
8855+
}
8856+
}
8857+
if (ares == DW_DLV_ERROR) {
8858+
/* leave no trace, caught elsewhere. */
8859+
dwarf_dealloc_error(dbg,attrerr);
8860+
}
88098861
}
88108862
break;
88118863
/* various forms for strings. */

src/bin/dwarfgen/ireptodbg.cc

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ createskipbranchblock(
150150
return DW_DLV_OK;
151151
}
152152

153-
static void
153+
static void
154154
addLanguageVersion(Dwarf_P_Debug dbg,
155155
IRepresentation & Irep,
156156
Dwarf_P_Die ourdie,
@@ -197,45 +197,34 @@ addLanguageVersion(Dwarf_P_Debug dbg,
197197
// add new attr.
198198

199199
IRAttr attr2(DW_AT_language_name,
200-
DW_FORM_udata,
201-
DW_FORM_udata);
200+
DW_FORM_udata,
201+
DW_FORM_udata);
202202
attr2.setFormClass(DW_FORM_CLASS_CONSTANT);
203203
IRFormConstant *f = new IRFormConstant(
204-
DW_FORM_udata,
205-
DW_FORM_udata,
206-
DW_FORM_CLASS_CONSTANT,
207-
IRFormConstant::UNSIGNED,
208-
DW_LNAME_C,
209-
0);
204+
DW_FORM_udata,
205+
DW_FORM_udata,
206+
DW_FORM_CLASS_CONSTANT,
207+
IRFormConstant::UNSIGNED,
208+
DW_LNAME_C,
209+
0);
210210
attr2.setFormData(f);
211211
revisedattrs.push_back(attr2);
212212
}
213213
if (!found_lv_version) {
214214
// add new attr.
215215
IRAttr attr2(DW_AT_language_version,
216-
DW_FORM_string,
217-
DW_FORM_string);
218-
attr2.setFormClass(DW_FORM_CLASS_STRING);
219-
IRFormString *f = new IRFormString();
220-
f->setInitialForm(DW_FORM_string);
221-
f->setFinalForm(DW_FORM_string);
222-
f->setString("YYYYMM");
216+
DW_FORM_string,
217+
DW_FORM_string);
218+
attr2.setFormClass(DW_FORM_CLASS_CONSTANT);
219+
IRFormConstant *f = new IRFormConstant(
220+
DW_FORM_udata,
221+
DW_FORM_udata,
222+
DW_FORM_CLASS_CONSTANT,
223+
IRFormConstant::UNSIGNED,
224+
199902,
225+
0);
223226
attr2.setFormData(f);
224227
revisedattrs.push_back(attr2);
225-
#if 0
226-
Dwarf_Half attrnum = DW_AT_name;
227-
const char *attrname("vardata16");
228-
IRAttr attr2(attrnum,
229-
DW_FORM_string,
230-
DW_FORM_string);
231-
attr2.setFormClass(DW_FORM_CLASS_STRING);
232-
IRFormString *f = new IRFormString();
233-
f->setInitialForm(DW_FORM_string);
234-
f->setFinalForm(DW_FORM_string);
235-
f->setString(attrname);
236-
attr2.setFormData(f);
237-
revisedattrs.push_back(attr2);
238-
#endif
239228
}
240229
// Avoid memoryleak
241230
//attr.dropFormData();

src/lib/libdwarf/dwarf_debugnames.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,9 @@ dwarf_dnames_header(Dwarf_Debug dbg,
847847
curptr += usedspace;
848848
for ( ; curptr < end_section; ++curptr) {
849849
if (*curptr) {
850-
/* Fixing Coverity Scan CID 581830
851-
resource leak if just call dealloc,
852-
so call local dealloc to do it. */
850+
/* Fixing Coverity Scan CID 581830
851+
resource leak if just call dealloc,
852+
so call local dealloc to do it. */
853853
dwarf_dealloc_dnames(dn);
854854
/* One could argue this is a harmless error,
855855
but for now assume it is real corruption. */

src/lib/libdwarf/dwarf_elfread.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ elf_load_nolibelf_section_a (void* obj,
314314
void * mmptr = 0;
315315

316316
/* pagesize is guaranteed to be a multiple of 2,
317-
and will be >= 512 and is usually 4096.
317+
and will be >= 512 and is usually 4096.
318318
this helps coverityscan know that sutracting one
319-
from pagesize will not result in an
319+
from pagesize will not result in an
320320
anomalous number. */
321321
if (pagesize < 200L || pagesize > (128L*1024L*1024L)) {
322322
/* verifying the value of pagesize to help fix

src/lib/libdwarf/dwarf_macro5.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ is_defundef(unsigned op)
315315
#endif /*0*/
316316

317317
/* On first call (for this macro_context),
318-
build_ops_array is FALSE.
319-
We just calculate
320-
macro_context->mc_macro_ops_count
318+
build_ops_array is FALSE.
319+
We just calculate
320+
macro_context->mc_macro_ops_count
321321
macro_context->mc_ops_data_length
322-
macro_context->mc_total_length
322+
macro_context->mc_total_length
323323
On second,
324324
it is TRUE and we know the count so we allocate and fill in
325325
the ops array. */
@@ -373,7 +373,7 @@ _dwarf_get_macro_ops_count_internal(Dwarf_Macro_Context macro_context,
373373
so we lose a really useful and precise error
374374
message and get this useless message. */
375375
if (known_ops_count != opcount) {
376-
_dwarf_error_string(dbg, error,
376+
_dwarf_error_string(dbg, error,
377377
DW_DLE_MACRO_OP_UNHANDLED,
378378
"DW_DLE_MACRO_OP_UNHANDLED "
379379
"A miscount of ops_count "
@@ -1631,18 +1631,18 @@ dwarf_dealloc_macro_context(Dwarf_Macro_Context mc)
16311631
if (!mc) {
16321632
return;
16331633
}
1634-
/* Fixing coverity sccan CID 531842 and CID 531840.
1634+
/* Fixing coverity sccan CID 531842 and CID 531840.
16351635
Memory leak. The destructor would do this,
16361636
but coverity scan does not seem to track that.
16371637
so we do the free()s here and removed the
1638-
use of _dwarf_macro_destructor() from dwarf_alloc.c
1638+
use of _dwarf_macro_destructor() from dwarf_alloc.c
16391639
And we will delete _dwarf_macro_destructor()
16401640
everywhere. */
16411641
dbg = mc->mc_dbg;
16421642
dealloc_macro_srcfiles(mc->mc_srcfiles, mc->mc_srcfiles_count);
16431643
mc->mc_srcfiles = 0;
16441644
mc->mc_srcfiles_count = 0;
1645-
free((void *)mc->mc_file_path);
1645+
free((void *)mc->mc_file_path);
16461646
mc->mc_file_path = 0;
16471647
free(mc->mc_ops);
16481648
mc->mc_ops = 0;

src/lib/libdwarf/dwarf_query.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,8 +1752,8 @@ dwarf_srclanglname(Dwarf_Die die,
17521752
Dwarf_Unsigned *ret_name, Dwarf_Error *error)
17531753
{
17541754
Dwarf_Unsigned luns = 0;
1755-
int res = _dwarf_die_attr_unsigned_constant(die,
1756-
DW_AT_language_name,
1755+
int res = _dwarf_die_attr_unsigned_constant(die,
1756+
DW_AT_language_name,
17571757
&luns, error);
17581758
*ret_name = luns;
17591759
return res;
@@ -2291,9 +2291,9 @@ dwarf_machine_architecture(Dwarf_Debug dbg,
22912291
dw_ub_index, dw_comdat_groupnumber);
22922292
}
22932293
/*
2294-
2294+
22952295
DWARF6 DW_LNAME values are referenced
2296-
by using dwarf_language_version_string()
2296+
by using dwarf_language_version_string()
22972297
(these are permitted in DWARF5, see
22982298
www.dwarfstd.org )
22992299

src/lib/libdwarf/libdwarf.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,10 +2901,10 @@ DW_API int dwarf_bitoffset(Dwarf_Die dw_die,
29012901
29022902
To access DW_LNAME names (in DWARF5 or later)
29032903
see dwarf_srclanglname().
2904-
To get the DW_LNAME as a string, call
2904+
To get the DW_LNAME as a string, call
29052905
dwarf_get_LNAME_name().
29062906
2907-
DWARF5 and earlier
2907+
DWARF5 and earlier
29082908
29092909
The DIE should be a CU DIE.
29102910
@param dw_die
@@ -2925,7 +2925,7 @@ DW_API int dwarf_srclang(Dwarf_Die dw_die,
29252925
/*! @brief Return the value of the DW_AT_language_name attribute.
29262926
29272927
New in v2.1.0 July 2025.
2928-
2928+
29292929
Returns a DWARF6 DW_AT language_name name.
29302930
The DW_LNAME value returned lets one access
29312931
the LNAME name as a string with dwarf_get_LNAME_name()
@@ -2935,7 +2935,7 @@ DW_API int dwarf_srclang(Dwarf_Die dw_die,
29352935
To access DW_LANG names (in DWARF5 or earlier)
29362936
see dwarf_srclang().
29372937
2938-
@param dw_die
2938+
@param dw_die
29392939
The DIE of interest, normally a CU_DIE.
29402940
@param dw_returned_lname
29412941
On success returns the language name (code) (normally
@@ -2945,9 +2945,9 @@ DW_API int dwarf_srclang(Dwarf_Die dw_die,
29452945
The usual error detail return pointer.
29462946
@return
29472947
Returns DW_DLV_OK etc.
2948-
*/
2948+
*/
29492949
DW_API int dwarf_srclanglname(Dwarf_Die dw_die,
2950-
Dwarf_Unsigned *dw_returned_lname,
2950+
Dwarf_Unsigned *dw_returned_lname,
29512951
Dwarf_Error *dw_error);
29522952

29532953
/*! @brief Return the value of the DW_AT_language_version attribute.
@@ -2972,14 +2972,13 @@ DW_API int dwarf_srclanglname(Dwarf_Die dw_die,
29722972
The usual error detail return pointer.
29732973
@return
29742974
Returns DW_DLV_OK etc.
2975-
*/
2975+
*/
29762976

29772977
DW_API int dwarf_srclanglname_version(Dwarf_Die dw_die,
2978-
const char *dw_returned_verstring,
2978+
const char *dw_returned_verstring,
29792979
Dwarf_Error *dw_error);
29802980

2981-
2982-
/*! @brief Return values associated with DW_AT_language_name
2981+
/*! @brief Return values associated with DW_AT_language_name
29832982
29842983
Returns the value of a the default-lower-bound
29852984
and a string defining the interpretation of

0 commit comments

Comments
 (0)