Constify linetables

Linetables no longer change after they are created.  This patch
applies const to them.

Note there is one hack to cast away const in mdebugread.c.  This code
allocates a linetable using 'malloc', then later copies it to the
obstack.  While this could be cleaned up, I chose not to do so because
I have no way of testing it.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2023-03-07 18:16:29 -07:00
parent 1acc9dca42
commit 977a0c161d
10 changed files with 54 additions and 48 deletions

View File

@@ -543,9 +543,11 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
size_t size = ((stab->linetable->nitems - 1)
* sizeof (struct linetable_entry)
+ sizeof (struct linetable));
filetab->set_linetable ((struct linetable *)
obstack_alloc (&objfile->objfile_obstack, size));
memcpy (filetab->linetable (), stab->linetable.get (), size);
struct linetable *new_table
= (struct linetable *) obstack_alloc (&objfile->objfile_obstack,
size);
memcpy (new_table, stab->linetable.get (), size);
filetab->set_linetable (new_table);
}
blockvector_size = (sizeof (struct blockvector)