<< pri::lacks_relocation ("abbrev table offset") << std::endl;
/* Address size. */
- if (!read_address_size (file->addr_64, &ctx, &head.address_size,
+ if (!read_address_size (&ctx, file->addr_64, &head.address_size,
&head.where))
throw check_base::failed ();
file->sec[end_symbol->st_shndx].name);
}
-bool
-read_address_size (bool elf_64,
- struct read_ctx *ctx,
- int *address_sizep,
- struct where const *where)
-{
- uint8_t address_size;
- if (!read_ctx_read_ubyte (ctx, &address_size))
- {
- wr_error (where, ": can't read address size.\n");
- return false;
- }
-
- if (address_size != 4 && address_size != 8)
- {
- /* Keep going. Deduce the address size from ELF header, and try
- to parse it anyway. */
- wr_error (where,
- ": invalid address size: %d (only 4 or 8 allowed).\n",
- address_size);
- address_size = elf_64 ? 8 : 4;
- }
- else if ((address_size == 8) != elf_64)
- /* Keep going, we may still be able to parse it. */
- wr_error (where,
- ": CU reports address size of %d in %d-bit ELF.\n",
- address_size, elf_64 ? 64 : 32);
-
- *address_sizep = address_size;
- return true;
-}
-
static void
compare_coverage (struct elf_file *file,
struct coverage *coverage, struct coverage *other,
/* Address size. */
int address_size;
- if (!read_address_size (file->addr_64, &sub_ctx, &address_size, &where))
+ if (!read_address_size (&sub_ctx, file->addr_64, &address_size, &where))
{
retval = false;
goto next;
extern bool check_zero_padding (struct read_ctx *ctx,
enum message_category category,
struct where const *wh);
- extern bool read_address_size (bool elf_64,
- struct read_ctx *ctx,
- int *address_sizep,
- struct where const *where);
struct section_coverage
{
bool
read_size_extra (struct read_ctx *ctx, uint32_t size32, uint64_t *sizep,
- int *offset_sizep, struct where *wh)
+ int *offset_sizep, struct where *where)
{
if (size32 == DWARF3_LENGTH_64_BIT)
{
if (!read_ctx_read_8ubyte (ctx, sizep))
{
- wr_error (wh, ": can't read 64bit CU length.\n");
+ wr_error (where, ": can't read 64bit CU length.\n");
return false;
}
}
else if (size32 >= DWARF3_LENGTH_MIN_ESCAPE_CODE)
{
- wr_error (wh, ": unrecognized CU length escape value: "
+ wr_error (where, ": unrecognized CU length escape value: "
"%" PRIx32 ".\n", size32);
return false;
}
return true;
}
+
+bool
+read_address_size (struct read_ctx *ctx,
+ bool addr_64,
+ int *address_sizep,
+ struct where const *where)
+{
+ uint8_t address_size;
+ if (!read_ctx_read_ubyte (ctx, &address_size))
+ {
+ wr_error (where, ": can't read address size.\n");
+ return false;
+ }
+
+ if (address_size != 4 && address_size != 8)
+ {
+ /* Keep going. Deduce the address size from ELF header, and try
+ to parse it anyway. */
+ wr_error (where,
+ ": invalid address size: %d (only 4 or 8 allowed).\n",
+ address_size);
+ address_size = addr_64 ? 8 : 4;
+ }
+ else if ((address_size == 8) != addr_64)
+ /* Keep going, we may still be able to parse it. */
+ wr_error (where,
+ ": CU reports address size of %d in %d-bit ELF.\n",
+ address_size, addr_64 ? 64 : 32);
+
+ *address_sizep = address_size;
+ return true;
+}
+
bool read_ctx_eof (struct read_ctx *ctx);
/* The following procedures build on the ones above and do their own
- error reporting. */
+ error reporting in addition. */
bool read_size_extra (struct read_ctx *ctx, uint32_t size32,
- uint64_t *sizep, int *offset_sizep, struct where *wh);
+ uint64_t *sizep, int *offset_sizep,
+ struct where *where);
+
+bool read_address_size (struct read_ctx *ctx,
+ bool addr_64,
+ int *address_sizep,
+ struct where const *where);
#ifdef __cplusplus
}