This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/hppa] Can not insert breakpoint at address higher than 0xFFFFFF


Hello,

A customer of ours reported that they were unable to break on certain
symbols unless the program be started. Here is the GDB output we get:

  (gdb)  break __gnat_raise_nodefer_with_msg
  Cannot break on '__gnat_raise_nodefer_with_msg' without a running program.

This is where the problem is:

| int
| hppa_pc_requires_run_before_use (CORE_ADDR pc)
| {
|   /* Sometimes we may pluck out a minimal symbol that has a negative address. 
|   
|      An example of this occurs when an a.out is linked against a foo.sl.
|      The foo.sl defines a global bar(), and the a.out declares a signature
|      for bar().  However, the a.out doesn't directly call bar(), but passes   
|      its address in another call.
|   
|      If you have this scenario and attempt to "break bar" before running,
|      gdb will find a minimal symbol for bar() in the a.out.  But that
|      symbol's address will be negative.  What this appears to denote is
|      an index backwards from the base of the procedure linkage table (PLT)
|      into the data linkage table (DLT), the end of which is contiguous
|      with the start of the PLT.  This is clearly not a valid address for
|      us to set a breakpoint on.
|   
|      Note that one must be careful in how one checks for a negative address.  
|      0xc0000000 is a legitimate address of something in a shared text
|      segment, for example.  Since I don't know what the possible range
|      is of these "really, truly negative" addresses that come from the
|      minimal symbols, I'm resorting to the gross hack of checking the
|      top byte of the address for all 1's.  Sigh.  */
| 
|   return (!target_has_stack && (pc & 0xFF000000));
| }

The problem is that the program built by our customer is large enough
that the address of certain symbol exceeds 0xFFFFFF, and hence triggers
the condition above.

But the condition above doesn't correspond to the comment. We think it
is an error, although it's always hard to tell with a hack. Anyway,
if changed the check to make sure that *all* bits in the top byte are
1's before forcing the user to start the program for this breakpoint.
This fixes the problem.

2005-06-03  Joel Brobecker  <brobecker@adacore.com>

        * hppa-tdep.c (hppa_pc_requires_run_before_use): Really test all
        bits in of type byte in address.

Tested on hppa-hpux, no regression.
OK to apply?

Thanks,
-- 
Joel

Attachment: hppa-tdep.c.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]