Message ID | 1458154517-25441-2-git-send-email-arnez@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On 16/03/16 19:54, Andreas Arnez wrote: > This patch added handling for some syscalls to linux-record.c: > > https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html > > But for both `pipe' and `pipe2' the patch lacks a statement after an > `if', such that the following `break' is interpreted as the `if'-body > instead. > > This adds the missing (return-) statements for the conditionals. Whoops, my bad. This looks like obvious patch material. Though I wonder why it wasn't detected earlier by someone running GCC 6 with its -Wmisleading-indentation warning - does it not catch it? Btw, it seems that cases gdb_sys_pipe2 and gdb_sys_pipe could be squashed into one. > > gdb/ChangeLog: > > * linux-record.c (record_linux_system_call): Add missing return > statements to handling of pipe and pipe2 syscalls. > --- > gdb/linux-record.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdb/linux-record.c b/gdb/linux-record.c > index a40845a..2e86936 100644 > --- a/gdb/linux-record.c > +++ b/gdb/linux-record.c > @@ -354,6 +354,7 @@ record_linux_system_call (enum gdb_syscall syscall, > regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); > if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, > tdep->size_int * 2)) > + return -1; > break; > > case gdb_sys_times: > @@ -2312,6 +2313,7 @@ Do you want to stop the program?"), > regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); > if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, > tdep->size_int * 2)) > + return -1; > break; > > case gdb_sys_inotify_init1: >
Andreas Arnez <arnez@linux.vnet.ibm.com> writes: > gdb/ChangeLog: > > * linux-record.c (record_linux_system_call): Add missing return > statements to handling of pipe and pipe2 syscalls. Patch is good to me.
On Thu, Mar 17 2016, Yao Qi wrote: > Andreas Arnez <arnez@linux.vnet.ibm.com> writes: > >> gdb/ChangeLog: >> >> * linux-record.c (record_linux_system_call): Add missing return >> statements to handling of pipe and pipe2 syscalls. > > Patch is good to me. Thanks, pushed.
On Wed, Mar 16 2016, Marcin KoĆcielnicki wrote: > On 16/03/16 19:54, Andreas Arnez wrote: >> This patch added handling for some syscalls to linux-record.c: >> >> https://sourceware.org/ml/gdb-patches/2015-10/msg00452.html >> >> But for both `pipe' and `pipe2' the patch lacks a statement after an >> `if', such that the following `break' is interpreted as the `if'-body >> instead. >> >> This adds the missing (return-) statements for the conditionals. > > Whoops, my bad. This looks like obvious patch material. Though I > wonder why it wasn't detected earlier by someone running GCC 6 with > its -Wmisleading-indentation warning - does it not catch it? Right, it doesn't catch it (yet): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66298 > Btw, it seems that cases gdb_sys_pipe2 and gdb_sys_pipe could be > squashed into one. Right, and a few other cases could be squashed as well. Mabye I'll post another patch for that... -- Andreas
diff --git a/gdb/linux-record.c b/gdb/linux-record.c index a40845a..2e86936 100644 --- a/gdb/linux-record.c +++ b/gdb/linux-record.c @@ -354,6 +354,7 @@ record_linux_system_call (enum gdb_syscall syscall, regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int * 2)) + return -1; break; case gdb_sys_times: @@ -2312,6 +2313,7 @@ Do you want to stop the program?"), regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest); if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tdep->size_int * 2)) + return -1; break; case gdb_sys_inotify_init1: