public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Disabling stack access for remote targets?
@ 2012-06-01 14:29 Joakim Tjernlund
  2012-06-03 15:16 ` Jan Kratochvil
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2012-06-01 14:29 UTC (permalink / raw)
  To: gdb


Debugging u-boot/bios direcly from reset using remote gdb can be a challenge.
One reason is that gdb insists on reading stack contents each time it stops execution.

This can be devastating for a board that hasn't initialized RAM yet.
Would it be possible for a remote target to inform gdb not to touch the
stack? In its simplest form one could just test for sp == 0

 Jocke

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

* Re: Disabling stack access for remote targets?
  2012-06-01 14:29 Disabling stack access for remote targets? Joakim Tjernlund
@ 2012-06-03 15:16 ` Jan Kratochvil
  2012-06-03 16:42   ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2012-06-03 15:16 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: gdb

On Fri, 01 Jun 2012 16:29:23 +0200, Joakim Tjernlund wrote:
> This can be devastating for a board that hasn't initialized RAM yet.
> Would it be possible for a remote target to inform gdb not to touch the
> stack? In its simplest form one could just test for sp == 0

I guess you want:
	$ info '(gdb)Memory Region Attributes'


Regards,
Jan

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

* Re: Disabling stack access for remote targets?
  2012-06-03 15:16 ` Jan Kratochvil
@ 2012-06-03 16:42   ` Joakim Tjernlund
  2012-06-03 16:58     ` Jan Kratochvil
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2012-06-03 16:42 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Jan Kratochvil <jan.kratochvil@redhat.com> wrote on 2012/06/03 17:16:03:
>
> On Fri, 01 Jun 2012 16:29:23 +0200, Joakim Tjernlund wrote:
> > This can be devastating for a board that hasn't initialized RAM yet.
> > Would it be possible for a remote target to inform gdb not to touch the
> > stack? In its simplest form one could just test for sp == 0
>
> I guess you want:
>    $ info '(gdb)Memory Region Attributes'

Not quite, I don't see memeor attribute "no-access", just ro, wo, and rw.
Second, this is a static setting, you would have to turn it on or off depending
on where your debug is.

Testing for sp == 0 (or sp == ~0) would be much nicer. It would automatically
disable/enable stack access.

 Jocke

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

* Re: Disabling stack access for remote targets?
  2012-06-03 16:42   ` Joakim Tjernlund
@ 2012-06-03 16:58     ` Jan Kratochvil
  2012-06-03 17:21       ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2012-06-03 16:58 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: gdb

On Sun, 03 Jun 2012 18:42:10 +0200, Joakim Tjernlund wrote:
> Not quite, I don't see memeor attribute "no-access", just ro, wo, and rw.

There is "set mem inaccessible-by-default" for that purpose, default "on",
just do not definy any memory area in that range you do not want to touch.


> Testing for sp == 0 (or sp == ~0) would be much nicer. It would automatically
> disable/enable stack access.

sp == 0 or sp == ~0 are perfectly valid stack addresses on embedded targets.


I have to note I used GDB with embedded targets only very rarely.


Regards,
Jan

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

* Re: Disabling stack access for remote targets?
  2012-06-03 16:58     ` Jan Kratochvil
@ 2012-06-03 17:21       ` Joakim Tjernlund
  0 siblings, 0 replies; 5+ messages in thread
From: Joakim Tjernlund @ 2012-06-03 17:21 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Jan Kratochvil <jan.kratochvil@redhat.com> wrote on 2012/06/03 18:58:13:
>
> On Sun, 03 Jun 2012 18:42:10 +0200, Joakim Tjernlund wrote:
> > Not quite, I don't see memeor attribute "no-access", just ro, wo, and rw.
>
> There is "set mem inaccessible-by-default" for that purpose, default "on",
> just do not definy any memory area in that range you do not want to touch.

That could work, I need to test that though.

>
>
> > Testing for sp == 0 (or sp == ~0) would be much nicer. It would automatically
> > disable/enable stack access.
>
> sp == 0 or sp == ~0 are perfectly valid stack addresses on embedded targets.

In theory yes, I think you will have a very hard time finding a system using
0 or ~0(which is odd too).
If that is still a concern one could make the address configurable.
I think this feature would be really nice to have because it adapts
dynamically without the user having to know about mem regions.

 Jocke

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

end of thread, other threads:[~2012-06-03 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01 14:29 Disabling stack access for remote targets? Joakim Tjernlund
2012-06-03 15:16 ` Jan Kratochvil
2012-06-03 16:42   ` Joakim Tjernlund
2012-06-03 16:58     ` Jan Kratochvil
2012-06-03 17:21       ` Joakim Tjernlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).