Re: RFC: Do not try g-packet-guess algorithm on exited targets

Pedro Alves
2008-11-23T22:12:30Z

On Sunday 23 November 2008 21:14:54, Daniel Jacobowitz wrote:
>  static const struct target_desc *
>  remote_read_description (struct target_ops *target)
>  {
> +  struct remote_state *rs = get_remote_state ();
>    struct remote_g_packet_data *data
>      = gdbarch_data (target_gdbarch, remote_g_packet_data_handle);
>
> +  /* Do not try this during initial connection.  */
> +  if (rs->tdesc_no_register_access)
> +    return NULL;
> +

Is this new flag working around that fact that remote_open_1 does this?

/* Assume that the target is running, unless we learn otherwise. */
target_mark_running (target);

If we change the logic around to:

/* Assume that the target is not running, unless we learn
otherwise. */
if (extended_p)
target_mark_exited (target);

Then would this in remote_read_description work instead of a
new flag?

> + /* Do not try this during initial connection. */
> + if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid))
> + return NULL;

(or just null_ptid).

I've done that change locally just a few days ago because I found out
that the bit in remote_start_remote that does:

if (gdbarch_has_global_solist (target_gdbarch))
solib_add (NULL, args->from_tty, args->target, auto_solib_add);

also ended up trying to do things to a non-existant inferior due
to target_has_execution being true while that is a lie in the
'extended-remote without an inferior yet' case.

--
Pedro Alves