View Single Post
  #1   (View Single Post)  
Old 11th December 2017
Prevet Prevet is offline
Fdisk Soldier
 
Join Date: Oct 2017
Posts: 69
Default Need some help with OpenBSD's GDB

I am learning GDB but am having problems getting it's watch variable command working.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>

void die (const char *msg)
{
  fprintf (stderr, "err: %s\n", msg);
  exit (0x0f);
}

void test (const char *msg)
{
  fprintf (stderr, "err: %s\n", msg);
}


int main (int ac, char **av)
{
  int j = 0;
  if (SDL_Init (SDL_INIT_VIDEO))
    die (SDL_GetError ());
  j = j + 1;
  test ("hello");
  j = j + 1;
  puts ("SDL init -> OK");
  j = j + 1;
  return 0;
}

I set it to watch the variable j and from then on next appears to change to step, as it steps inside any function it encounters and clears the watch variable with the following message:

"Watchpoint 2 deleted because the program has left the block in
which its expression is valid."

What do OpenBSD programmers do about this?
Reply With Quote