[RFA/Darwin] Fix starting address scan for binary with only one section
Simon Marchi
simon.marchi@polymtl.ca
Thu Mar 8 23:02:00 GMT 2018
On 2018-03-01 12:15, Xavier Roirand wrote:
> 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>
Makes sense, please push.
Thanks!
Simon
More information about the Gdb-patches
mailing list