#2879 closed defect (fixed)

src/cpukit/libdebugger/rtems-debugger-server.c: four problems

Reported by: David Binderman Owned by: Chris Johns
Priority: normal Milestone: 5.1
Component: score Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

1.

src/cpukit/libdebugger/rtems-debugger-server.c:1306]: (style) Redundant condition: extended. '!extended || (extended && check_pid(pid))' is equivalent to '!extended || check_pid(pid)'

Suggest simplify.

2.

src/cpukit/libdebugger/rtems-debugger-server.c:1858]: (warning) Possible null pointer dereference: rtems_debugger

Source code is

  if (r < 0) {
    rtems_printf(printer, "error: rtems-db: remote begin: %s: %s\n",
                 rtems_debugger->remote->name, strerror(errno));
    free(rtems_debugger);
    rtems_debugger = NULL;
  }

  /*
   * Reset at the end of the session.
   */
  rtems_debugger->flags = 0;

Suggest adding return -1 inside the if.

3.

src/cpukit/libdebugger/rtems-debugger-server.c:906]: (style) Redundant condition: extended. '!extended || (extended && check_pid(pid))' is equivalent to '!extended || check_pid(pid)'

Duplicate.

4.

src/cpukit/libdebugger/rtems-debugger-server.c:956]: (warning) Char literal compared with pointer 'p'. Did you intend to dereference it?

Source code is

  while (p != NULL && p != '\0') {

Maybe better code

  while (p != NULL && *p != '\0') {

Change History (6)

comment:1 Changed on 01/23/17 at 23:05:49 by Chris Johns

Owner: set to Chris Johns
Status: newaccepted

comment:2 Changed on 05/11/17 at 07:31:02 by Sebastian Huber

Milestone: 4.124.12.0

comment:3 Changed on 07/16/17 at 23:41:37 by Chris Johns

Description: modified (diff)

Update formatting to show the code fragments.

comment:4 Changed on 08/07/17 at 23:34:21 by Chris Johns

Component: Generalcpukit
Version: 4.114.12

comment:5 Changed on 08/15/17 at 01:40:37 by Chris Johns <chrisj@…>

Resolution: fixed
Status: acceptedclosed

In b2353ed9/rtems:

libdebugger: Fixes to debugging, ARM support, locking, and gcc-7.1 warnings.

  • Add printk support to aid multi-core debugging.
  • Add lock trace to aid lock debugging.
  • Fixes to gcc-7.1 warnings.
  • Fixes from ticket #2879.
  • Add verbose command controls.
  • Change using the RTEMS sys/lock.h API to manage exception threads.
  • ARM hardware breakpoint fixes. Support for SMP stepping is not implemented, this requires use of the context id register.

Closes #2879.

comment:6 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.