mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-26 11:33:45 +08:00
Use debug_prefixed_printf_cond_nofunc in machoread
This changes machoread.c to use debug_prefixed_printf_cond_nofunc. As a side effect, the logs are now written to gdb_stdlog. This is part of PR gdb/7233. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7233
This commit is contained in:
parent
7fea6c34a1
commit
3defe97705
@ -37,6 +37,10 @@
|
||||
/* If non-zero displays debugging message. */
|
||||
static unsigned int mach_o_debug_level = 0;
|
||||
|
||||
#define macho_debug(LEVEL, FMT, ...) \
|
||||
debug_prefixed_printf_cond_nofunc (mach_o_debug_level > LEVEL, \
|
||||
"machoread", FMT, ## __VA_ARGS__)
|
||||
|
||||
/* Dwarf debugging information are never in the final executable. They stay
|
||||
in object files and the executable contains the list of object files read
|
||||
during the link.
|
||||
@ -421,9 +425,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
|
||||
/* Per section flag to mark which section have been rebased. */
|
||||
unsigned char *sections_rebased;
|
||||
|
||||
if (mach_o_debug_level > 0)
|
||||
printf_unfiltered
|
||||
(_("Loading debugging symbols from oso: %s\n"), oso->name);
|
||||
macho_debug (0, _("Loading debugging symbols from oso: %s\n"), oso->name);
|
||||
|
||||
if (!bfd_check_format (abfd.get (), bfd_object))
|
||||
{
|
||||
@ -492,13 +494,9 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
|
||||
complaint (_("Duplicated symbol %s in symbol table"), sym->name);
|
||||
else
|
||||
{
|
||||
if (mach_o_debug_level > 4)
|
||||
{
|
||||
struct gdbarch *arch = main_objfile->arch ();
|
||||
printf_unfiltered
|
||||
(_("Adding symbol %s (addr: %s)\n"),
|
||||
sym->name, paddress (arch, sym->value));
|
||||
}
|
||||
macho_debug (4, _("Adding symbol %s (addr: %s)\n"),
|
||||
sym->name, paddress (main_objfile->arch (),
|
||||
sym->value));
|
||||
ent->sym = sym;
|
||||
}
|
||||
}
|
||||
@ -566,14 +564,9 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
|
||||
{
|
||||
CORE_ADDR res = addr - sym->value;
|
||||
|
||||
if (mach_o_debug_level > 3)
|
||||
{
|
||||
struct gdbarch *arch = main_objfile->arch ();
|
||||
printf_unfiltered
|
||||
(_("resolve sect %s with %s (set to %s)\n"),
|
||||
sec->name, sym->name,
|
||||
paddress (arch, res));
|
||||
}
|
||||
macho_debug (3, _("resolve sect %s with %s (set to %s)\n"),
|
||||
sec->name, sym->name,
|
||||
paddress (main_objfile->arch (), res));
|
||||
bfd_set_section_vma (sec, res);
|
||||
sections_rebased[sec->index] = 1;
|
||||
}
|
||||
@ -843,8 +836,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
{
|
||||
struct bfd_section *asect, *dsect;
|
||||
|
||||
if (mach_o_debug_level > 0)
|
||||
printf_unfiltered (_("dsym file found\n"));
|
||||
macho_debug (0, _("dsym file found\n"));
|
||||
|
||||
/* Set dsym section size. */
|
||||
for (asect = objfile->obfd->sections, dsect = dsym_bfd->sections;
|
||||
@ -887,9 +879,8 @@ macho_symfile_relocate (struct objfile *objfile, asection *sectp,
|
||||
if ((sectp->flags & SEC_RELOC) == 0)
|
||||
return NULL;
|
||||
|
||||
if (mach_o_debug_level > 0)
|
||||
printf_unfiltered (_("Relocate section '%s' of %s\n"),
|
||||
sectp->name, objfile_name (objfile));
|
||||
macho_debug (0, _("Relocate section '%s' of %s\n"),
|
||||
sectp->name, objfile_name (objfile));
|
||||
|
||||
return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user