#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 Jan 23, 2017 at 11:05:49 PM by Chris Johns

Owner: set to Chris Johns
Status: newaccepted

comment:2 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:3 Changed on Jul 16, 2017 at 11:41:37 PM by Chris Johns

Description: modified (diff)

Update formatting to show the code fragments.

comment:4 Changed on Aug 7, 2017 at 11:34:21 PM by Chris Johns

Component: Generalcpukit
Version: 4.114.12

comment:5 Changed on Aug 15, 2017 at 1:40:37 AM 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 Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.