Regarding the watch view, I have disabled it but I cannot delete the function arguments and local variables from it.
Before I continue, I'm not sure any more if this is a CB issue, so if any of the mods decide to close this thread, I'll regret it but the forum rules are clear.
- if I declare one additional local variable in the function that calls the failing ReadString() it works.
- but if, additionaly to the extra declaration, I initialize the nr_of_lflags var it crashes again.
Below is the function code, see the 3 COMMENTS IN CAPS.
int32_t ReadFlags(int64_t offset)
{
  int32_t code        = NO_ID;
  int32_t com_loc_len = 0; /* Length of common location flags string.                                */
  int32_t com_obj_len = 0; /* Length of common object flags string.                                  */
                           /* Length of local flags string is a global variable for save() function. */
  int32_t nr_of_lflags;  /* IF I INITIALIZE THIS VAR THE EXTRA LOCAL DECLARATION HAS NO EFFECT */
  int i  = 0;
  int test = 0;  /* WITH THIS LINE IT WORKS, IF I REMOVE IT, OR INTIALIZE nr_of_lflags THE PROBLEM RETURNS */
  /* go to offset in datafile */
  if (fseek(datafile, offset, 0) == -1) {
    PrintError(16, NULL, "ReadFlags()");
    return(ERROR);
  }
  /* check for the keyword */
  if (!GetNextCode32(&code)) {
    PrintError(23, NULL, "keyword record");
    return(ERROR);
  }
  if (code != FLAGS) {
    PrintError(21, NULL, "flags");
    return(ERROR);
  }
  /* Read number of common flagbits.                  */
  /* We need the number for the SetBitVal() function. */
  if (!GetNextCode32(&nr_of_cflags)) {
    PrintError(23, NULL, "nr_of_cflags");
    return(ERROR);
  }
  /* calculate com_loc_len and com_obj_len. */
  com_loc_len = ((nr_of_cflags*nr_of_locs)/WORD_LEN)+1;
  com_obj_len = ((nr_of_cflags*nr_of_objs)/WORD_LEN)+1;
  /* Create space on heap for com_loc_flags. */
  if ((com_loc_flags = (int32_t *) malloc(com_loc_len*sizeof(int32_t))) == NULL) {
    PrintError(15, NULL, "ReadFlags()");
    return(ERROR);
  }
  /* Create space on heap for com_obj_flags. */
  if ((com_obj_flags = (int32_t *) malloc(com_obj_len*sizeof(int32_t))) == NULL) {
    PrintError(15, NULL, "ReadFlags()");
    return(ERROR);
  }
  /* Read the com_loc_flags. */
  if (fread((void *) com_loc_flags, sizeof(int32_t), com_loc_len, datafile)
      != com_loc_len) {
    PrintError(23, NULL, "common location flags");
    return(ERROR);
  }
  /* Read the com_obj_flags. */
  if (fread((void *) com_obj_flags, sizeof(int32_t), com_obj_len, datafile)
      != com_obj_len) {
    PrintError(23, NULL, "common object flags");
    return(ERROR);
  }
  /* Read length of local flagbits string.           */
  /* We don't need the actual number of local flags. */
  if (!GetNextCode32(&loc_flags_string_len)) {
    PrintError(23, NULL, "loc_flags_string_len");
    return(ERROR);
  }
  /* Create space on heap.             */
  if ((local_flags = (int32_t *) malloc(loc_flags_string_len*sizeof(int32_t))) == NULL) {
    PrintError(15, NULL, "ReadFlags()");
    return(ERROR);
  }
  /* read the information */
  if (fread((void *) local_flags, sizeof(int32_t), loc_flags_string_len, datafile)
      != loc_flags_string_len) {
    PrintError(23, NULL, "local flags");
    return(ERROR);
  }
  /* Check if we must read debug info */  /* @@ */
  if (debug) {
    /* check for the keyword */
    if (!GetNextCode32(&code)) {
      PrintError(23, NULL, "keyword record");
      return(ERROR);
    }
    if (code != DEBUG) {
      PrintError(21, NULL, "debug");
      return(ERROR);
    }
    /* Malloc() space for common flags debug info. */
    if ((com_flag_dbug = (debugInfo *) malloc(nr_of_cflags*sizeof(debugInfo))) == NULL) {
      PrintError(15, NULL, "common flags debug info");
      return(ERROR);
    }
    /* Malloc() space for local flags debug info. */
    if ((loc_flag_dbug = (debugInfo *) malloc(nr_of_lflags*sizeof(debugInfo))) == NULL) {
      PrintError(15, NULL, "local flags debug info");
      return(ERROR);
    }
    for (i=0; i<nr_of_cflags; i++) {
      if ( ((com_flag_dbug[i]).name = ReadString()) == NULL)
        return(ERROR);
    }
    /* read the number of local flags */
    /* is is only needed when we have debug info */
    if (!GetNextCode32(&nr_of_lflags)) {
      PrintError(23, NULL, "nr_of_lflags");
      return(ERROR);
    }
    for (i=0; i<nr_of_lflags; i++) {
      if ( ((loc_flag_dbug[i]).name = ReadString()) == NULL)    /* THIS rEADsTRING() CALL FAILS */
        return(ERROR);
      if (!GetNextCode32(&(loc_flag_dbug[i]).owner))
        return(ERROR);
    }
  }
  return(OK);
}