for (file_entry &fe : this->line_header->file_names ())
{
- dwarf2_start_subfile (*this, fe);
+ this->start_subfile (fe);
subfile *sf = builder->get_current_subfile ();
if (sf->symtab == nullptr)
fe.symtab = sf->symtab;
}
}
+
+/* See dwarf2/cu.h. */
+
+void
+dwarf2_cu::start_subfile (const file_entry &fe)
+{
+ std::string filename_holder;
+ const char *filename = fe.name;
+ const char *dirname = this->line_header->include_dir_at (fe.d_index);
+
+ /* In order not to lose the line information directory,
+ we concatenate it to the filename when it makes sense.
+ Note that the Dwarf3 standard says (speaking of filenames in line
+ information): ``The directory index is ignored for file names
+ that represent full path names''. Thus ignoring dirname in the
+ `else' branch below isn't an issue. */
+
+ if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
+ {
+ filename_holder = path_join (dirname, filename);
+ filename = filename_holder.c_str ();
+ }
+
+ std::string filename_for_id = this->line_header->file_file_name (fe);
+ this->get_builder ()->start_subfile (filename, filename_for_id.c_str ());
+}
+
#include "language.h"
#include "gdbsupport/unordered_set.h"
#include "dwarf2/die.h"
+#include "line-header.h"
/* Type used for delaying computation of method physnames.
See comments for compute_delayed_physnames. */
/* Create a subfile and symtab for every entry in the line_header. */
void create_subfiles_and_symtabs ();
+ /* Start a subfile for FE within this CU. */
+ void start_subfile (const file_entry &fe);
+
/* Reset the builder. */
void reset_builder () { m_builder.reset (); }
else
{
m_line_has_non_zero_discriminator = m_discriminator != 0;
- dwarf2_start_subfile (*m_cu, *fe);
+ m_cu->start_subfile (*fe);
}
}
const file_entry *fe = state_machine.current_file ();
if (fe != NULL)
- dwarf2_start_subfile (*cu, *fe);
+ cu->start_subfile (*fe);
/* Decode the table. */
while (line_ptr < line_end && !end_sequence)
comp_dir);
}
-/* See dwarf2/read.h. */
-
-void
-dwarf2_start_subfile (dwarf2_cu &cu, const file_entry &fe)
-{
- std::string filename_holder;
- const char *filename = fe.name;
- const char *dirname = cu.line_header->include_dir_at (fe.d_index);
-
- /* In order not to lose the line information directory,
- we concatenate it to the filename when it makes sense.
- Note that the Dwarf3 standard says (speaking of filenames in line
- information): ``The directory index is ignored for file names
- that represent full path names''. Thus ignoring dirname in the
- `else' branch below isn't an issue. */
-
- if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
- {
- filename_holder = path_join (dirname, filename);
- filename = filename_holder.c_str ();
- }
-
- std::string filename_for_id = cu.line_header->file_file_name (fe);
- cu.get_builder ()->start_subfile (filename, filename_for_id.c_str ());
-}
-
static void
var_decode_location (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
extern struct dwarf2_section_info *get_debug_line_section
(struct dwarf2_cu *cu);
-/* Start a subfile for FE within CU.
-
- This routine tries to keep line numbers from identical absolute and
- relative file names in a common subfile.
-
- Using the `list' example from the GDB testsuite, which resides in
- /srcdir and compiling it with Irix6.2 cc in /compdir using a filename
- of /srcdir/list0.c yields the following debugging information for list0.c:
-
- DW_AT_name: /srcdir/list0.c
- DW_AT_comp_dir: /compdir
- files.files[0].name: list0.h
- files.files[0].dir: /srcdir
- files.files[1].name: list0.c
- files.files[1].dir: /srcdir
-
- The line number information for list0.c has to end up in a single
- subfile, so that `break /srcdir/list0.c:1' works as expected.
- start_subfile will ensure that this happens provided that we pass the
- concatenation of files.files[1].dir and files.files[1].name as the
- subfile's name. */
-extern void dwarf2_start_subfile (dwarf2_cu &cu, const file_entry &fe);
-
/* A helper function that decides if a given symbol is an Ada Pragma
Import or Pragma Export. */