From: Daniel Jacobowitz <drow@mvista.com>
To: "John S. Yates, Jr." <jyates@netezza.com>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: malloc in inferior
Date: Thu, 29 May 2003 17:24:00 -0000 [thread overview]
Message-ID: <20030529172404.GA24128@nevyn.them.org> (raw)
In-Reply-To: <0eda01c32606$4f21a490$1400a8c0@astral>
On Thu, May 29, 2003 at 01:18:23PM -0400, John S. Yates, Jr. wrote:
> From: "Daniel Jacobowitz" <drow@mvista.com>
>
> [..SNIP..]
>
> > > Is there anything short of calling a function in the
> > > target that requires materialization in the inferior?
> > > I can perform an enormous amount of debugging without
> > > ever thinking about trying to call a function.
> >
> > What can you usefully do with strings that doesn't communicate them to
> > the inferior?
> >
> > For instance, assigning "set x = "abc"" must materialize it in the
> > inferior.
>
> Well as it so happens I was writing a "user-defined
> command" to walk from a task control block out 3
> levels. My command had to guard against instances
> when outer levels of the structure did not exist.
> In such cases it tried to provide a clear diagnostic.
> The task control block contains an char tcb_name[8]
> member. Since at times there might not even be a
> task running there might not be a valid task name.
> Thus I had
>
> $task_name = "" // even this calls malloc
> $tcb = 0
> $ptr1 = 0
> $ptr2 = 0
> if TCD_Current_Task
> $tcb = TCD_Current_Task
> $task_name = TCD_Current_Task->tcb_name
> else
> printf "no current task\n"
> end
>
> if $tcb
> $ptr1 = $tcb->tcb_ptr1
> if ! $ptr1
> print "task %s: tcb_ptr1 is null\n",$task_name
> end
> end
>
> if $ptr1
> $ptr2 = $ptr1->xxx_ptr2
> if ! $ptr2
> print "task %s: xxx_ptr2 is null\n",$task_name
> end
> end
>
> ...
>
> [..SNIP..]
>
> > > I think this suggestion got missed. Instead of today's
> > > immediate materialization in the inferior against the
> > > possibility that the value might be required there in
> > > the future why not use a lazy approach? Before calling
> > > an inferior function push down any accessible objects.
> >
> > I didn't miss it; see above. It would have to happen every time the
> > inferior is _resumed_, too.
>
> No. An object is only accessible in the inferior
> if its address has been
>
> 1) manifested (always true for string literals)
> 2) supplied to the inferior via assignment (to
> inferior storage) or as an argument to an
> inferior function call
>
> [..SNIP..]
Hmm. This might be possible.
Again, do you have a concrete example where GDB calls malloc() other
than strings?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-05-29 17:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-29 13:51 John S. Yates, Jr.
2003-05-29 15:27 ` Daniel Jacobowitz
2003-05-29 16:00 ` John S. Yates, Jr.
2003-05-29 16:09 ` Daniel Jacobowitz
2003-05-29 17:18 ` John S. Yates, Jr.
2003-05-29 17:24 ` Daniel Jacobowitz [this message]
2003-05-29 18:18 ` Andrew Cagney
2003-05-29 18:34 ` Alain Magloire
2003-05-30 13:12 ` John S. Yates, Jr.
[not found] ` <16086.16988.657059.717389@pkoning.dev.equallogic.com>
2003-05-30 13:03 ` John S. Yates, Jr.
2003-05-29 16:42 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030529172404.GA24128@nevyn.them.org \
--to=drow@mvista.com \
--cc=gdb@sources.redhat.com \
--cc=jyates@netezza.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).