Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: sim/rx/load.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sim/rx/load.h ('k') | sim/rx/main.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sim/rx/load.c
diff --git a/sim/rx/load.c b/sim/rx/load.c
index 39eb26166ac5de1043eecb4937451694df4ca983..f6fc56e8545df013bea164823cfb37f124fd921b 100644
--- a/sim/rx/load.c
+++ b/sim/rx/load.c
@@ -28,9 +28,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "libbfd.h"
#include "cpu.h"
#include "mem.h"
+#include "load.h"
#include "elf/internal.h"
#include "elf/common.h"
+/* Helper function for invoking a GDB-specified printf. */
+static void
+xprintf (host_callback *callback, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+
+ (*callback->vprintf_filtered) (callback, fmt, ap);
+
+ va_end (ap);
+}
+
+/* Given a file offset, look up the section name. */
+static const char *
+find_section_name_by_offset (bfd *abfd, file_ptr filepos)
+{
+ asection *s;
+
+ for (s = abfd->sections; s; s = s->next)
+ if (s->filepos == filepos)
+ return bfd_get_section_name (abfd, s);
+
+ return "(unknown)";
+}
+
/* A note about endianness and swapping...
The RX chip is CISC-like in that the opcodes are variable length
@@ -56,7 +83,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
encoded in little-endian format. */
void
-rx_load (bfd *prog)
+rx_load (bfd *prog, host_callback *callback)
{
unsigned long highest_addr_loaded = 0;
Elf_Internal_Phdr * phdrs;
@@ -105,6 +132,11 @@ rx_load (bfd *prog)
if (verbose > 1)
fprintf (stderr, "[load segment: lma=%08x vma=%08x size=%08x]\n",
(int) base, (int) p->p_vaddr, (int) size);
+ if (callback)
+ xprintf (callback,
+ "Loading section %s, size %#lx lma %08lx vma %08lx\n",
+ find_section_name_by_offset (prog, p->p_offset),
+ size, base, p->p_vaddr);
buf = malloc (size);
if (buf == NULL)
« no previous file with comments | « sim/rx/load.h ('k') | sim/rx/main.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698