This is the mail archive of the 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: [PATCH v10 25/28] btrace, gdbserver: read branch trace incrementally

> -----Original Message-----
> From: Tom Tromey []
> Sent: Thursday, January 16, 2014 6:57 PM

> Markus> -VEC (btrace_block_s) *
> Markus> -target_read_btrace (struct btrace_target_info *btinfo,
> Markus> +enum btrace_error
> Markus> +target_read_btrace (VEC (btrace_block_s) **btrace,
> Markus> +		    struct btrace_target_info *btinfo,
> Markus>  		    enum btrace_read_type type)
> Markus>  {
> Markus>    struct target_ops *t;
> Markus>    for (t = current_target.beneath; t != NULL; t = t->beneath)
> Markus>      if (t->to_read_btrace != NULL)
> Markus> -      return t->to_read_btrace (btinfo, type);
> Markus> +      return t->to_read_btrace (btrace, btinfo, type);
> Markus>    tcomplain ();
> Markus> -  return NULL;
> Markus> +  return BTRACE_ERR_NOT_SUPPORTED;
> Markus>  }
> While rebasing my branch I noticed this code.
> tcomplain doesn't return, so the final "return" here will never be
> executed.
> Given the function's history I assume this is no big deal -- just a
> small oversight, compounded by the compiler not bothering to tell us
> that it knows about this :)
> However I wanted to point it out in case you were expecting an error
> return here.

I am expecting the exception from tcomplain ().

The return BTRACE_ERR_NOT_SUPPORTED is to avoid warnings from
compilers that can't figure out that tcomplain () does not return.

I used to return NULL before and I'm using the same pattern in
target_enable_btrace.  There's another instance in dummy_get_bookmark.

If this turns out to be unnecessary, I can send a patch to remove
those extra returns.


Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052

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