Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Looking for a gdb function to handle alias addresses
@ 2003-12-30 22:19 Paul Koning
  2003-12-30 23:00 ` Daniel Jacobowitz
  2003-12-31 17:36 ` Andrew Cagney
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Koning @ 2003-12-30 22:19 UTC (permalink / raw)
  To: gdb

Gentlepeople,

I'm working on a kernel dump analyzer integrated with gdb (similar to
the corefile support -- but with a pile of added wrinkles many of
which are specific to our particular platform).

One thing we run into from time to time is that there are several
legal addresses for the same object.  The target is MIPS-based, so an
obvious one is that a KSEG1 address (0xa0000000-0xbfffffff) aliases a
KSEG0 address (KSEG1 - 0x02000000).  Similarly, in MIPS64 there are
64-bit addresses of various forms that also alias, sometimes in more
complex ways than simply a numeric bias.

The ELF image of course has its symbols associated with one of these
addresses, typically the KSEG0 address.  As a result, when I'm dealing
with an alias address, the mapping of address to symbol doesn't work
right.  It's easy to get the right data from the dump file, but for
commands like "bt" to work, the symbol references have to come out
right. 

So... is there a standard gdb hook (say, part of the gdbarch
machinery) that is supposed to take an alias address and map it to the
"canonical" form which is the one expected to be found in the symtab?

I thought of tweaking gdbarch_frame_saved_pc, but then I end up with
false (numeric) addresses showing up in "bt" -- the canonical ones
rather than the ones that are really in the call stack.

Is there a function that's called at a later spot, so I can get the
raw addresses in the callstack and yet have them resolved to symbols
correctly?  Similarly, would that allow things like "disassemble
<alias>" to work with the symbol names "correctly" shown in the
disassembly output?

If this doesn't currently exist, could anyone offer hints as to where
such a beast could be added (and what form, roughly, it should take)?

Thanks,
	paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Looking for a gdb function to handle alias addresses
  2003-12-30 22:19 Looking for a gdb function to handle alias addresses Paul Koning
@ 2003-12-30 23:00 ` Daniel Jacobowitz
  2003-12-31 15:26   ` Paul Koning
  2003-12-31 17:36 ` Andrew Cagney
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-12-30 23:00 UTC (permalink / raw)
  To: gdb

On Tue, Dec 30, 2003 at 05:19:57PM -0500, Paul Koning wrote:
> If this doesn't currently exist, could anyone offer hints as to where
> such a beast could be added (and what form, roughly, it should take)?

I can't imagine how you would do this.  You'd need everywhere that does
symbol lookups to apply your theoretical method, at the very least.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Looking for a gdb function to handle alias addresses
  2003-12-30 23:00 ` Daniel Jacobowitz
@ 2003-12-31 15:26   ` Paul Koning
  2003-12-31 16:37     ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Koning @ 2003-12-31 15:26 UTC (permalink / raw)
  To: drow; +Cc: gdb

>>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:

 Daniel> On Tue, Dec 30, 2003 at 05:19:57PM -0500, Paul Koning wrote:
 >> If this doesn't currently exist, could anyone offer hints as to
 >> where such a beast could be added (and what form, roughly, it
 >> should take)?

 Daniel> I can't imagine how you would do this.  You'd need everywhere
 Daniel> that does symbol lookups to apply your theoretical method, at
 Daniel> the very least.

So I take it the function I need doesn't exist at the moment.

Should I interpret your comment as "don't even think about doing this,
it's too ugly" or "sure you can do this but you'll have to insert the
hook in a lot of places" ?

If the latter, is another gdbarch function hook the right way?

   paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Looking for a gdb function to handle alias addresses
  2003-12-31 15:26   ` Paul Koning
@ 2003-12-31 16:37     ` Daniel Jacobowitz
  2003-12-31 16:53       ` Paul Koning
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-12-31 16:37 UTC (permalink / raw)
  To: Paul Koning; +Cc: gdb

On Wed, Dec 31, 2003 at 10:26:34AM -0500, Paul Koning wrote:
> >>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:
> 
>  Daniel> On Tue, Dec 30, 2003 at 05:19:57PM -0500, Paul Koning wrote:
>  >> If this doesn't currently exist, could anyone offer hints as to
>  >> where such a beast could be added (and what form, roughly, it
>  >> should take)?
> 
>  Daniel> I can't imagine how you would do this.  You'd need everywhere
>  Daniel> that does symbol lookups to apply your theoretical method, at
>  Daniel> the very least.
> 
> So I take it the function I need doesn't exist at the moment.
> 
> Should I interpret your comment as "don't even think about doing this,
> it's too ugly" or "sure you can do this but you'll have to insert the
> hook in a lot of places" ?

Take it as "I have no idea" :)

> If the latter, is another gdbarch function hook the right way?

Maybe.  What you're describing is very system-specific, rather than
architecture-specific - I realize that the basic K0/K1 is a standard
MIPS feature, but the details of what regions alias will definitely
vary based on more than the gdbarch.  So perhaps it should be directly
user-configurable instead.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Looking for a gdb function to handle alias addresses
  2003-12-31 16:37     ` Daniel Jacobowitz
@ 2003-12-31 16:53       ` Paul Koning
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Koning @ 2003-12-31 16:53 UTC (permalink / raw)
  To: drow; +Cc: gdb

>>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:

 >> If the latter, is another gdbarch function hook the right way?

 Daniel> Maybe.  What you're describing is very system-specific,
 Daniel> rather than architecture-specific - I realize that the basic
 Daniel> K0/K1 is a standard MIPS feature, but the details of what
 Daniel> regions alias will definitely vary based on more than the
 Daniel> gdbarch.  So perhaps it should be directly user-configurable
 Daniel> instead.

It certainly is system-specific.  The K0/K1 and also the corresponding
64-bit aliases are MIPS standard.  But in my case, I also wanted an
alias from a 64-bit unmapped address to a canonical address that's
mapped (through the user address space, no less) and that's a
programmable mapping that's specific to our target.

I wasn't thinking user-configurable because the mapping I have is
fixed for the platform, so I'd rather program it in.  My dump analyzer
already knows a whole lot of hairy details about that target
anyway... :-)  Also, a rule of the form "walk through the VM region
descriptors for a region that maps to the physical address, and take
the inverse" is hard to express in the UI.

From what I've heard so far I'm inclined to make this a private hook,
without a lot of effort spent to make it nice & generic because it's
not likely to be generally useful/applicable.

Thanks Daniel....  any other opinions/comments would also be welcome.

       paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Looking for a gdb function to handle alias addresses
  2003-12-30 22:19 Looking for a gdb function to handle alias addresses Paul Koning
  2003-12-30 23:00 ` Daniel Jacobowitz
@ 2003-12-31 17:36 ` Andrew Cagney
  2003-12-31 18:31   ` Paul Koning
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-12-31 17:36 UTC (permalink / raw)
  To: Paul Koning; +Cc: gdb

Try reloading the relevant symbol file at the second address (so that 
the symbol information is available for both address ranges) (but please 
don't ask me how to do this).

I suspect that anything involving teaching GDB about address aliases 
would be too garish and invasive.

Andrew


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Looking for a gdb function to handle alias addresses
  2003-12-31 17:36 ` Andrew Cagney
@ 2003-12-31 18:31   ` Paul Koning
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Koning @ 2003-12-31 18:31 UTC (permalink / raw)
  To: cagney; +Cc: gdb

>>>>> "Andrew" == Andrew Cagney <cagney@gnu.org> writes:

 Andrew> Try reloading the relevant symbol file at the second address
 Andrew> (so that the symbol information is available for both address
 Andrew> ranges) (but please don't ask me how to do this).

Neat.  That works...

 Andrew> I suspect that anything involving teaching GDB about address
 Andrew> aliases would be too garish and invasive.

Ok -- a simple solution like you describe is certainly attractive.
Thanks!

	paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-12-31 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-30 22:19 Looking for a gdb function to handle alias addresses Paul Koning
2003-12-30 23:00 ` Daniel Jacobowitz
2003-12-31 15:26   ` Paul Koning
2003-12-31 16:37     ` Daniel Jacobowitz
2003-12-31 16:53       ` Paul Koning
2003-12-31 17:36 ` Andrew Cagney
2003-12-31 18:31   ` Paul Koning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox