diff options
Diffstat (limited to 'gdb/buildsym.h')
-rw-r--r-- | gdb/buildsym.h | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 4ca8e0528f4..ee75e6fd95d 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -19,7 +19,8 @@ #if !defined (BUILDSYM_H) #define BUILDSYM_H 1 -#include "gdb_obstack.h" +#include "gdbsupport/gdb_obstack.h" +#include "symtab.h" struct objfile; struct symbol; @@ -45,18 +46,21 @@ struct dynamic_prop; struct subfile { - struct subfile *next; - /* Space for this is malloc'd. */ - char *name; - /* Space for this is malloc'd. */ - struct linetable *line_vector; - int line_vector_length; - /* The "containing" compunit. */ - struct buildsym_compunit *buildsym_compunit; - enum language language; - struct symtab *symtab; + subfile () = default; + + /* There's nothing wrong with copying a subfile, but we don't need to, so use + this to avoid copying one by mistake. */ + DISABLE_COPY_AND_ASSIGN (subfile); + + struct subfile *next = nullptr; + std::string name; + std::vector<linetable_entry> line_vector_entries; + enum language language = language_unknown; + struct symtab *symtab = nullptr; }; +using subfile_up = std::unique_ptr<subfile>; + /* Record the symbols defined for each context in a list. We don't create a struct block for the context until we know how long to make it. */ @@ -110,6 +114,20 @@ struct context_stack }; +/* Flags associated with a linetable entry. */ + +enum linetable_entry_flag : unsigned +{ + /* Indicates this PC is a good location to place a breakpoint at LINE. */ + LEF_IS_STMT = 1 << 1, + + /* Indicates this PC is a good location to place a breakpoint at the first + instruction past a function prologue. */ + LEF_PROLOGUE_END = 1 << 2, +}; +DEF_ENUM_FLAGS_TYPE (enum linetable_entry_flag, linetable_entry_flags); + + /* Buildsym's counterpart to struct compunit_symtab. */ struct buildsym_compunit @@ -132,7 +150,7 @@ struct buildsym_compunit CORE_ADDR last_addr, struct compunit_symtab *cust) : m_objfile (objfile_), m_last_source_file (name == nullptr ? nullptr : xstrdup (name)), - m_comp_dir (comp_dir_ == nullptr ? nullptr : xstrdup (comp_dir_)), + m_comp_dir (comp_dir_ == nullptr ? "" : comp_dir_), m_compunit_symtab (cust), m_language (language_), m_last_source_start_addr (last_addr) @@ -188,7 +206,7 @@ struct buildsym_compunit const char *pop_subfile (); void record_line (struct subfile *subfile, int line, CORE_ADDR pc, - bool is_stmt); + linetable_entry_flags flags); struct compunit_symtab *get_compunit_symtab () { @@ -271,13 +289,13 @@ struct buildsym_compunit struct context_stack pop_context (); - struct block *end_symtab_get_static_block (CORE_ADDR end_addr, - int expandable, int required); + struct block *end_compunit_symtab_get_static_block + (CORE_ADDR end_addr, int expandable, int required); - struct compunit_symtab *end_symtab_from_static_block - (struct block *static_block, int section, int expandable); + struct compunit_symtab *end_compunit_symtab_from_static_block + (struct block *static_block, int section, int expandable); - struct compunit_symtab *end_symtab (CORE_ADDR end_addr, int section); + struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr, int section); struct compunit_symtab *end_expandable_symtab (CORE_ADDR end_addr, int section); @@ -299,8 +317,8 @@ private: void watch_main_source_file_lossage (); - struct compunit_symtab *end_symtab_with_blockvector - (struct block *static_block, int section, int expandable); + struct compunit_symtab *end_compunit_symtab_with_blockvector + (struct block *static_block, int section, int expandable); /* The objfile we're reading debug info from. */ struct objfile *m_objfile; @@ -320,7 +338,7 @@ private: gdb::unique_xmalloc_ptr<char> m_last_source_file; /* E.g., DW_AT_comp_dir if DWARF. Space for this is malloc'd. */ - gdb::unique_xmalloc_ptr<char> m_comp_dir; + std::string m_comp_dir; /* Space for this is not malloc'd, and is assumed to have at least the same lifetime as objfile. */ |