Re: [patch] Fixes problem setting breakpoint in dynamic loader

Daniel Jacobowitz
2006-05-25T02:26:43Z

On Wed, May 24, 2006 at 04:26:11PM -0700, PAUL GILLIAM wrote:
> + interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");

> + interp_sect = bfd_get_section_by_name (tmp_bfd, ".opd");

Magic names...

> + if (interp_sect != 0)
> + {
> + /* Try to convert the function descriptor we found above, into
> + the address we need. It will be relocated below by adding
> + "load_addr" to it. */
> + char *buf = alloca (sizeof (LONGEST));
> + if (bfd_get_section_contents (tmp_bfd, interp_sect, buf,
> + sym_addr - sect_offset,
> + sizeof (LONGEST)))
> + sym_addr = extract_unsigned_integer (buf, sizeof (LONGEST));
> + else
> + sym_addr = 0;
> + }
> + }
> +

... and a magic load; you have no idea what the format of a function
descriptor is, at this point.

Can you make convert_from_func_ptr_addr do what you need? It needs a
target_ops; conveniently you've got one (tmp_bfd_target). Some targets
use a memory read function which honors the supplied target_ops, others
don't. rs6000's doesn't so you'd need to fix that.

--
Daniel Jacobowitz
CodeSourcery