This is the mail archive of the gdb@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]

Re: bitwise operations on registers


On Thu, Mar 14, 2002 at 08:08:13PM -0800, Andrew Morton wrote:
> Andrew Cagney wrote:
> > 
> > Andrew,
> > 
> > Sounds like a bug report is in order (http://sources.redhat.com/gdb/bugs)
> 
> Done.  Thanks, guys.
> 
> Mind if I ask a little usage question while I'm here?
> 
> The kernel has various funky tricks which I'd like to be
> able to express in the debugger.  For example, the currently-running
> task's controlling structure is always at
> 
> 	*($esp & ~8191).
> 
> So it would be convenient to be able to do
> 
> 	define current ((struct task_struct *)($esp & ~8191))
> 
> then
> 
> (gdb) p current->pid

Can't really do this, but you can at least:
define current
((struct task_struct *)($esp & ~8191))
end

(gdb) current
$33 = <blah>
(gdb) $33->pid


> That's a simple one.  More complex is a representation of
> the kernel's trick of using negative offsetof() to go from
> a doubly-linked-list structure back to the start of its containing
> object.  The list_entry() macro.
> 
> But alas, as far as I know, none of this is possible.
> 
> Any pointers to how one could set about doing all of this?

No generic way to do it, you do have some userdefined function
capability.  As you find specific shortcomings, file bugs :)

For instance: macros that return values would be useful.  offsetof
would be useful.


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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