attach u/i oddity

Pedro Alves pedro@codesourcery.com
Tue Oct 11 11:17:00 GMT 2011


On Tuesday 11 October 2011 07:16:36, Joel Brobecker wrote:
> > The user never specified forever.x32 as the program to debug, gdb was
> > being clever.  However, if it's going to be clever the first time,
> > it's a bug (from the user's perspective) to not be clever the second
> > time too (IMO).
> 
> I agree. I was surprised by the reported behavior.

I can't see how to change that while both keeping it simple, and
avoiding breaking valid use cases.  Users need to be able to specify a
different executable/file than what the OS reports the process is running,
and "file FOO; attach PID" is the idiom GDB uses since forever for that.
Maybe what we need a `warning' so that the surprise is gone:

 "warning: assuming process is running the loaded executable `FOO'
  which is different from the executable the target reports the process "
  is running.  Unload it with the `file' command to make gdb find and load
  the target reported executable automatically."

( certainly needs copy/editing :-) )

Note this would be tricky to get right for remote targets.  Also,
not all targets can fetch the running executable on attach.

-- 
Pedro Alves



More information about the Gdb mailing list