This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA/Darwin] Fix starting address scan for binary with only one section
- From: Xavier Roirand <roirand at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: brobecker at adacore dot com, tgingold at free dot fr, Xavier Roirand <roirand at adacore dot com>
- Date: Thu, 1 Mar 2018 18:15:25 +0100
- Subject: [RFA/Darwin] Fix starting address scan for binary with only one section
- Authentication-results: sourceware.org; auth=none
When binary has only one section, bfd_mach_o_scan_start_address
do not calculate properly starting address.
This patch fixes it.
gdb/ChangeLog:
* mach-o.c (bfd_mach_o_scan_start_address): Handle binary
with only one section.
---
bfd/mach-o.c | 2 +-
gdb/ChangeLog | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index f26be0c73e..3312882e16 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -4827,7 +4827,7 @@ bfd_mach_o_scan_start_address (bfd *abfd)
thr = &cmd->command.thread;
break;
}
- else if (cmd->type == BFD_MACH_O_LC_MAIN && mdata->nsects > 1)
+ else if (cmd->type == BFD_MACH_O_LC_MAIN && mdata->nsects >= 1)
{
bfd_mach_o_main_command *main_cmd = &cmd->command.main;
bfd_mach_o_section *text_sect = mdata->sections[0];
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 59265157b4..087cf53775 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-01 Tristan Gingold <gingold@adacore.com>
+
+ Pushed by Xavier Roirand <roirand@adacore.com>
+ * mach-o.c (bfd_mach_o_scan_start_address): Handle binary
+ with only one section.
+
2018-02-28 Sergio Durigan Junior <sergiodj@redhat.com>
Simon Marchi <simon.marchi@polymtl.ca>
--
2.14.3 (Apple Git-98)