DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 11th December 2017
Prevet Prevet is offline
Fdisk Soldier
 
Join Date: Oct 2017
Posts: 74
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
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:47 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick