aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-10-18 07:45:39 +0200
committerTom de Vries <tdevries@suse.de>2023-10-18 07:45:39 +0200
commit729d06679453542eee92e16b45aee00aa67f9a13 (patch)
treedcf730450523ced03b450e824db59d0c93d1178e /gdb/dwarf2
parent4352c0ac04a67875b1642caed6a74dfb8719e425 (diff)
downloadgdb-729d06679453542eee92e16b45aee00aa67f9a13.zip
gdb-729d06679453542eee92e16b45aee00aa67f9a13.tar.gz
gdb-729d06679453542eee92e16b45aee00aa67f9a13.tar.bz2
[gdb/symtab] Fix style issues in v9 .gdb_index section support
Post-commit review pointed out a few style issues in commit 8b9c08eddac ("[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 <tom@tromey.com> Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/index-write.c8
-rw-r--r--gdb/dwarf2/read-gdb-index.c8
-rw-r--r--gdb/dwarf2/read.c4
-rw-r--r--gdb/dwarf2/read.h10
4 files changed, 15 insertions, 15 deletions
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 6ea4217..6a21af8 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1196,12 +1196,12 @@ write_cooked_index (cooked_index *table,
/* Write shortcut information. */
static void
-write_shortcuts_table (cooked_index *table, data_buf& shortcuts,
- data_buf& cpool)
+write_shortcuts_table (cooked_index *table, data_buf &shortcuts,
+ data_buf &cpool)
{
const auto main_info = table->get_main ();
size_t main_name_offset = 0;
- dwarf_source_language dw_lang = (dwarf_source_language)0;
+ dwarf_source_language dw_lang = (dwarf_source_language) 0;
if (main_info != nullptr)
{
@@ -1217,7 +1217,7 @@ write_shortcuts_table (cooked_index *table, data_buf& shortcuts,
}
}
- shortcuts.append_uint (4, BFD_ENDIAN_LITTLE, dw_lang);
+ shortcuts.append_offset (dw_lang);
shortcuts.append_offset (main_name_offset);
}
diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index b96eaa9..34c5dfd 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -777,10 +777,10 @@ static void
set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
mapped_gdb_index *index)
{
- const auto expected_size = 4 + sizeof (offset_type);
+ const auto expected_size = 2 * sizeof (offset_type);
if (index->shortcut_table.size () < expected_size)
/* The data in the section is not present, is corrupted or is in a version
- * we don't know about. Regardless, we can't make use of it. */
+ we don't know about. Regardless, we can't make use of it. */
return;
auto ptr = index->shortcut_table.data ();
@@ -794,7 +794,7 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
if (dw_lang == 0)
{
/* Don't bother if the language for the main symbol was not known or if
- * there was no main symbol at all when the index was built. */
+ there was no main symbol at all when the index was built. */
return;
}
ptr += 4;
@@ -803,7 +803,7 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile,
const auto name_offset = extract_unsigned_integer (ptr,
sizeof (offset_type),
BFD_ENDIAN_LITTLE);
- const auto name = (const char*) (index->constant_pool.data () + name_offset);
+ const auto name = (const char *) (index->constant_pool.data () + name_offset);
set_objfile_main_name (per_objfile->objfile, name, (enum language) lang);
}
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 2eb34b2..c85eaac 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -21750,7 +21750,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die,
/* Set the language we're debugging. */
attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu);
enum language lang;
- dwarf_source_language dw_lang = (dwarf_source_language)0;
+ dwarf_source_language dw_lang = (dwarf_source_language) 0;
if (cu->producer != nullptr
&& strstr (cu->producer, "IBM XL C for OpenCL") != NULL)
{
@@ -21771,7 +21771,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die,
else if (attr != nullptr)
{
lang = dwarf_lang_to_enum_language (attr->constant_value (0));
- dw_lang = (dwarf_source_language)attr->constant_value (0);
+ dw_lang = (dwarf_source_language) attr->constant_value (0);
}
else
lang = pretend_language;
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 1d9432c..c92474d 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -246,11 +246,11 @@ public:
std::vector <dwarf2_per_cu_data *> *imported_symtabs = nullptr;
/* The original DW_LANG_* value of the CU, as provided to us by
- * DW_AT_language. It is interesting to keep this value around in cases where
- * we can't use the values from the language enum, as the mapping to them is
- * lossy, and, while that is usually fine, things like the index have an
- * understandable bias towards not exposing internal GDB structures to the
- * outside world, and so prefer to use DWARF constants in their stead. */
+ DW_AT_language. It is interesting to keep this value around in cases where
+ we can't use the values from the language enum, as the mapping to them is
+ lossy, and, while that is usually fine, things like the index have an
+ understandable bias towards not exposing internal GDB structures to the
+ outside world, and so prefer to use DWARF constants in their stead. */
dwarf_source_language dw_lang;
/* Return true of IMPORTED_SYMTABS is empty or not yet allocated. */