diff options
author | Pedro Alves <palves@redhat.com> | 2017-04-04 20:03:25 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-04-04 20:03:25 +0100 |
commit | ecfb656c37b982479d8eb07f240b434772d98fd6 (patch) | |
tree | e87a230ac686748f42607b24dadb075fc0c6becd /gdb/copying.c | |
parent | d194f1fe51cb85b8a919b7ee9e3a7715b0ec9744 (diff) | |
download | gdb-ecfb656c37b982479d8eb07f240b434772d98fd6.zip gdb-ecfb656c37b982479d8eb07f240b434772d98fd6.tar.gz gdb-ecfb656c37b982479d8eb07f240b434772d98fd6.tar.bz2 |
dwarf2read.c: Make dir_index and file_name_index strong typedefs
This should help catch mistakes related to mixing the 1-based DWARF
indexes with 0-based std::vector indexes, since the new types do not
implicitly convert to anything.
The change in read_formatted_entries relates to the fact that doing
the seemingly simpler:
- uintp = &fe.dir_index;
+ uintp = (unsigned int *) &fe.dir_index;
would be undefined C/C++. So to address that, I made the function
extract the form before assigning to the file_entry. It felt natural
to use gdb::optional for "do I have this value", and this is what
motivated the previous patch that added the missing observer methods
to gdb::optional.
gdb/ChangeLog:
2017-04-04 Pedro Alves <palves@redhat.com>
* common/underlying.h: New file.
* dwarf2read.c: Include "common/gdb_optional.h" and
"common/underlying.h".
(dir_index, file_name_index): New types.
(file_entry): Use them.
(file_entry::include): Use to_underlying.
(line_header::add_file_name): Use dir_index.
(read_formatted_entries): Use gdb::optional. Read form before
writting to file_entry.
(dwarf_decode_line_header): Use dir_index.
(lnp_state_machine::current_file): Use to_underlying.
(lnp_state_machine::file): Change type to file_name_index.
(dwarf_record_line): Use to_underlying.
(init_lnp_state_machine): Use file_name_index.
(dwarf_decode_lines_1): Use dir_index and file_name_index.
Diffstat (limited to 'gdb/copying.c')
0 files changed, 0 insertions, 0 deletions