Re: [RFA 1/2] Make line tables independent of progspace

Tom Tromey
2018-03-27T04:16:19Z

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> +#define SET_LINETABLE_ENTRY_ADDRESS(ENTRY, PC) \
>> + ((ENTRY).m_pc = (PC))
>> +#define LINETABLE_ENTRY_RAW_ADDRESS(ENTRY) \
>> + ((ENTRY).m_pc + 0)
>> +#define LINETABLE_ENTRY_ADDRESS(SYMTAB, ENTRY) \
>> + gdbarch_addr_bits_remove \
>> + (get_objfile_arch (SYMTAB_OBJFILE (SYMTAB)), \
>> + ((ENTRY).m_pc \
>> + + ANOFFSET (SYMTAB_OBJFILE (SYMTAB)->section_offsets, \
>> + SYMTAB_COMPUNIT (SYMTAB)->block_line_section)))

Simon> Is it possible to make these functions instead of macros? They
Simon> could even be made into methods of struct linetable_entry without
Simon> making the structure non-pod.

I did this and it does seem nicer. The call sites are shorter now and
fewer of them have to be line-wrapped.

Simon> I think it makes a good difference in terms of readability in those big ifs:

Yes, good call.

I've run the new patch through the buildbot. I'll resubmit it soon, I
just have to update the ChangeLog and rewrite the commit message.

Tom