OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [tui/] [tuiSource.c] - Diff between revs 107 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
/*
/*
   ** tuiSource.c
   ** tuiSource.c
   **         This module contains functions for displaying source in the source window
   **         This module contains functions for displaying source in the source window
 */
 */
 
 
#include "defs.h"
#include "defs.h"
#include <ctype.h>
#include <ctype.h>
#include "symtab.h"
#include "symtab.h"
#include "frame.h"
#include "frame.h"
#include "breakpoint.h"
#include "breakpoint.h"
#include "source.h"
#include "source.h"
 
 
#include "tui.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiData.h"
#include "tuiStack.h"
#include "tuiStack.h"
#include "tuiSourceWin.h"
#include "tuiSourceWin.h"
#include "tuiSource.h"
#include "tuiSource.h"
 
 
 
 
/*****************************************
/*****************************************
** EXTERNAL DATA DECLS                    **
** EXTERNAL DATA DECLS                    **
******************************************/
******************************************/
extern int current_source_line;
extern int current_source_line;
extern struct symtab *current_source_symtab;
extern struct symtab *current_source_symtab;
 
 
 
 
/*****************************************
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
******************************************/
******************************************/
 
 
static struct breakpoint *_hasBreak PARAMS ((char *, int));
static struct breakpoint *_hasBreak PARAMS ((char *, int));
 
 
 
 
/*****************************************
/*****************************************
** STATIC LOCAL DATA                    **
** STATIC LOCAL DATA                    **
******************************************/
******************************************/
 
 
 
 
/*****************************************
/*****************************************
** PUBLIC FUNCTIONS                     **
** PUBLIC FUNCTIONS                     **
******************************************/
******************************************/
 
 
/*********************************
/*********************************
** SOURCE/DISASSEM  FUNCTIONS    **
** SOURCE/DISASSEM  FUNCTIONS    **
*********************************/
*********************************/
 
 
/*
/*
   ** tuiSetSourceContent().
   ** tuiSetSourceContent().
   **    Function to display source in the source window.
   **    Function to display source in the source window.
 */
 */
TuiStatus
TuiStatus
#ifdef __STDC__
#ifdef __STDC__
tuiSetSourceContent (
tuiSetSourceContent (
                      struct symtab *s,
                      struct symtab *s,
                      int lineNo,
                      int lineNo,
                      int noerror)
                      int noerror)
#else
#else
tuiSetSourceContent (s, lineNo, noerror)
tuiSetSourceContent (s, lineNo, noerror)
     struct symtab *s;
     struct symtab *s;
     int lineNo;
     int lineNo;
     int noerror;
     int noerror;
#endif
#endif
{
{
  TuiStatus ret = TUI_FAILURE;
  TuiStatus ret = TUI_FAILURE;
 
 
  if (s != (struct symtab *) NULL && s->filename != (char *) NULL)
  if (s != (struct symtab *) NULL && s->filename != (char *) NULL)
    {
    {
      register FILE *stream;
      register FILE *stream;
      register int i, desc, c, lineWidth, nlines;
      register int i, desc, c, lineWidth, nlines;
      register char *srcLine;
      register char *srcLine;
 
 
      if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS)
      if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS)
        {
        {
          lineWidth = srcWin->generic.width - 1;
          lineWidth = srcWin->generic.width - 1;
          /*
          /*
             ** Take hilite (window border) into account, when calculating
             ** Take hilite (window border) into account, when calculating
             ** the number of lines
             ** the number of lines
           */
           */
          nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo;
          nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo;
          desc = open_source_file (s);
          desc = open_source_file (s);
          if (desc < 0)
          if (desc < 0)
            {
            {
              if (!noerror)
              if (!noerror)
                {
                {
                  char *name = alloca (strlen (s->filename) + 100);
                  char *name = alloca (strlen (s->filename) + 100);
                  sprintf (name, "%s:%d", s->filename, lineNo);
                  sprintf (name, "%s:%d", s->filename, lineNo);
                  print_sys_errmsg (name, errno);
                  print_sys_errmsg (name, errno);
                }
                }
              ret = TUI_FAILURE;
              ret = TUI_FAILURE;
            }
            }
          else
          else
            {
            {
              if (s->line_charpos == 0)
              if (s->line_charpos == 0)
                find_source_lines (s, desc);
                find_source_lines (s, desc);
 
 
              if (lineNo < 1 || lineNo > s->nlines)
              if (lineNo < 1 || lineNo > s->nlines)
                {
                {
                  close (desc);
                  close (desc);
                  printf_unfiltered (
                  printf_unfiltered (
                          "Line number %d out of range; %s has %d lines.\n",
                          "Line number %d out of range; %s has %d lines.\n",
                                      lineNo, s->filename, s->nlines);
                                      lineNo, s->filename, s->nlines);
                }
                }
              else if (lseek (desc, s->line_charpos[lineNo - 1], 0) < 0)
              else if (lseek (desc, s->line_charpos[lineNo - 1], 0) < 0)
                {
                {
                  close (desc);
                  close (desc);
                  perror_with_name (s->filename);
                  perror_with_name (s->filename);
                }
                }
              else
              else
                {
                {
                  register int offset, curLineNo, curLine, curLen, threshold;
                  register int offset, curLineNo, curLine, curLen, threshold;
                  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
                  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
                  /*
                  /*
                     ** Determine the threshold for the length of the line
                     ** Determine the threshold for the length of the line
                     ** and the offset to start the display
                     ** and the offset to start the display
                   */
                   */
                  offset = srcWin->detail.sourceInfo.horizontalOffset;
                  offset = srcWin->detail.sourceInfo.horizontalOffset;
                  threshold = (lineWidth - 1) + offset;
                  threshold = (lineWidth - 1) + offset;
                  stream = fdopen (desc, FOPEN_RT);
                  stream = fdopen (desc, FOPEN_RT);
                  clearerr (stream);
                  clearerr (stream);
                  curLine = 0;
                  curLine = 0;
                  curLineNo =
                  curLineNo =
                    srcWin->detail.sourceInfo.startLineOrAddr.lineNo = lineNo;
                    srcWin->detail.sourceInfo.startLineOrAddr.lineNo = lineNo;
                  if (offset > 0)
                  if (offset > 0)
                    srcLine = (char *) xmalloc (
                    srcLine = (char *) xmalloc (
                                           (threshold + 1) * sizeof (char));
                                           (threshold + 1) * sizeof (char));
                  while (curLine < nlines)
                  while (curLine < nlines)
                    {
                    {
                      TuiWinElementPtr element = (TuiWinElementPtr)
                      TuiWinElementPtr element = (TuiWinElementPtr)
                      srcWin->generic.content[curLine];
                      srcWin->generic.content[curLine];
                      struct breakpoint *bp;
                      struct breakpoint *bp;
 
 
                      /* get the first character in the line */
                      /* get the first character in the line */
                      c = fgetc (stream);
                      c = fgetc (stream);
 
 
                      if (offset == 0)
                      if (offset == 0)
                        srcLine = ((TuiWinElementPtr)
                        srcLine = ((TuiWinElementPtr)
                                   srcWin->generic.content[
                                   srcWin->generic.content[
                                        curLine])->whichElement.source.line;
                                        curLine])->whichElement.source.line;
                      /* Init the line with the line number */
                      /* Init the line with the line number */
                      sprintf (srcLine, "%-6d", curLineNo);
                      sprintf (srcLine, "%-6d", curLineNo);
                      curLen = strlen (srcLine);
                      curLen = strlen (srcLine);
                      i = curLen -
                      i = curLen -
                        ((curLen / tuiDefaultTabLen ()) * tuiDefaultTabLen ());
                        ((curLen / tuiDefaultTabLen ()) * tuiDefaultTabLen ());
                      while (i < tuiDefaultTabLen ())
                      while (i < tuiDefaultTabLen ())
                        {
                        {
                          srcLine[curLen] = ' ';
                          srcLine[curLen] = ' ';
                          i++;
                          i++;
                          curLen++;
                          curLen++;
                        }
                        }
                      srcLine[curLen] = (char) 0;
                      srcLine[curLen] = (char) 0;
 
 
                      /*
                      /*
                         ** Set whether element is the execution point and
                         ** Set whether element is the execution point and
                         ** whether there is a break point on it.
                         ** whether there is a break point on it.
                       */
                       */
                      element->whichElement.source.lineOrAddr.lineNo =
                      element->whichElement.source.lineOrAddr.lineNo =
                        curLineNo;
                        curLineNo;
                      element->whichElement.source.isExecPoint =
                      element->whichElement.source.isExecPoint =
                        (strcmp (((TuiWinElementPtr)
                        (strcmp (((TuiWinElementPtr)
                        locator->content[0])->whichElement.locator.fileName,
                        locator->content[0])->whichElement.locator.fileName,
                                 s->filename) == 0
                                 s->filename) == 0
                         && curLineNo == ((TuiWinElementPtr)
                         && curLineNo == ((TuiWinElementPtr)
                         locator->content[0])->whichElement.locator.lineNo);
                         locator->content[0])->whichElement.locator.lineNo);
                      bp = _hasBreak (s->filename, curLineNo);
                      bp = _hasBreak (s->filename, curLineNo);
                      element->whichElement.source.hasBreak =
                      element->whichElement.source.hasBreak =
                        (bp != (struct breakpoint *) NULL &&
                        (bp != (struct breakpoint *) NULL &&
                         (!element->whichElement.source.isExecPoint ||
                         (!element->whichElement.source.isExecPoint ||
                          (bp->disposition != del || bp->hit_count <= 0)));
                          (bp->disposition != del || bp->hit_count <= 0)));
                      if (c != EOF)
                      if (c != EOF)
                        {
                        {
                          i = strlen (srcLine) - 1;
                          i = strlen (srcLine) - 1;
                          do
                          do
                            {
                            {
                              if ((c != '\n') &&
                              if ((c != '\n') &&
                                  (c != '\r') && (++i < threshold))
                                  (c != '\r') && (++i < threshold))
                                {
                                {
                                  if (c < 040 && c != '\t')
                                  if (c < 040 && c != '\t')
                                    {
                                    {
                                      srcLine[i++] = '^';
                                      srcLine[i++] = '^';
                                      srcLine[i] = c + 0100;
                                      srcLine[i] = c + 0100;
                                    }
                                    }
                                  else if (c == 0177)
                                  else if (c == 0177)
                                    {
                                    {
                                      srcLine[i++] = '^';
                                      srcLine[i++] = '^';
                                      srcLine[i] = '?';
                                      srcLine[i] = '?';
                                    }
                                    }
                                  else
                                  else
                                    {   /*
                                    {   /*
                                           ** Store the charcter in the line
                                           ** Store the charcter in the line
                                           ** buffer.  If it is a tab, then
                                           ** buffer.  If it is a tab, then
                                           ** translate to the correct number of
                                           ** translate to the correct number of
                                           ** chars so we don't overwrite our
                                           ** chars so we don't overwrite our
                                           ** buffer.
                                           ** buffer.
                                         */
                                         */
                                      if (c == '\t')
                                      if (c == '\t')
                                        {
                                        {
                                          int j, maxTabLen = tuiDefaultTabLen ();
                                          int j, maxTabLen = tuiDefaultTabLen ();
 
 
                                          for (j = i - (
                                          for (j = i - (
                                               (i / maxTabLen) * maxTabLen);
                                               (i / maxTabLen) * maxTabLen);
                                               ((j < maxTabLen) &&
                                               ((j < maxTabLen) &&
                                                i < threshold);
                                                i < threshold);
                                               i++, j++)
                                               i++, j++)
                                            srcLine[i] = ' ';
                                            srcLine[i] = ' ';
                                          i--;
                                          i--;
                                        }
                                        }
                                      else
                                      else
                                        srcLine[i] = c;
                                        srcLine[i] = c;
                                    }
                                    }
                                  srcLine[i + 1] = 0;
                                  srcLine[i + 1] = 0;
                                }
                                }
                              else
                              else
                                {       /*
                                {       /*
                                           ** if we have not reached EOL, then eat
                                           ** if we have not reached EOL, then eat
                                           ** chars until we do
                                           ** chars until we do
                                         */
                                         */
                                  while (c != EOF && c != '\n' && c != '\r')
                                  while (c != EOF && c != '\n' && c != '\r')
                                    c = fgetc (stream);
                                    c = fgetc (stream);
                                }
                                }
                            }
                            }
                          while (c != EOF && c != '\n' && c != '\r' &&
                          while (c != EOF && c != '\n' && c != '\r' &&
                                 i < threshold && (c = fgetc (stream)));
                                 i < threshold && (c = fgetc (stream)));
                        }
                        }
                      /* Now copy the line taking the offset into account */
                      /* Now copy the line taking the offset into account */
                      if (strlen (srcLine) > offset)
                      if (strlen (srcLine) > offset)
                        strcpy (((TuiWinElementPtr) srcWin->generic.content[
                        strcpy (((TuiWinElementPtr) srcWin->generic.content[
                                        curLine])->whichElement.source.line,
                                        curLine])->whichElement.source.line,
                                &srcLine[offset]);
                                &srcLine[offset]);
                      else
                      else
                        ((TuiWinElementPtr)
                        ((TuiWinElementPtr)
                         srcWin->generic.content[
                         srcWin->generic.content[
                          curLine])->whichElement.source.line[0] = (char) 0;
                          curLine])->whichElement.source.line[0] = (char) 0;
                      curLine++;
                      curLine++;
                      curLineNo++;
                      curLineNo++;
                    }
                    }
                  if (offset > 0)
                  if (offset > 0)
                    tuiFree (srcLine);
                    tuiFree (srcLine);
                  fclose (stream);
                  fclose (stream);
                  srcWin->generic.contentSize = nlines;
                  srcWin->generic.contentSize = nlines;
                  ret = TUI_SUCCESS;
                  ret = TUI_SUCCESS;
                }
                }
            }
            }
        }
        }
    }
    }
  return ret;
  return ret;
}                               /* tuiSetSourceContent */
}                               /* tuiSetSourceContent */
 
 
 
 
/* elz: this function sets the contents of the source window to empty
/* elz: this function sets the contents of the source window to empty
   except for a line in the middle with a warning message about the
   except for a line in the middle with a warning message about the
   source not being available. This function is called by
   source not being available. This function is called by
   tuiEraseSourceContents, which in turn is invoked when the source files
   tuiEraseSourceContents, which in turn is invoked when the source files
   cannot be accessed */
   cannot be accessed */
 
 
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiSetSourceContentNil (
tuiSetSourceContentNil (
                         TuiWinInfoPtr winInfo,
                         TuiWinInfoPtr winInfo,
                         char *warning_string)
                         char *warning_string)
#else
#else
tuiSetSourceContentNil (winInfo, warning_string)
tuiSetSourceContentNil (winInfo, warning_string)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
     char *warning_string;
     char *warning_string;
#endif
#endif
{
{
  int lineWidth;
  int lineWidth;
  int nLines;
  int nLines;
  int curr_line = 0;
  int curr_line = 0;
 
 
  lineWidth = winInfo->generic.width - 1;
  lineWidth = winInfo->generic.width - 1;
  nLines = winInfo->generic.height - 2;
  nLines = winInfo->generic.height - 2;
 
 
  /* set to empty each line in the window, except for the one
  /* set to empty each line in the window, except for the one
     which contains the message */
     which contains the message */
  while (curr_line < winInfo->generic.contentSize)
  while (curr_line < winInfo->generic.contentSize)
    {
    {
      /* set the information related to each displayed line
      /* set the information related to each displayed line
         to null: i.e. the line number is 0, there is no bp,
         to null: i.e. the line number is 0, there is no bp,
         it is not where the program is stopped */
         it is not where the program is stopped */
 
 
      TuiWinElementPtr element =
      TuiWinElementPtr element =
      (TuiWinElementPtr) winInfo->generic.content[curr_line];
      (TuiWinElementPtr) winInfo->generic.content[curr_line];
      element->whichElement.source.lineOrAddr.lineNo = 0;
      element->whichElement.source.lineOrAddr.lineNo = 0;
      element->whichElement.source.isExecPoint = FALSE;
      element->whichElement.source.isExecPoint = FALSE;
      element->whichElement.source.hasBreak = FALSE;
      element->whichElement.source.hasBreak = FALSE;
 
 
      /* set the contents of the line to blank */
      /* set the contents of the line to blank */
      element->whichElement.source.line[0] = (char) 0;
      element->whichElement.source.line[0] = (char) 0;
 
 
      /* if the current line is in the middle of the screen, then we want to
      /* if the current line is in the middle of the screen, then we want to
         display the 'no source available' message in it.
         display the 'no source available' message in it.
         Note: the 'weird' arithmetic with the line width and height comes from
         Note: the 'weird' arithmetic with the line width and height comes from
         the function tuiEraseSourceContent. We need to keep the screen and the
         the function tuiEraseSourceContent. We need to keep the screen and the
         window's actual contents in synch */
         window's actual contents in synch */
 
 
      if (curr_line == (nLines / 2 + 1))
      if (curr_line == (nLines / 2 + 1))
        {
        {
          int i;
          int i;
          int xpos;
          int xpos;
          int warning_length = strlen (warning_string);
          int warning_length = strlen (warning_string);
          char *srcLine;
          char *srcLine;
 
 
          srcLine = element->whichElement.source.line;
          srcLine = element->whichElement.source.line;
 
 
          if (warning_length >= ((lineWidth - 1) / 2))
          if (warning_length >= ((lineWidth - 1) / 2))
            xpos = 1;
            xpos = 1;
          else
          else
            xpos = (lineWidth - 1) / 2 - warning_length;
            xpos = (lineWidth - 1) / 2 - warning_length;
 
 
          for (i = 0; i < xpos; i++)
          for (i = 0; i < xpos; i++)
            srcLine[i] = ' ';
            srcLine[i] = ' ';
 
 
          sprintf (srcLine + i, "%s", warning_string);
          sprintf (srcLine + i, "%s", warning_string);
 
 
          for (i = xpos + warning_length; i < lineWidth; i++)
          for (i = xpos + warning_length; i < lineWidth; i++)
            srcLine[i] = ' ';
            srcLine[i] = ' ';
 
 
          srcLine[i] = '\n';
          srcLine[i] = '\n';
 
 
        }                       /* end if */
        }                       /* end if */
 
 
      curr_line++;
      curr_line++;
 
 
    }                           /* end while */
    }                           /* end while */
 
 
}                               /*tuiSetSourceContentNil */
}                               /*tuiSetSourceContentNil */
 
 
 
 
 
 
 
 
/*
/*
   ** tuiShowSource().
   ** tuiShowSource().
   **        Function to display source in the source window.  This function
   **        Function to display source in the source window.  This function
   **        initializes the horizontal scroll to 0.
   **        initializes the horizontal scroll to 0.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiShowSource (
tuiShowSource (
                struct symtab *s,
                struct symtab *s,
                Opaque line,
                Opaque line,
                int noerror)
                int noerror)
#else
#else
tuiShowSource (s, line, noerror)
tuiShowSource (s, line, noerror)
     struct symtab *s;
     struct symtab *s;
     Opaque line;
     Opaque line;
     int noerror;
     int noerror;
#endif
#endif
{
{
  srcWin->detail.sourceInfo.horizontalOffset = 0;
  srcWin->detail.sourceInfo.horizontalOffset = 0;
  m_tuiShowSourceAsIs (s, line, noerror);
  m_tuiShowSourceAsIs (s, line, noerror);
 
 
  return;
  return;
}                               /* tuiShowSource */
}                               /* tuiShowSource */
 
 
 
 
/*
/*
   ** tuiSourceIsDisplayed().
   ** tuiSourceIsDisplayed().
   **        Answer whether the source is currently displayed in the source window.
   **        Answer whether the source is currently displayed in the source window.
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiSourceIsDisplayed (
tuiSourceIsDisplayed (
                       char *fname)
                       char *fname)
#else
#else
tuiSourceIsDisplayed (fname)
tuiSourceIsDisplayed (fname)
     char *fname;
     char *fname;
#endif
#endif
{
{
  return (srcWin->generic.contentInUse &&
  return (srcWin->generic.contentInUse &&
          (strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())->
          (strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())->
                  content[0])->whichElement.locator.fileName, fname) == 0));
                  content[0])->whichElement.locator.fileName, fname) == 0));
}                               /* tuiSourceIsDisplayed */
}                               /* tuiSourceIsDisplayed */
 
 
 
 
/*
/*
   ** tuiVerticalSourceScroll().
   ** tuiVerticalSourceScroll().
   **      Scroll the source forward or backward vertically
   **      Scroll the source forward or backward vertically
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiVerticalSourceScroll (
tuiVerticalSourceScroll (
                          TuiScrollDirection scrollDirection,
                          TuiScrollDirection scrollDirection,
                          int numToScroll)
                          int numToScroll)
#else
#else
tuiVerticalSourceScroll (scrollDirection, numToScroll)
tuiVerticalSourceScroll (scrollDirection, numToScroll)
     TuiScrollDirection scrollDirection;
     TuiScrollDirection scrollDirection;
     int numToScroll;
     int numToScroll;
#endif
#endif
{
{
  if (srcWin->generic.content != (OpaquePtr) NULL)
  if (srcWin->generic.content != (OpaquePtr) NULL)
    {
    {
      int line;
      int line;
      Opaque addr;
      Opaque addr;
      struct symtab *s;
      struct symtab *s;
      TuiWinContent content = (TuiWinContent) srcWin->generic.content;
      TuiWinContent content = (TuiWinContent) srcWin->generic.content;
 
 
      if (current_source_symtab == (struct symtab *) NULL)
      if (current_source_symtab == (struct symtab *) NULL)
        s = find_pc_symtab (selected_frame->pc);
        s = find_pc_symtab (selected_frame->pc);
      else
      else
        s = current_source_symtab;
        s = current_source_symtab;
 
 
      if (scrollDirection == FORWARD_SCROLL)
      if (scrollDirection == FORWARD_SCROLL)
        {
        {
          line = content[0]->whichElement.source.lineOrAddr.lineNo +
          line = content[0]->whichElement.source.lineOrAddr.lineNo +
            numToScroll;
            numToScroll;
          if (line > s->nlines)
          if (line > s->nlines)
            /*line = s->nlines - winInfo->generic.contentSize + 1; */
            /*line = s->nlines - winInfo->generic.contentSize + 1; */
            /*elz: fix for dts 23398 */
            /*elz: fix for dts 23398 */
            line = content[0]->whichElement.source.lineOrAddr.lineNo;
            line = content[0]->whichElement.source.lineOrAddr.lineNo;
        }
        }
      else
      else
        {
        {
          line = content[0]->whichElement.source.lineOrAddr.lineNo -
          line = content[0]->whichElement.source.lineOrAddr.lineNo -
            numToScroll;
            numToScroll;
          if (line <= 0)
          if (line <= 0)
            line = 1;
            line = 1;
        }
        }
      tuiUpdateSourceWindowAsIs (srcWin, s, (Opaque) line, FALSE);
      tuiUpdateSourceWindowAsIs (srcWin, s, (Opaque) line, FALSE);
    }
    }
 
 
  return;
  return;
}                               /* tuiVerticalSourceScroll */
}                               /* tuiVerticalSourceScroll */
 
 
 
 
/*****************************************
/*****************************************
** STATIC LOCAL FUNCTIONS                 **
** STATIC LOCAL FUNCTIONS                 **
******************************************/
******************************************/
 
 
/*
/*
   ** _hasBreak().
   ** _hasBreak().
   **        Answer whether there is a break point at the input line in
   **        Answer whether there is a break point at the input line in
   **        the source file indicated
   **        the source file indicated
 */
 */
static struct breakpoint *
static struct breakpoint *
#ifdef __STDC__
#ifdef __STDC__
_hasBreak (
_hasBreak (
            char *sourceFileName,
            char *sourceFileName,
            int lineNo)
            int lineNo)
#else
#else
_hasBreak (sourceFileName, lineNo)
_hasBreak (sourceFileName, lineNo)
     char *sourceFileName;
     char *sourceFileName;
     int lineNo;
     int lineNo;
#endif
#endif
{
{
  struct breakpoint *bpWithBreak = (struct breakpoint *) NULL;
  struct breakpoint *bpWithBreak = (struct breakpoint *) NULL;
  struct breakpoint *bp;
  struct breakpoint *bp;
  extern struct breakpoint *breakpoint_chain;
  extern struct breakpoint *breakpoint_chain;
 
 
 
 
  for (bp = breakpoint_chain;
  for (bp = breakpoint_chain;
       (bp != (struct breakpoint *) NULL &&
       (bp != (struct breakpoint *) NULL &&
        bpWithBreak == (struct breakpoint *) NULL);
        bpWithBreak == (struct breakpoint *) NULL);
       bp = bp->next)
       bp = bp->next)
    if ((strcmp (sourceFileName, bp->source_file) == 0) &&
    if ((strcmp (sourceFileName, bp->source_file) == 0) &&
        (lineNo == bp->line_number))
        (lineNo == bp->line_number))
      bpWithBreak = bp;
      bpWithBreak = bp;
 
 
  return bpWithBreak;
  return bpWithBreak;
}                               /* _hasBreak */
}                               /* _hasBreak */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.