This is the mail archive of the gdb-patches@sourceware.org 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: [RFC] Fix for gdb.parameter('architecture') returning empty string


>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:

Siva> Currently, gdb.parameter ('architecture') and gdb.parameter ('endian')
Siva> return an empty string.  Attached is a patch which fixes this.  I am
Siva> not very sure if this is the cleanest fix, but I could not come up
Siva> with a better one.

Thanks for the patch.

I'm not certain that this patch is correct.  Also I tend to think (but
of course I am willing to be convinced otherwise) that a different
direction would be preferable.

Siva> +static void
Siva> +on_architecture_change (struct gdbarch *arch)
Siva> +{
Siva> +  architecture_string = gdbarch_bfd_arch_info (arch)->printable_name;
Siva> +  set_endian_string (arch);
Siva> +}

Siva> +    observer_attach_architecture_changed (on_architecture_change);

I suspect this means that gdb.parameter('architecture') will not always
show the same result as "show architecture".

Right now, in the auto case show_architecture will call
get_current_arch:

    struct gdbarch *
    get_current_arch (void)
    {
      if (has_stack_frames ())
        return get_frame_arch (get_selected_frame (NULL));
      else
        return target_gdbarch;
    }

But from what I can tell, the architecture-change observer is not
notified in every situation that might cause that function to return a
different result.


I think a better approach might be to address the problem of "auto" gdb
parameters more globally.  For example, we could add a method to the
appropriate CLI object so that the Python could call this to get the
correct current value.

What do you think of that?

I don't think we'd have to convert all auto parameters at once.
However, this approach would make it easy to convert them as needed.

Tom


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