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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [gdb-events.sh] - Diff between revs 105 and 1765

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

Rev 105 Rev 1765
#!/bin/sh
#!/bin/sh
 
 
# User Interface Events.
# User Interface Events.
# Copyright 1999-2000 Free Software Foundation, Inc.
# Copyright 1999-2000 Free Software Foundation, Inc.
#
#
# Contributed by Cygnus Solutions.
# Contributed by Cygnus Solutions.
#
#
# This file is part of GDB.
# This file is part of GDB.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 
#
#
# What happens next:
# What happens next:
#
#
 
 
# The gdb-events.h/gdb-events.c files this script generates are commited
# The gdb-events.h/gdb-events.c files this script generates are commited
# and published.
# and published.
 
 
# Any UI module that is installing events is changed so that the
# Any UI module that is installing events is changed so that the
# events are installed using the ``set_gdb_events()'' and
# events are installed using the ``set_gdb_events()'' and
# ``gdb_event_hooks()'' interfaces.  There could prove to be an issue
# ``gdb_event_hooks()'' interfaces.  There could prove to be an issue
# here with respect to annotate.  We might need to accomodate a hook
# here with respect to annotate.  We might need to accomodate a hook
# stack that allows several ui blocks to install their own events.
# stack that allows several ui blocks to install their own events.
 
 
# Each of the variable events (as currently generated) is converteded
# Each of the variable events (as currently generated) is converteded
# to either a straight function call or a function call with a
# to either a straight function call or a function call with a
# predicate.
# predicate.
 
 
 
 
IFS=:
IFS=:
 
 
read="class returntype function formal actual attrib"
read="class returntype function formal actual attrib"
 
 
function_list ()
function_list ()
{
{
  # category:
  # category:
  #        # -> disable
  #        # -> disable
  #        * -> compatibility - pointer variable that is initialized
  #        * -> compatibility - pointer variable that is initialized
  #             by set_gdb_events().
  #             by set_gdb_events().
  #        ? -> Predicate and function proper.
  #        ? -> Predicate and function proper.
  #        f -> always call (must have a void returntype)
  #        f -> always call (must have a void returntype)
  # return-type
  # return-type
  # name
  # name
  # formal argument list
  # formal argument list
  # actual argument list
  # actual argument list
  # attributes
  # attributes
  # description
  # description
  cat <<EOF |
  cat <<EOF |
f:void:breakpoint_create:int b:b
f:void:breakpoint_create:int b:b
f:void:breakpoint_delete:int b:b
f:void:breakpoint_delete:int b:b
f:void:breakpoint_modify:int b:b
f:void:breakpoint_modify:int b:b
#*:void:annotate_starting_hook:void
#*:void:annotate_starting_hook:void
#*:void:annotate_stopped_hook:void
#*:void:annotate_stopped_hook:void
#*:void:annotate_signalled_hook:void
#*:void:annotate_signalled_hook:void
#*:void:annotate_signal_hook:void
#*:void:annotate_signal_hook:void
#*:void:annotate_exited_hook:void
#*:void:annotate_exited_hook:void
##*:void:print_register_hook:int
##*:void:print_register_hook:int
##*:CORE_ADDR:find_toc_address_hook:CORE_ADDR
##*:CORE_ADDR:find_toc_address_hook:CORE_ADDR
##*:void:sparc_print_register_hook:int regno:regno
##*:void:sparc_print_register_hook:int regno:regno
#*:void:target_resume_hook:void
#*:void:target_resume_hook:void
#*:void:target_wait_loop_hook:void
#*:void:target_wait_loop_hook:void
#*:void:init_gdb_hook:char *argv0:argv0
#*:void:init_gdb_hook:char *argv0:argv0
#*:void:command_loop_hook:void
#*:void:command_loop_hook:void
#*:void:fputs_unfiltered_hook:const char *linebuff,struct ui_file *stream:linebuff, stream
#*:void:fputs_unfiltered_hook:const char *linebuff,struct ui_file *stream:linebuff, stream
#*:void:print_frame_info_listing_hook:struct symtab *s, int line, int stopline, int noerror:s, line, stopline, noerror
#*:void:print_frame_info_listing_hook:struct symtab *s, int line, int stopline, int noerror:s, line, stopline, noerror
#*:int:query_hook:const char *query, va_list args:query, args
#*:int:query_hook:const char *query, va_list args:query, args
#*:void:warning_hook:const char *string, va_list args:string, args
#*:void:warning_hook:const char *string, va_list args:string, args
#*:void:target_output_hook:char *b:b
#*:void:target_output_hook:char *b:b
#*:void:interactive_hook:void
#*:void:interactive_hook:void
#*:void:registers_changed_hook:void
#*:void:registers_changed_hook:void
#*:void:readline_begin_hook:char *format, ...:format
#*:void:readline_begin_hook:char *format, ...:format
#*:char *:readline_hook:char *prompt:prompt
#*:char *:readline_hook:char *prompt:prompt
#*:void:readline_end_hook:void
#*:void:readline_end_hook:void
#*:void:register_changed_hook:int regno:regno
#*:void:register_changed_hook:int regno:regno
#*:void:memory_changed_hook:CORE_ADDR addr, int len:addr, len
#*:void:memory_changed_hook:CORE_ADDR addr, int len:addr, len
#*:void:context_hook:int num:num
#*:void:context_hook:int num:num
#*:int:target_wait_hook:int pid, struct target_waitstatus *status:pid, status
#*:int:target_wait_hook:int pid, struct target_waitstatus *status:pid, status
#*:void:call_command_hook:struct cmd_list_element *c, char *cmd, int from_tty:c, cmd, from_tty
#*:void:call_command_hook:struct cmd_list_element *c, char *cmd, int from_tty:c, cmd, from_tty
#*:NORETURN void:error_hook:void:: ATTR_NORETURN
#*:NORETURN void:error_hook:void:: ATTR_NORETURN
#*:void:error_begin_hook:void
#*:void:error_begin_hook:void
##*:int:target_architecture_hook:const struct bfd_arch_info *
##*:int:target_architecture_hook:const struct bfd_arch_info *
#*:void:exec_file_display_hook:char *filename:filename
#*:void:exec_file_display_hook:char *filename:filename
#*:void:file_changed_hook:char *filename:filename
#*:void:file_changed_hook:char *filename:filename
##*:void:specify_exec_file_hook:
##*:void:specify_exec_file_hook:
#*:int:gdb_load_progress_hook:char *section, unsigned long num:section, num
#*:int:gdb_load_progress_hook:char *section, unsigned long num:section, num
#*:void:pre_add_symbol_hook:char *name:name
#*:void:pre_add_symbol_hook:char *name:name
#*:void:post_add_symbol_hook:void
#*:void:post_add_symbol_hook:void
#*:void:selected_frame_level_changed_hook:int level:level
#*:void:selected_frame_level_changed_hook:int level:level
#*:int:gdb_loop_hook:int signo:signo
#*:int:gdb_loop_hook:int signo:signo
##*:void:solib_create_inferior_hook:void
##*:void:solib_create_inferior_hook:void
##*:void:xcoff_relocate_symtab_hook:unsigned int
##*:void:xcoff_relocate_symtab_hook:unsigned int
EOF
EOF
  grep -v '^#'
  grep -v '^#'
}
}
 
 
copyright ()
copyright ()
{
{
  cat <<EOF
  cat <<EOF
/* User Interface Events.
/* User Interface Events.
   Copyright 1999 Free Software Foundation, Inc.
   Copyright 1999 Free Software Foundation, Inc.
 
 
   Contributed by Cygnus Solutions.
   Contributed by Cygnus Solutions.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
/* Work in progress */
/* Work in progress */
 
 
/* This file was created with the aid of \`\`gdb-events.sh''.
/* This file was created with the aid of \`\`gdb-events.sh''.
 
 
   The bourn shell script \`\`gdb-events.sh'' creates the files
   The bourn shell script \`\`gdb-events.sh'' creates the files
   \`\`new-gdb-events.c'' and \`\`new-gdb-events.h and then compares
   \`\`new-gdb-events.c'' and \`\`new-gdb-events.h and then compares
   them against the existing \`\`gdb-events.[hc]''.  Any differences
   them against the existing \`\`gdb-events.[hc]''.  Any differences
   found being reported.
   found being reported.
 
 
   If editing this file, please also run gdb-events.sh and merge any
   If editing this file, please also run gdb-events.sh and merge any
   changes into that script. Conversely, when making sweeping changes
   changes into that script. Conversely, when making sweeping changes
   to this file, modifying gdb-events.sh and using its output may
   to this file, modifying gdb-events.sh and using its output may
   prove easier. */
   prove easier. */
 
 
EOF
EOF
}
}
 
 
#
#
# The .h file
# The .h file
#
#
 
 
exec > new-gdb-events.h
exec > new-gdb-events.h
copyright
copyright
cat <<EOF
cat <<EOF
 
 
#ifndef GDB_EVENTS_H
#ifndef GDB_EVENTS_H
#define GDB_EVENTS_H
#define GDB_EVENTS_H
 
 
#ifndef WITH_GDB_EVENTS
#ifndef WITH_GDB_EVENTS
#define WITH_GDB_EVENTS 1
#define WITH_GDB_EVENTS 1
#endif
#endif
EOF
EOF
 
 
# pointer declarations
# pointer declarations
echo ""
echo ""
echo ""
echo ""
cat <<EOF
cat <<EOF
/* COMPAT: pointer variables for old, unconverted events.
/* COMPAT: pointer variables for old, unconverted events.
   A call to set_gdb_events() will automatically update these. */
   A call to set_gdb_events() will automatically update these. */
EOF
EOF
echo ""
echo ""
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "*" )
    "*" )
        echo "extern ${returntype} (*${function}_event) (${formal})${attrib};"
        echo "extern ${returntype} (*${function}_event) (${formal})${attrib};"
        ;;
        ;;
  esac
  esac
done
done
 
 
# function typedef's
# function typedef's
echo ""
echo ""
echo ""
echo ""
cat <<EOF
cat <<EOF
/* Type definition of all hook functions.
/* Type definition of all hook functions.
   Recommended pratice is to first declare each hook function using
   Recommended pratice is to first declare each hook function using
   the below ftype and then define it. */
   the below ftype and then define it. */
EOF
EOF
echo ""
echo ""
function_list | while eval read $read
function_list | while eval read $read
do
do
  echo "typedef ${returntype} (gdb_events_${function}_ftype) (${formal});"
  echo "typedef ${returntype} (gdb_events_${function}_ftype) (${formal});"
done
done
 
 
# gdb_events object
# gdb_events object
echo ""
echo ""
echo ""
echo ""
cat <<EOF
cat <<EOF
/* gdb-events: object. */
/* gdb-events: object. */
EOF
EOF
echo ""
echo ""
echo "struct gdb_events"
echo "struct gdb_events"
echo "  {"
echo "  {"
function_list | while eval read $read
function_list | while eval read $read
do
do
  echo "    gdb_events_${function}_ftype *${function}${attrib};"
  echo "    gdb_events_${function}_ftype *${function}${attrib};"
done
done
echo "  };"
echo "  };"
 
 
# function declarations
# function declarations
echo ""
echo ""
echo ""
echo ""
cat <<EOF
cat <<EOF
/* Interface into events functions.
/* Interface into events functions.
   Where a *_p() predicate is present, it must be called before
   Where a *_p() predicate is present, it must be called before
   calling the hook proper. */
   calling the hook proper. */
EOF
EOF
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "*" ) continue ;;
    "*" ) continue ;;
    "?" )
    "?" )
        echo "extern int ${function}_p (void);"
        echo "extern int ${function}_p (void);"
        echo "extern ${returntype} ${function}_event (${formal})${attrib};"
        echo "extern ${returntype} ${function}_event (${formal})${attrib};"
        ;;
        ;;
    "f" )
    "f" )
        echo "extern ${returntype} ${function}_event (${formal})${attrib};"
        echo "extern ${returntype} ${function}_event (${formal})${attrib};"
        ;;
        ;;
  esac
  esac
done
done
 
 
# function macros
# function macros
echo ""
echo ""
echo ""
echo ""
cat <<EOF
cat <<EOF
/* When GDB_EVENTS are not being used, completly disable them. */
/* When GDB_EVENTS are not being used, completly disable them. */
EOF
EOF
echo ""
echo ""
echo "#if !WITH_GDB_EVENTS"
echo "#if !WITH_GDB_EVENTS"
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "*" ) continue ;;
    "*" ) continue ;;
    "?" )
    "?" )
        echo "#define ${function}_event_p() 0"
        echo "#define ${function}_event_p() 0"
        echo "#define ${function}_event(${actual}) 0"
        echo "#define ${function}_event(${actual}) 0"
        ;;
        ;;
    "f" )
    "f" )
        echo "#define ${function}_event(${actual}) 0"
        echo "#define ${function}_event(${actual}) 0"
        ;;
        ;;
  esac
  esac
done
done
echo "#endif"
echo "#endif"
 
 
# our set function
# our set function
cat <<EOF
cat <<EOF
 
 
/* Install custom gdb-events hooks. */
/* Install custom gdb-events hooks. */
extern struct gdb_events *set_gdb_event_hooks (struct gdb_events *vector);
extern struct gdb_events *set_gdb_event_hooks (struct gdb_events *vector);
 
 
/* Deliver any pending events. */
/* Deliver any pending events. */
extern void gdb_events_deliver (struct gdb_events *vector);
extern void gdb_events_deliver (struct gdb_events *vector);
 
 
#if !WITH_GDB_EVENTS
#if !WITH_GDB_EVENTS
#define set_gdb_events(x) 0
#define set_gdb_events(x) 0
#define set_gdb_event_hooks(x) 0
#define set_gdb_event_hooks(x) 0
#define gdb_events_deliver(x) 0
#define gdb_events_deliver(x) 0
#endif
#endif
EOF
EOF
 
 
# close it off
# close it off
echo ""
echo ""
echo "#endif"
echo "#endif"
exec 1>&2
exec 1>&2
#../move-if-change new-gdb-events.h gdb-events.h
#../move-if-change new-gdb-events.h gdb-events.h
if ! test -r gdb-events.h
if ! test -r gdb-events.h
then
then
  echo "File missing? mv new-gdb-events.h gdb-events.h" 1>&2
  echo "File missing? mv new-gdb-events.h gdb-events.h" 1>&2
elif ! diff -c gdb-events.h new-gdb-events.h
elif ! diff -c gdb-events.h new-gdb-events.h
then
then
  echo "gdb-events.h changed? cp new-gdb-events.h gdb-events.h" 1>&2
  echo "gdb-events.h changed? cp new-gdb-events.h gdb-events.h" 1>&2
fi
fi
 
 
 
 
 
 
#
#
# C file
# C file
#
#
 
 
exec > new-gdb-events.c
exec > new-gdb-events.c
copyright
copyright
cat <<EOF
cat <<EOF
 
 
#include "defs.h"
#include "defs.h"
#include "gdb-events.h"
#include "gdb-events.h"
#include "gdbcmd.h"
#include "gdbcmd.h"
 
 
#undef XMALLOC
#undef XMALLOC
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
 
 
#if WITH_GDB_EVENTS
#if WITH_GDB_EVENTS
static struct gdb_events null_event_hooks;
static struct gdb_events null_event_hooks;
static struct gdb_events queue_event_hooks;
static struct gdb_events queue_event_hooks;
static struct gdb_events *current_event_hooks = &null_event_hooks;
static struct gdb_events *current_event_hooks = &null_event_hooks;
#endif
#endif
 
 
int gdb_events_debug;
int gdb_events_debug;
EOF
EOF
 
 
# global pointer variables - always have this
# global pointer variables - always have this
#echo ""
#echo ""
#function_list | while eval read $read
#function_list | while eval read $read
#do
#do
#  case "${class}" in
#  case "${class}" in
#    "*" )
#    "*" )
#       echo "${returntype} (*${function}_event) (${formal})${attrib} = 0;"
#       echo "${returntype} (*${function}_event) (${formal})${attrib} = 0;"
#       ;;
#       ;;
#  esac
#  esac
#done
#done
 
 
# function bodies
# function bodies
echo ""
echo ""
echo "#if WITH_GDB_EVENTS"
echo "#if WITH_GDB_EVENTS"
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "*" ) continue ;;
    "*" ) continue ;;
    "?" )
    "?" )
        echo ""
        echo ""
        echo "int"
        echo "int"
        echo "${function}_event_p (${formal})"
        echo "${function}_event_p (${formal})"
        echo "{"
        echo "{"
        echo "  return current_event_hooks->${function};"
        echo "  return current_event_hooks->${function};"
        echo "}"
        echo "}"
        echo ""
        echo ""
        echo "${returntype}"
        echo "${returntype}"
        echo "${function}_event (${formal})"
        echo "${function}_event (${formal})"
        echo "{"
        echo "{"
        echo "  return current_events->${function} (${actual});"
        echo "  return current_events->${function} (${actual});"
        echo "}"
        echo "}"
        ;;
        ;;
     "f" )
     "f" )
        echo ""
        echo ""
        echo "void"
        echo "void"
        echo "${function}_event (${formal})"
        echo "${function}_event (${formal})"
        echo "{"
        echo "{"
        echo "  if (gdb_events_debug)"
        echo "  if (gdb_events_debug)"
        echo "    fprintf_unfiltered (gdb_stdlog, \"${function}_event\\n\");"
        echo "    fprintf_unfiltered (gdb_stdlog, \"${function}_event\\n\");"
        echo "  if (!current_event_hooks->${function})"
        echo "  if (!current_event_hooks->${function})"
        echo "    return;"
        echo "    return;"
        echo "  current_event_hooks->${function} (${actual});"
        echo "  current_event_hooks->${function} (${actual});"
        echo "}"
        echo "}"
        ;;
        ;;
  esac
  esac
done
done
echo ""
echo ""
echo "#endif"
echo "#endif"
 
 
# Set hooks function
# Set hooks function
echo ""
echo ""
cat <<EOF
cat <<EOF
#if WITH_GDB_EVENTS
#if WITH_GDB_EVENTS
struct gdb_events *
struct gdb_events *
set_gdb_event_hooks (struct gdb_events *vector)
set_gdb_event_hooks (struct gdb_events *vector)
{
{
  struct gdb_events *old_events = current_event_hooks;
  struct gdb_events *old_events = current_event_hooks;
  if (vector == NULL)
  if (vector == NULL)
    current_event_hooks = &queue_event_hooks;
    current_event_hooks = &queue_event_hooks;
  else
  else
    current_event_hooks = vector;
    current_event_hooks = vector;
  return old_events;
  return old_events;
EOF
EOF
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "*" )
    "*" )
      echo "  ${function}_event = hooks->${function};"
      echo "  ${function}_event = hooks->${function};"
      ;;
      ;;
  esac
  esac
done
done
cat <<EOF
cat <<EOF
}
}
#endif
#endif
EOF
EOF
 
 
# event type
# event type
echo ""
echo ""
cat <<EOF
cat <<EOF
enum gdb_event
enum gdb_event
{
{
EOF
EOF
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "f" )
    "f" )
      echo "  ${function},"
      echo "  ${function},"
      ;;
      ;;
  esac
  esac
done
done
cat <<EOF
cat <<EOF
  nr_gdb_events
  nr_gdb_events
};
};
EOF
EOF
 
 
# event data
# event data
echo ""
echo ""
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "f" )
    "f" )
      echo "struct ${function}"
      echo "struct ${function}"
      echo "  {"
      echo "  {"
      echo "    `echo ${formal} | tr '[,]' '[;]'`;"
      echo "    `echo ${formal} | tr '[,]' '[;]'`;"
      echo "  };"
      echo "  };"
      echo ""
      echo ""
      ;;
      ;;
  esac
  esac
done
done
 
 
# event queue
# event queue
cat <<EOF
cat <<EOF
struct event
struct event
  {
  {
    enum gdb_event type;
    enum gdb_event type;
    struct event *next;
    struct event *next;
    union
    union
      {
      {
EOF
EOF
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "f" )
    "f" )
      echo "        struct ${function} ${function};"
      echo "        struct ${function} ${function};"
      ;;
      ;;
  esac
  esac
done
done
cat <<EOF
cat <<EOF
      }
      }
    data;
    data;
  };
  };
struct event *pending_events;
struct event *pending_events;
struct event *delivering_events;
struct event *delivering_events;
EOF
EOF
 
 
# append
# append
echo ""
echo ""
cat <<EOF
cat <<EOF
static void
static void
append (struct event *new_event)
append (struct event *new_event)
{
{
  struct event **event = &pending_events;
  struct event **event = &pending_events;
  while ((*event) != NULL)
  while ((*event) != NULL)
    event = &((*event)->next);
    event = &((*event)->next);
  (*event) = new_event;
  (*event) = new_event;
  (*event)->next = NULL;
  (*event)->next = NULL;
}
}
EOF
EOF
 
 
# schedule a given event
# schedule a given event
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "f" )
    "f" )
      echo ""
      echo ""
      echo "static void"
      echo "static void"
      echo "queue_${function} (${formal})"
      echo "queue_${function} (${formal})"
      echo "{"
      echo "{"
      echo "  struct event *event = XMALLOC (struct event);"
      echo "  struct event *event = XMALLOC (struct event);"
      echo "  event->type = ${function};"
      echo "  event->type = ${function};"
      for arg in `echo ${actual} | tr '[,]' '[ ]'`; do
      for arg in `echo ${actual} | tr '[,]' '[ ]'`; do
        echo "  event->data.${function}.${arg} = ${arg};"
        echo "  event->data.${function}.${arg} = ${arg};"
      done
      done
      echo "  append (event);"
      echo "  append (event);"
      echo "}"
      echo "}"
      ;;
      ;;
  esac
  esac
done
done
 
 
# deliver
# deliver
echo ""
echo ""
cat <<EOF
cat <<EOF
void
void
gdb_events_deliver (struct gdb_events *vector)
gdb_events_deliver (struct gdb_events *vector)
{
{
  /* Just zap any events left around from last time. */
  /* Just zap any events left around from last time. */
  while (delivering_events != NULL)
  while (delivering_events != NULL)
    {
    {
      struct event *event = delivering_events;
      struct event *event = delivering_events;
      delivering_events = event->next;
      delivering_events = event->next;
      free (event);
      free (event);
    }
    }
  /* Process any pending events.  Because one of the deliveries could
  /* Process any pending events.  Because one of the deliveries could
     bail out we move everything off of the pending queue onto an
     bail out we move everything off of the pending queue onto an
     in-progress queue where it can, later, be cleaned up if
     in-progress queue where it can, later, be cleaned up if
     necessary. */
     necessary. */
  delivering_events = pending_events;
  delivering_events = pending_events;
  pending_events = NULL;
  pending_events = NULL;
  while (delivering_events != NULL)
  while (delivering_events != NULL)
    {
    {
      struct event *event = delivering_events;
      struct event *event = delivering_events;
      switch (event->type)
      switch (event->type)
        {
        {
EOF
EOF
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "f" )
    "f" )
      echo "        case ${function}:"
      echo "        case ${function}:"
      echo "          vector->${function}"
      echo "          vector->${function}"
      sep="            ("
      sep="            ("
      ass=""
      ass=""
      for arg in `echo ${actual} | tr '[,]' '[ ]'`; do
      for arg in `echo ${actual} | tr '[,]' '[ ]'`; do
        ass="${ass}${sep}event->data.${function}.${arg}"
        ass="${ass}${sep}event->data.${function}.${arg}"
        sep=",
        sep=",
             "
             "
      done
      done
      echo "${ass});"
      echo "${ass});"
      echo "          break;"
      echo "          break;"
      ;;
      ;;
  esac
  esac
done
done
cat <<EOF
cat <<EOF
        }
        }
      delivering_events = event->next;
      delivering_events = event->next;
      free (event);
      free (event);
    }
    }
}
}
EOF
EOF
 
 
# Finally the initialization
# Finally the initialization
echo ""
echo ""
cat <<EOF
cat <<EOF
void _initialize_gdb_events (void);
void _initialize_gdb_events (void);
void
void
_initialize_gdb_events (void)
_initialize_gdb_events (void)
{
{
  struct cmd_list_element *c;
  struct cmd_list_element *c;
#if WITH_GDB_EVENTS
#if WITH_GDB_EVENTS
EOF
EOF
function_list | while eval read $read
function_list | while eval read $read
do
do
  case "${class}" in
  case "${class}" in
    "f" )
    "f" )
      echo "  queue_event_hooks.${function} = queue_${function};"
      echo "  queue_event_hooks.${function} = queue_${function};"
      ;;
      ;;
  esac
  esac
done
done
cat <<EOF
cat <<EOF
#endif
#endif
 
 
  c = add_set_cmd ("eventdebug", class_maintenance, var_zinteger,
  c = add_set_cmd ("eventdebug", class_maintenance, var_zinteger,
                   (char *) (&gdb_events_debug), "Set event debugging.\n\\
                   (char *) (&gdb_events_debug), "Set event debugging.\n\\
When non-zero, event/notify debugging is enabled.", &setlist);
When non-zero, event/notify debugging is enabled.", &setlist);
  deprecate_cmd (c, "set debug event");
  deprecate_cmd (c, "set debug event");
  deprecate_cmd (add_show_from_set (c, &showlist), "show debug event");
  deprecate_cmd (add_show_from_set (c, &showlist), "show debug event");
 
 
  add_show_from_set (add_set_cmd ("event",
  add_show_from_set (add_set_cmd ("event",
                                  class_maintenance,
                                  class_maintenance,
                                  var_zinteger,
                                  var_zinteger,
                                  (char *) (&gdb_events_debug),
                                  (char *) (&gdb_events_debug),
                                  "Set event debugging.\n\\
                                  "Set event debugging.\n\\
When non-zero, event/notify debugging is enabled.", &setdebuglist),
When non-zero, event/notify debugging is enabled.", &setdebuglist),
                     &showdebuglist);
                     &showdebuglist);
}
}
EOF
EOF
 
 
# close things off
# close things off
exec 1>&2
exec 1>&2
#../move-if-change new-gdb-events.c gdb-events.c
#../move-if-change new-gdb-events.c gdb-events.c
# Replace any leading spaces with tabs
# Replace any leading spaces with tabs
sed < new-gdb-events.c > tmp-gdb-events.c \
sed < new-gdb-events.c > tmp-gdb-events.c \
    -e 's/\(    \)*        /\1  /g'
    -e 's/\(    \)*        /\1  /g'
mv tmp-gdb-events.c new-gdb-events.c
mv tmp-gdb-events.c new-gdb-events.c
# Move if changed?
# Move if changed?
if ! test -r gdb-events.c
if ! test -r gdb-events.c
then
then
  echo "File missing? mv new-gdb-events.c gdb-events.c" 1>&2
  echo "File missing? mv new-gdb-events.c gdb-events.c" 1>&2
elif ! diff -c gdb-events.c new-gdb-events.c
elif ! diff -c gdb-events.c new-gdb-events.c
then
then
  echo "gdb-events.c changed? cp new-gdb-events.c gdb-events.c" 1>&2
  echo "gdb-events.c changed? cp new-gdb-events.c gdb-events.c" 1>&2
fi
fi
 
 

powered by: WebSVN 2.1.0

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