Thanks! It is relevant:

Looks like one line is missed when making the change:

- watchpoint->set = wp_num + 1;
+ watchpoint->number = wp_num;
+ watchpoint->is_set = true;

Or maybe better to use:

static inline void watchpoint_set(struct watchpoint *watchpoint, unsigned int 
number)
{
    watchpoint->is_set = true;
    watchpoint->number = number;
}

If is_set remains false, watchpoint is never unset because of below check:

static int mips_m4k_remove_watchpoint(struct target *target,
        struct watchpoint *watchpoint)
{
    /* get pointers to arch-specific information */
    struct mips32_common *mips32 = target_to_mips32(target);

    if (target->state != TARGET_HALTED) {
        LOG_WARNING("target not halted");
        return ERROR_TARGET_NOT_HALTED;
    }

    if (watchpoint->is_set)
        mips_m4k_unset_watchpoint(target, watchpoint);

    mips32->num_data_bpoints_avail++;

    return ERROR_OK;
}

Best/Nima.

From: Tommy Murphy <tommy_mur...@hotmail.com>
Sent: Thursday, December 1, 2022 8:56 AM
To: Nima Palizban - C68739 <nima.paliz...@microchip.com>; 
openocd-devel@lists.sourceforge.net
Subject: Re: mips_m4k watchpoint issue.

You don't often get email from 
tommy_mur...@hotmail.com<mailto:tommy_mur...@hotmail.com>. Learn why this is 
important<https://aka.ms/LearnAboutSenderIdentification>
EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
content is safe
This PR seems to have changed how watchpoints are set and may be relevant here?

https://github.com/openocd-org/openocd/commit/fb43f1ff4e2f0638110ffcc4e63bee8b5361db64#diff-18b6c875f0bfee773f2a5e6e0a100e4d9c641fec9c870d4da22ca0aa957259c8L914

- watchpoint->set = wp_num + 1;
+ watchpoint->number = wp_num;


Reply via email to