Ignore:
Timestamp:
Jul 16, 2017, 11:53:11 PM (2 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
8ad4d93
Parents:
2465c01
git-author:
Chris Johns <chrisj@…> (07/16/17 23:53:11)
git-committer:
Chris Johns <chrisj@…> (08/15/17 01:39:22)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libdebugger/rtems-debugger-threads.c

    r2465c01 rb2353ed9  
    11/*
    2  * Copyright (c) 2016 Chris Johns <chrisj@rtems.org>.  All rights reserved.
     2 * Copyright (c) 2016-2017 Chris Johns <chrisj@rtems.org>.
     3 * All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    4445  "DBSs",
    4546  "DBSe",
     47  "IDLE",
    4648};
    4749
     
    241243     * debugged.
    242244     */
    243     r = rtems_debugger_target_set_exception_frame(thread);
    244     if (r < 0) {
    245         rtems_debugger_printf("error: rtems-db: thread: snap: %08lx: not valid frame\n",
    246                               id);
    247     }
     245    rtems_debugger_target_exception_thread(thread);
    248246
    249247    /*
    250      * Read the target registers into the thread register array.
    251      */
    252     rtems_debugger_target_read_regs(thread);
    253 
    254     /*
    255      * Debugger threads are stopped for breakpoint, segv or other errors have
    256      * the RTEMS_DEBUGGER_THREAD_FLAG_DEBUGGING set.
     248     * Exception threads have stopped for breakpoint, segv or other errors.
    257249     */
    258250    if (rtems_debugger_thread_flag(thread,
    259                                    RTEMS_DEBUGGER_THREAD_FLAG_DEBUGGING)) {
     251                                   RTEMS_DEBUGGER_THREAD_FLAG_EXCEPTION)) {
    260252      rtems_id* stopped;
    261253      r = rtems_debugger_block_resize(&threads->stopped);
     
    277269    }
    278270
     271    /*
     272     * Read the target registers into the thread register array.
     273     */
     274    rtems_debugger_target_read_regs(thread);
     275
    279276    if (rtems_debugger_server_flag(RTEMS_DEBUGGER_FLAG_VERBOSE))
    280277      rtems_debugger_printf("rtems-db: sys: thd: %08lx: signal: %d\n",
     
    301298      rtems_debugger_printf("rtems-db: sys:    : suspending\n");
    302299    r = rtems_debugger_target_swbreak_remove();
     300    if (r == 0)
     301      r = rtems_debugger_target_hwbreak_remove();
    303302    if (r == 0) {
    304303      rtems_debugger_thread* current;
     
    353352    if (rtems_debugger_verbose())
    354353      rtems_debugger_printf("rtems-db: sys:    : resuming\n");
    355     if (!detaching)
     354    if (!detaching) {
    356355      r = rtems_debugger_target_swbreak_insert();
     356      if (r == 0)
     357        r = rtems_debugger_target_hwbreak_insert();
     358    }
    357359    if (r == 0) {
    358360      for (i = 0; i < threads->current.level; ++i) {
     
    361363        int                    rr;
    362364        /*
    363          * Check if resuming, which is continuing, a step, or stepping a range.
     365         * Check if resuming, which can be continuing, a step, or stepping a
     366         * range.
    364367         */
    365368        if (detaching ||
     
    377380            }
    378381          }
    379           sc = rtems_task_resume(thread->id);
    380           if (sc != RTEMS_SUCCESSFUL) {
    381             rtems_debugger_printf("error: rtems-db: thread: resume: %08lx: %s\n",
    382                                   thread->id, rtems_status_text(sc));
     382          if (rtems_debugger_verbose())
     383            rtems_debugger_printf("rtems-db: sys:    : resume: 0x%08lx\n",
     384                                  thread->id);
     385          if (rtems_debugger_thread_flag(thread,
     386                                         RTEMS_DEBUGGER_THREAD_FLAG_EXCEPTION)) {
     387              rtems_debugger_target_exception_thread_resume(thread);
     388          } else {
     389              sc = rtems_task_resume(thread->id);
     390              if (sc != RTEMS_SUCCESSFUL) {
     391                  rtems_debugger_printf("error: rtems-db: thread: resume: %08lx: %s\n",
     392                                        thread->id, rtems_status_text(sc));
     393              }
    383394          }
    384395          thread->flags &= ~(RTEMS_DEBUGGER_THREAD_FLAG_CONTINUE |
     
    421432    for (i = 0; i < threads->current.level; ++i) {
    422433      rtems_debugger_thread* thread = &current[i];
    423       int                    r;
    424       r = rtems_debugger_thread_continue(thread);
    425       if (r < 0)
    426         break;
     434      if (!rtems_debugger_thread_flag(thread,
     435                                      RTEMS_DEBUGGER_THREAD_FLAG_STEP_INSTR)) {
     436        r = rtems_debugger_thread_continue(thread);
     437        if (r < 0)
     438          break;
     439      }
    427440    }
    428441  }
Note: See TracChangeset for help on using the changeset viewer.