+// SPDX-License-Identifier: GPL-2.0-or-later
+
/*
* Copyright(c) 2013-2016 Intel Corporation.
*
* Jeffrey Maxwell (jeffrey.r.maxwell@intel.com)
* Jessica Gomez (jessica.gomez.hernandez@intel.com)
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
* Contact Information:
* Intel Corporation
*/
struct reg_feature *feature;
int i;
- if (cache == NULL || reg_list == NULL || arch_info == NULL) {
+ if (!cache || !reg_list || !arch_info) {
free(cache);
free(reg_list);
free(arch_info);
unsigned i;
struct x86_32_common *x86_32 = target_to_x86_32(t);
for (i = 0; i < (x86_32->cache->num_regs); i++) {
- if (NOT_AVAIL_REG == regs[i].pm_idx)
+ if (regs[i].pm_idx == NOT_AVAIL_REG)
continue;
err = read_hw_reg(t, regs[i].id, ®val, 1);
if (err != ERROR_OK) {
unsigned i;
struct x86_32_common *x86_32 = target_to_x86_32(t);
for (i = 0; i < (x86_32->cache->num_regs); i++) {
- if (NOT_AVAIL_REG == regs[i].pm_idx)
+ if (regs[i].pm_idx == NOT_AVAIL_REG)
continue;
err = write_hw_reg(t, i, 0, 1);
if (err != ERROR_OK) {
/* running away for a software breakpoint needs some special handling */
uint32_t eip = buf_get_u32(x86_32->cache->reg_list[EIP].value, 0, 32);
bp = breakpoint_find(t, eip);
- if (bp != NULL /*&& bp->type == BKPT_SOFT*/) {
+ if (bp /*&& bp->type == BKPT_SOFT*/) {
/* the step will step over the breakpoint */
if (lakemont_step(t, 0, 0, 1) != ERROR_OK) {
LOG_ERROR("%s stepping over a software breakpoint at 0x%08" PRIx32 " "
/* if breakpoints are enabled, we need to redirect these into probe mode */
struct breakpoint *activeswbp = t->breakpoints;
- while (activeswbp != NULL && activeswbp->set == 0)
+ while (activeswbp && !activeswbp->is_set)
activeswbp = activeswbp->next;
struct watchpoint *activehwbp = t->watchpoints;
- while (activehwbp != NULL && activehwbp->set == 0)
+ while (activehwbp && !activehwbp->is_set)
activehwbp = activehwbp->next;
- if (activeswbp != NULL || activehwbp != NULL)
+ if (activeswbp || activehwbp)
buf_set_u32(x86_32->cache->reg_list[PMCR].value, 0, 32, 1);
if (do_resume(t) != ERROR_OK)
return ERROR_FAIL;
if (check_not_halted(t))
return ERROR_TARGET_NOT_HALTED;
bp = breakpoint_find(t, eip);
- if (retval == ERROR_OK && bp != NULL/*&& bp->type == BKPT_SOFT*/) {
+ if (retval == ERROR_OK && bp/*&& bp->type == BKPT_SOFT*/) {
/* TODO: This should only be done for software breakpoints.
* Stepping from hardware breakpoints should be possible with the resume flag
* Needs testing.
LOG_DEBUG("EFLAGS [TF] [RF] bits set=0x%08" PRIx32 ", PMCR=0x%08" PRIx32 ", EIP=0x%08" PRIx32,
eflags, pmcr, eip);
- tapstatus = get_tapstatus(t);
+ /* Returned value unused. Can this line be removed? */
+ get_tapstatus(t);
t->debug_reason = DBG_REASON_SINGLESTEP;
t->state = TARGET_DEBUG_RUNNING;
/* try to re-apply the breakpoint, even of step failed
* TODO: When a bp was set, we should try to stop the target - fix the return above
*/
- if (bp != NULL/*&& bp->type == BKPT_SOFT*/) {
+ if (bp/*&& bp->type == BKPT_SOFT*/) {
/* TODO: This should only be done for software breakpoints.
* Stepping from hardware breakpoints should be possible with the resume flag
* Needs testing.