This is the mail archive of the insight@sourceware.org mailing list for the Insight 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]

Re: Insight cross-debugging fails... ?


On Fri, 2006-11-03 at 12:32 -0800, Keith Seitz wrote:

> "Make breakpoint pending on future shared library load?" means that the 
> symbol for which a breakpoint is requested is unknown. It thinks that 
> you want to set a break on some function that is in a shared library 
> that is not yet loaded.

But it happens right when I start Insight, before I even get a chance to
set any breakpoints.

Hm.

Maybe it's restoring breakpoints I set in a previous session?  GDB
didn't do that so I'm not used to it.  Anyway, it doesn't seem serious.

> I would think this should work, yes.

OK, I think I have a bit of a handle on this.  If I follow these steps,
it works:

     1. Start the gdbserver
     2. Start insight
     3. Use the Run -> Connect to Target menu item
     4. Use "c" (continue)

This gets me to a breakpoint right at the start of main() that seems to
be magically set up for me (I don't think I did it).  I can proceed from
there without any trouble.

The trick seems to be doing steps 3 and 4.  I got a bit confused because
when I use the "run" icon, Insight does connect to the remote target (I
see the remote target print a message saying it's being debugged), so I
thought I didn't need to explicitly connect.  This, combined with the
File -> Target Settings -> More Options section where I've checked "Run
Method" as "Continue from Last Stop" and not "Run Program" led me to
believe that Insight would DTRT (basically the same steps as above).
But it doesn't seem to.  Maybe I'm misunderstanding what that "Run
Method" option means.

In a GDB client/server model it's never correct to use the "run" command
remotely.  The program was already started by the gdbserver; you must
use "continue" only.

For example, if I start up normal GDB and connect to the remote target
and try to use "run", I get this:

     (gdb) run
     The program being debugged has been started already.
     Start it from the beginning? (y or n) y

     Starting program: /home/psmith/regutils/regget 
     Don't know how to run.  Try "help target".

and the remote client exits.

Here is my current guess as to what's going on when I click the "run"
icon in Insight, or use the "R" command (note I haven't looked at any
code so I could well be wrong):

Insight sees the target is remote, and it automatically connects.  Then,
instead of sending a "continue" command, it sends a "run" command.  The
Insight integration with GDB somehow avoids GDB's normal sanity checking
so it doesn't tell me that the program has been started already, should
I start it from the beginning, instead it just restarts it.

Then the Insight integration avoids whatever special checks GDB is doing
to detect that the program being invoked is a PPC executable and fail
gracefully with a "don't know how to run" (or maybe that's the GDB CLI
catch-all message when the subordinate program can't be exec'd).
Instead, it simply exec()s the PPC program, and exec() returns a SIGILL,
and Insight displays it.  It's confusing because you can't tell that the
SIGILL is local instead of coming from the remote.

So, if I'm right, a few things:

      * Insight needs to only ever send "continue" as the first command,
        never "run", if it's configured to connect to a remote target.
      * Insight should guard against explicit "run" commands when
        connected to a remote target as best as it can (at least when
        invoked through the menu system).
      * Maybe a special check for a SIGILL when exec'ing a local
        program.

The first one is the real bug.  The others would be much less likely if
that were resolved.

Cheers!

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <psmith@netezza.com>                       http://netezza.com
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist
-----------------------------------------------------------------------------
      These are my opinions--Netezza takes no responsibility for them.


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