--- gdb/tilegx-tdep.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c index 2c4e349..f8a6255 100644 --- a/gdb/tilegx-tdep.c +++ b/gdb/tilegx-tdep.c @@ -424,15 +424,18 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch, /* Retrieve the next instruction. */ if (next_addr - instbuf_start >= instbuf_size) { - /* Figure out how many bytes to fetch. Don't span a page + /* Figure out how many bytes to fetch. Don't span a section boundary since that might cause an unnecessary memory error. */ - unsigned int size_on_same_page = 4096 - (next_addr & 4095); + unsigned int size_on_same_section; + struct obj_section *s = find_pc_section(next_addr); + gdb_assert(s != NULL); + size_on_same_section = + s->the_bfd_section->vma + s->the_bfd_section->size - next_addr; instbuf_size = sizeof instbuf; - if (instbuf_size > size_on_same_page) - instbuf_size = size_on_same_page; + if (instbuf_size > size_on_same_section) + instbuf_size = size_on_same_section; instbuf_start = next_addr; status = safe_frame_unwind_memory (next_frame, instbuf_start, -- 1.8.1