* potential patch for gdb bug c++/20020 [not found] <CAOhs8xKxGGTqpuFd40wWA8O6i97Odc_dmG=csK1DAFf=TCnYbg@mail.gmail.com> @ 2018-12-06 18:29 ` Bob Steagall 2018-12-06 19:20 ` Andrew Burgess 0 siblings, 1 reply; 4+ messages in thread From: Bob Steagall @ 2018-12-06 18:29 UTC (permalink / raw) To: gdb-patches [-- Attachment #1: Type: text/plain, Size: 284 bytes --] Description: This patch, against released version 8.2, fixes the problem reported in gdb bug c++/20020, using the approach described in comment 1 of that report. Changelog entry: 2018-12-06 Bob Steagall <bob.steagall.cpp@gmail.com> * cp-valprint.c: Fixes bug c++/20020. [-- Attachment #2: fix-for-20020.patch --] [-- Type: application/x-patch, Size: 790 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: potential patch for gdb bug c++/20020 2018-12-06 18:29 ` potential patch for gdb bug c++/20020 Bob Steagall @ 2018-12-06 19:20 ` Andrew Burgess 2018-12-06 20:49 ` Bob Steagall 0 siblings, 1 reply; 4+ messages in thread From: Andrew Burgess @ 2018-12-06 19:20 UTC (permalink / raw) To: Bob Steagall; +Cc: gdb-patches * Bob Steagall <bob.steagall.cpp@gmail.com> [2018-12-06 13:29:31 -0500]: > Description: This patch, against released version 8.2, fixes the > problem reported in gdb bug c++/20020, using the approach described in > comment 1 of that report. > > Changelog entry: > > 2018-12-06 Bob Steagall <bob.steagall.cpp@gmail.com> > > * cp-valprint.c: Fixes bug c++/20020. > --- gdb/cp-valprint.c 2018-09-05 03:27:13.000000000 -0400 > +++ gdb/cp-valprint.c.new 2018-12-06 13:01:06.819266165 -0500 > @@ -326,12 +326,16 @@ cp_print_value_fields (struct type *type > fprintf_filtered (stream, > _("<error reading variable: %s>"), > ex.message); > + v = NULL; I don't think this NULL assignment should be needed. `v` starts as NULL, and we only end in this block if `value_static_field` throws an exception, which will be before `v` is assigned too. > } > END_CATCH > > - cp_print_static_field (TYPE_FIELD_TYPE (type, i), > - v, stream, recurse + 1, > - options); > + if (v != NULL) > + { You should drop the '{' and '}' here for a single statement block. > + cp_print_static_field (TYPE_FIELD_TYPE (type, i), > + v, stream, recurse + 1, > + options); > + } > } > else if (i == vptr_fieldno && type == vptr_basetype) > { I'm not a maintainer so can't approve patches, but this seems sensible to me. Thanks, Andrew ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: potential patch for gdb bug c++/20020 2018-12-06 19:20 ` Andrew Burgess @ 2018-12-06 20:49 ` Bob Steagall 2018-12-06 21:07 ` Tom Tromey 0 siblings, 1 reply; 4+ messages in thread From: Bob Steagall @ 2018-12-06 20:49 UTC (permalink / raw) To: andrew.burgess; +Cc: gdb-patches On Thu, Dec 6, 2018 at 2:20 PM Andrew Burgess <andrew.burgess@embecosm.com> wrote: > > * Bob Steagall <bob.steagall.cpp@gmail.com> [2018-12-06 13:29:31 -0500]: > > > Description: This patch, against released version 8.2, fixes the > > problem reported in gdb bug c++/20020, using the approach described in > > comment 1 of that report. > > > > Changelog entry: > > > > 2018-12-06 Bob Steagall <bob.steagall.cpp@gmail.com> > > > > * cp-valprint.c: Fixes bug c++/20020. > > > --- gdb/cp-valprint.c 2018-09-05 03:27:13.000000000 -0400 > > +++ gdb/cp-valprint.c.new 2018-12-06 13:01:06.819266165 -0500 > > @@ -326,12 +326,16 @@ cp_print_value_fields (struct type *type > > fprintf_filtered (stream, > > _("<error reading variable: %s>"), > > ex.message); > > + v = NULL; > > I don't think this NULL assignment should be needed. `v` starts as > NULL, and we only end in this block if `value_static_field` throws an > exception, which will be before `v` is assigned too. Agreed. I was being, perhaps, too paranoid here. > > } > > END_CATCH > > > > - cp_print_static_field (TYPE_FIELD_TYPE (type, i), > > - v, stream, recurse + 1, > > - options); > > + if (v != NULL) > > + { > > You should drop the '{' and '}' here for a single statement block. Disagree. The gdb coding standard document specifically calls out lines of code, not statements: "Any two or more lines in code should be wrapped in braces, even if they are comments, as they look like separate statements" > > + cp_print_static_field (TYPE_FIELD_TYPE (type, i), > > + v, stream, recurse + 1, > > + options); > > + } > > } > > else if (i == vptr_fieldno && type == vptr_basetype) > > { > > I'm not a maintainer so can't approve patches, but this seems sensible > to me. > > Thanks, > Andrew I will update and re-send. Thanks for the review, --Bob ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: potential patch for gdb bug c++/20020 2018-12-06 20:49 ` Bob Steagall @ 2018-12-06 21:07 ` Tom Tromey 0 siblings, 0 replies; 4+ messages in thread From: Tom Tromey @ 2018-12-06 21:07 UTC (permalink / raw) To: Bob Steagall; +Cc: andrew.burgess, gdb-patches >>>>> "Bob" == Bob Steagall <bob.steagall.cpp@gmail.com> writes: >> You should drop the '{' and '}' here for a single statement block. Bob> Disagree. The gdb coding standard document specifically calls out Bob> lines of code, Bob> not statements: Bob> "Any two or more lines in code should be wrapped in braces, even if they Bob> are comments, as they look like separate statements" I think this is just slightly mis-worded -- Andrew's interpretation is the prevailing one. That is, no brace for: if (blah) function_call (spanning, multiple, lines); ... but do have braces for: if (blah) { /* Just a comment. */ anything (); } I agree the patch is good. I think a test case would be good to have, unless for some reason it's difficult to write one. Tom ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-06 21:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAOhs8xKxGGTqpuFd40wWA8O6i97Odc_dmG=csK1DAFf=TCnYbg@mail.gmail.com>
2018-12-06 18:29 ` potential patch for gdb bug c++/20020 Bob Steagall
2018-12-06 19:20 ` Andrew Burgess
2018-12-06 20:49 ` Bob Steagall
2018-12-06 21:07 ` Tom Tromey
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox