Skip to content

Bug in multiple target debugging - invalid values in watch window #581

@fda0

Description

@fda0

For a while now I'm hitting a bug where values in the watch window are mixed up between targets (?) or straight up invalid when running 2 targets at the same time in the debugger. I think this is a regression because it used to work for me in the past - I'm not sure when it stopped working exactly.

I'm hitting this bug 100% of the time on a larger program - it's a bit more sporadic on a small repro but you should see it under 5 runs.
I'm running a release build (build.bat release) latest version from master - 209c5e9

Target config Watch window bug

Program compiled with cl c_raddbg_server_client.c /Zi

#include "stdio.h"

typedef struct State State;
struct State
{
  #define PSIZE 32
  int is_server;
  int payload[PSIZE];
};
static State S;

int main(int argc, char **args)
{
  for (int i = 1; i < argc; i++)
  {
    char *arg = args[i];
    if (arg[0] == 's') S.is_server = 1;
    else               printf("Unknown argument %s\n", arg);
  }

  printf("Running as %s\n", S.is_server ? "server" : "client"); // edit: Fixed the printf - In the screenshot there was a bug here

  if (S.is_server)
  {
    for (int i = 0; i < PSIZE; i++)
      S.payload[i] = i * 10 + 10;
  }
  else
  {
    for (int i = 0; i < PSIZE; i++)
      S.payload[i] = i * -1 - 10;
  }

  if (S.is_server)
  {
    printf("SERVER dump: ");
    for (int i = 0; i < PSIZE; i++)
      printf("%d; ", S.payload[i]);
    printf("\n");
    int break_here = 0;
    break_here += 1;
  }
  else
  {
    printf("CLIENT dump: ");
    for (int i = 0; i < PSIZE; i++)
      printf("%d; ", S.payload[i]);
    printf("\n");
    int break_here = 0;
    break_here += 1;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA report of unintended or broken behavior.DebuggerPertains to the debugger.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions