Skip to content

Commit 729d066

Browse files
committed
[gdb/symtab] Fix style issues in v9 .gdb_index section support
Post-commit review pointed out a few style issues in commit 8b9c08e ("[gdb/symtab] Add name_of_main and language_of_main to the DWARF index"). Fix these. Tested on x86_64-linux. Reported-By: Tom Tromey <[email protected]> Approved-By: Tom Tromey <[email protected]>
1 parent 4352c0a commit 729d066

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

gdb/dwarf2/index-write.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,12 +1196,12 @@ write_cooked_index (cooked_index *table,
11961196
/* Write shortcut information. */
11971197

11981198
static void
1199-
write_shortcuts_table (cooked_index *table, data_buf& shortcuts,
1200-
data_buf& cpool)
1199+
write_shortcuts_table (cooked_index *table, data_buf &shortcuts,
1200+
data_buf &cpool)
12011201
{
12021202
const auto main_info = table->get_main ();
12031203
size_t main_name_offset = 0;
1204-
dwarf_source_language dw_lang = (dwarf_source_language)0;
1204+
dwarf_source_language dw_lang = (dwarf_source_language) 0;
12051205

12061206
if (main_info != nullptr)
12071207
{
@@ -1217,7 +1217,7 @@ write_shortcuts_table (cooked_index *table, data_buf& shortcuts,
12171217
}
12181218
}
12191219

1220-
shortcuts.append_uint (4, BFD_ENDIAN_LITTLE, dw_lang);
1220+
shortcuts.append_offset (dw_lang);
12211221
shortcuts.append_offset (main_name_offset);
12221222
}
12231223

gdb/dwarf2/read-gdb-index.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -777,10 +777,10 @@ static void
777777
set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
778778
mapped_gdb_index *index)
779779
{
780-
const auto expected_size = 4 + sizeof (offset_type);
780+
const auto expected_size = 2 * sizeof (offset_type);
781781
if (index->shortcut_table.size () < expected_size)
782782
/* The data in the section is not present, is corrupted or is in a version
783-
* we don't know about. Regardless, we can't make use of it. */
783+
we don't know about. Regardless, we can't make use of it. */
784784
return;
785785

786786
auto ptr = index->shortcut_table.data ();
@@ -794,7 +794,7 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
794794
if (dw_lang == 0)
795795
{
796796
/* Don't bother if the language for the main symbol was not known or if
797-
* there was no main symbol at all when the index was built. */
797+
there was no main symbol at all when the index was built. */
798798
return;
799799
}
800800
ptr += 4;
@@ -803,7 +803,7 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
803803
const auto name_offset = extract_unsigned_integer (ptr,
804804
sizeof (offset_type),
805805
BFD_ENDIAN_LITTLE);
806-
const auto name = (const char*) (index->constant_pool.data () + name_offset);
806+
const auto name = (const char *) (index->constant_pool.data () + name_offset);
807807

808808
set_objfile_main_name (per_objfile->objfile, name, (enum language) lang);
809809
}

gdb/dwarf2/read.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21750,7 +21750,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die,
2175021750
/* Set the language we're debugging. */
2175121751
attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
2175221752
enum language lang;
21753-
dwarf_source_language dw_lang = (dwarf_source_language)0;
21753+
dwarf_source_language dw_lang = (dwarf_source_language) 0;
2175421754
if (cu->producer != nullptr
2175521755
&& strstr (cu->producer, "IBM XL C for OpenCL") != NULL)
2175621756
{
@@ -21771,7 +21771,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die,
2177121771
else if (attr != nullptr)
2177221772
{
2177321773
lang = dwarf_lang_to_enum_language (attr->constant_value (0));
21774-
dw_lang = (dwarf_source_language)attr->constant_value (0);
21774+
dw_lang = (dwarf_source_language) attr->constant_value (0);
2177521775
}
2177621776
else
2177721777
lang = pretend_language;

gdb/dwarf2/read.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ struct dwarf2_per_cu_data
246246
std::vector <dwarf2_per_cu_data *> *imported_symtabs = nullptr;
247247

248248
/* The original DW_LANG_* value of the CU, as provided to us by
249-
* DW_AT_language. It is interesting to keep this value around in cases where
250-
* we can't use the values from the language enum, as the mapping to them is
251-
* lossy, and, while that is usually fine, things like the index have an
252-
* understandable bias towards not exposing internal GDB structures to the
253-
* outside world, and so prefer to use DWARF constants in their stead. */
249+
DW_AT_language. It is interesting to keep this value around in cases where
250+
we can't use the values from the language enum, as the mapping to them is
251+
lossy, and, while that is usually fine, things like the index have an
252+
understandable bias towards not exposing internal GDB structures to the
253+
outside world, and so prefer to use DWARF constants in their stead. */
254254
dwarf_source_language dw_lang;
255255

256256
/* Return true of IMPORTED_SYMTABS is empty or not yet allocated. */

0 commit comments

Comments
 (0)