/* Prints an informational message regarding the lack of macro information. */ static void macro_inform_no_debuginfo (void) { puts_filtered ("GDB has no preprocessor macro information for that code.\n"); }
static void restore_section_callback(bfd *ibfd, asection *isec, void *args) { struct callback_data *data = (struct callback_data *)args; bfd_vma sec_start = bfd_section_vma(ibfd, isec); bfd_size_type size = bfd_section_size(ibfd, isec); bfd_vma sec_end = (sec_start + size); bfd_size_type sec_offset = 0UL; bfd_size_type sec_load_count = size; struct cleanup *old_chain; gdb_byte *buf; int ret; /* Ignore non-loadable sections, eg. from elf files: */ if (!(bfd_get_section_flags(ibfd, isec) & SEC_LOAD)) return; /* Does the section overlap with the desired restore range? */ if ((sec_end <= data->load_start) || ((data->load_end > 0) && (sec_start >= data->load_end))) { /* No, no useable data in this section. */ printf_filtered(_("skipping section %s...\n"), bfd_section_name(ibfd, isec)); return; } /* Compare section address range with user-requested address range (if any). Compute where the actual transfer should start and end. */ if (sec_start < data->load_start) sec_offset = (data->load_start - sec_start); /* Size of a partial transfer: */ sec_load_count -= sec_offset; if ((data->load_end > 0) && (sec_end > data->load_end)) sec_load_count -= (sec_end - data->load_end); /* Get the data. */ buf = (gdb_byte *)xmalloc((size_t)size); old_chain = make_cleanup(xfree, buf); if (!bfd_get_section_contents(ibfd, isec, buf, 0, size)) error(_("Failed to read bfd file %s: '%s'."), bfd_get_filename(ibfd), bfd_errmsg(bfd_get_error())); printf_filtered("Restoring section %s (0x%lx to 0x%lx)", bfd_section_name(ibfd, isec), (unsigned long)sec_start, (unsigned long)sec_end); if ((data->load_offset != 0) || (data->load_start != 0) || (data->load_end != 0)) printf_filtered(" into memory (0x%s to 0x%s)\n", paddr_nz((unsigned long)sec_start + sec_offset + data->load_offset), paddr_nz((unsigned long)sec_start + sec_offset + data->load_offset + sec_load_count)); else puts_filtered("\n"); /* Write the data: */ ret = target_write_memory((sec_start + sec_offset + data->load_offset), (buf + sec_offset), (int)sec_load_count); if (ret != 0) warning(_("restore: memory write failed (%s)."), safe_strerror(ret)); do_cleanups(old_chain); return; }