From: Fernando Nasser <fnasser@cygnus.com>
To: shaunj@gray-interfaces.com, gdb@sources.redhat.com,
insight@sources.redhat.com
Subject: Re: gdb and jeeni
Date: Tue, 08 Aug 2000 15:33:00 -0000 [thread overview]
Message-ID: <39908ABD.5CC15103@cygnus.com> (raw)
In-Reply-To: <3989DB31.C353C116@cygnus.com>
Did you try it?
Fernando
Fernando Nasser wrote:
>
> Wrong list. This should have been posted to insight@sourceware.cygnus.com as it is
> a GUI only problem.
>
> Anyway, I can't reproduce this problem here. Something is really bad with your Tcl
> as it is generating a combobox event (which is the only case the change_baud is called).
>
> I don't know what is causing this spurious call, but I can add a guard against this.
> Please try the attached patch and let me know if it solved your problem.
>
> Thanks.
>
> Fernando
>
> P.S.: Please drop the gdb list when replying. Thanks.
>
> Shaun Jackman wrote:
> >
> > I'm running Insight 5.0 --target=arm-elf --host=i686-pc-linux-gnu and a jeeni
> > (ARM Angel/Ethernet). When I click "Target Settings" I get the error 'No symbol
> > "ETH" in current context.'
> > The stack trace is:
> > No symbol "ETH" in current context.
> >
> > while executing
> > "gdb_cmd "set remotebaud $baud""
> > (object "::.targetselection0.targetselection" method "::TargetSelection::change_baud" body line 4)
> > invoked from within
> > "::.targetselection0.targetselection change_baud .targetselection0.targetselection.f.lab.lf.childsite.cb ETH"
> > (in namespace inscope "::TargetSelection" script line 1)
> > invoked from within
> > "namespace inscope ::TargetSelection {::.targetselection0.targetselection change_baud} .targetselection0.targetselection.f.lab.lf.childsite.cb ETH"
> > ("after" script)errorCode is NONE
> >
> > Cheers,
> > Shaun
>
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/targetselection.itb,v
> retrieving revision 1.1.1.1
> diff -c -p -r1.1.1.1 targetselection.itb
> *** targetselection.itb 2000/02/07 00:19:42 1.1.1.1
> --- targetselection.itb 2000/08/03 20:49:38
> *************** body TargetSelection::change_target {w {
> *** 769,775 ****
> # ------------------------------------------------------------------
> body TargetSelection::change_baud {w {baud ""}} {
> if {$baud != ""} {
> ! if {[string compare $baud "TCP"] != 0} {
> gdb_cmd "set remotebaud $baud"
> if {[catch {gdb_cmd "show remotebaud"} res]} {
> set newbaud 0
> --- 769,776 ----
> # ------------------------------------------------------------------
> body TargetSelection::change_baud {w {baud ""}} {
> if {$baud != ""} {
> ! if {([string compare $baud "TCP"] != 0)
> ! && ([string compare $baud "ETX"] != 0)} {
> gdb_cmd "set remotebaud $baud"
> if {[catch {gdb_cmd "show remotebaud"} res]} {
> set newbaud 0
>
> --
> Fernando Nasser
> Red Hat Canada Ltd. E-Mail: fnasser@cygnus.com
> 2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
> Toronto, Ontario M4P 2C9 Fax: 416-482-6299
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
From jingham@apple.com Tue Aug 08 16:21:00 2000
From: Jim Ingham <jingham@apple.com>
To: <gdb@sources.redhat.com>
Subject: Changing the "enclosing_type" of a value structure
Date: Tue, 08 Aug 2000 16:21:00 -0000
Message-id: <B5B5E410.3CCA%jingham@apple.com>
X-SW-Source: 2000-08/msg00044.html
Content-length: 2587
Hi, all...
I found a number of places in the gdb sources where we are changing the
enclosing_type field of a value structure. For instance, in
valops.c:3490ff, the following is done:
/* If we have the full object, but for some reason the enclosing
type is wrong, set it *//* pai: FIXME -- sounds iffy */
if (full)
{
VALUE_ENCLOSING_TYPE (argp) = real_type;
return argp;
}
NB: it is NOT a good idea to blythely change the enclosing type of a
value, since allocate_value uses the length of the enclosing type to
figure out the size of the data area to allocate at the end of the
"value structure". So if the new enclosing_type is bigger than the one
you passed to allocate_value, and you ever go to read in the data, you
will stomp whatever happens to be after this value structure in memory,
causing all sorts of badness later on... This bit of code was causing a
crash for just this reason when I was viewing member objects of a C++
class.
There are other cases like this (valops.c:791ff):
/* Get target memory address */
arg2 = value_from_pointer (lookup_pointer_type (VALUE_TYPE (arg1)),
(VALUE_ADDRESS (arg1)
+ VALUE_OFFSET (arg1)
+ VALUE_EMBEDDED_OFFSET (arg1)));
/* This may be a pointer to a base subobject; so remember the
full derived object's type ... */
VALUE_ENCLOSING_TYPE (arg2) = lookup_pointer_type(VALUE_ENCLOSING_TYPE
(arg1));
Which happens to work because these are both pointers, and so have the same
size...
My software fascist side says you should NEVER be allowed to change the
enclosing_type of a value without at least putting in an assert making
sure that the new enclosing_type's length is <= that of the old
enclosing type. After all, making an error here may cause memory
corruption in the application, which is generally pretty unpleasant to
track down.
It might even be good to introduce a function like:
value_ptr
value_change_enclosing_type (value_ptr val, type *new_type)
{
if (TYPE_LENGTH (new_type) <= TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)))
{
VALUE_ENCLOSING_TYPE(val) = new_type;
return val;
}
else
{
return (value_ptr) xrealloc (val, sizeof (struct type)
+ TYPE_LENGTH (new_type));
}
}
and use that everywhere that we were just reassigning before.
If this makes sense to people (and/or I am not missing something
obvious), then I will whip up a patch and submit it.
Jim
--
Jim Ingham jingham@apple.com
Apple Computer
prev parent reply other threads:[~2000-08-08 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <00080313412800.00552@ed>
2000-08-03 13:51 ` Fernando Nasser
2000-08-08 15:33 ` Fernando Nasser [this message]
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=39908ABD.5CC15103@cygnus.com \
--to=fnasser@cygnus.com \
--cc=gdb@sources.redhat.com \
--cc=insight@sources.redhat.com \
--cc=shaunj@gray-interfaces.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