Changeset 105efec in git


Ignore:
Timestamp:
Mar 19, 1999, 5:00:08 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
6e5833a152795ed30010fc0beaaad4726c3f070a
Parents:
7df2efebb313231238a051a876d8a3dd8d3b1e4c
Message:
* hannes: MTRACK fixes


git-svn-id: file:///usr/local/Singular/svn/trunk@2962 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • Singular/Makefile.in

    r7df2ef r105efec  
    184184
    185185
    186 mmtables.inc: mmtables.c mmprivate.h
     186mmtables.inc: mmtables.c mmprivate.h mod2.h
    187187        ${CXX} ${CXXFLAGS}  ${CPPFLAGS} ${DEFS} \
    188188               -DGENERATE_INDEX_TABLE -DHAVE_INDEX_TABLE mmtables.c -o mmtables
  • Singular/mmalloc.c

    r7df2ef r105efec  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmalloc.c,v 1.12 1999-02-03 13:18:59 obachman Exp $ */
     4/* $Id: mmalloc.c,v 1.13 1999-03-19 16:00:04 Singular Exp $ */
    55
    66/*
     
    2121#include "mmemory.h"
    2222#include "mmprivate.h"
     23#ifdef MTRACK
     24#include "mmbt.h"
     25#endif
    2326
    2427#undef HAVE_ASSUME
     
    184187  mmAllocHeap((void*) result, heap);
    185188#endif 
     189
     190#ifdef MTRACK
     191  mmTrack(result->bt_stack);
     192#endif
    186193
    187194  if (! mmCheckDBMCB(result, SizeFromRealSize(mmGetHeapBlockSize(heap)),
     
    273280
    274281      mmFillDBMCB(result, size, NULL, MM_USEDFLAG, fname, lineno);
     282 
     283      #ifdef MTRACK
     284      mmTrack(result->bt_stack);
     285      #endif
    275286     
    276287      return (void*) &(result->data);
  • Singular/mmbt.c

    r7df2ef r105efec  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmbt.c,v 1.6 1999-03-18 17:00:15 Singular Exp $ */
     4/* $Id: mmbt.c,v 1.7 1999-03-19 16:00:05 Singular Exp $ */
    55/*
    66* ABSTRACT: backtrace: part of memory subsystem (for linux/elf)
     
    3333#if defined(linux) && defined(__i386__)
    3434
    35 static ulong mm_lowpc=0, mm_highpc=0;
     35static unsigned long mm_lowpc=0, mm_highpc=0;
    3636
    3737extern int etext ();
     
    4646#endif
    4747
    48 #define entrypc(pc)        ((pc >= mm_lowpc && pc <= mm_highpc) || pc >= (ulong) &etext || (pc < 4096))
     48#define entrypc(pc)        ((pc >= mm_lowpc && pc <= mm_highpc) || pc >= (unsigned long) &etext || (pc < 4096))
    4949#define getfp(ap)        (ap-2-SLOP)
    5050#define getpc(fp)        (fp[1+SLOP])
     
    6363}
    6464
    65 void mmTrack (ulong *bt_stack)
     65void mmTrack (unsigned long *bt_stack)
    6666{
    67   ulong pc, *fp = getfp ((ulong *) &bt_stack);
     67  unsigned long pc, *fp = getfp ((unsigned long *) &bt_stack);
    6868  int i=0;
    6969
    7070  if (mm_lowpc==0) mmTrackInit();
    7171
    72   while ((fp!=NULL) && ((ulong)fp>4095)  && *fp && (pc = getpc (fp))
     72  while ((fp!=NULL) && ((unsigned long)fp>4095)  && *fp && (pc = getpc (fp))
    7373  && !entrypc (pc) && (i<BT_MAXSTACK))
    7474  {
    7575    bt_stack[i]=pc; i++;
    76     fp = (ulong *) *fp;
     76    fp = (unsigned long *) *fp;
    7777  }
    7878  while(i<BT_MAXSTACK)
     
    8484struct
    8585{
    86   ulong p;
     86  unsigned long p;
    8787  char *name;
    8888} p2n[MAX_PROCS_BT];
    8989
    90 static int mm_p2n_max;
     90static int mm_p2n_max = -1;
    9191void mmP2cNameInit()
    9292{
     
    110110  mm_p2n_max=i;
    111111}
    112 char * mmP2cName(ulong p)
     112char * mmP2cName(unsigned long p)
    113113{
    114114  int a=0;
    115115  int e=mm_p2n_max;
    116116  int i;
     117  if (mm_p2n_max == -1)
     118    mmP2cNameInit();
    117119  loop
    118120  {
     
    146148}
    147149
    148 void mmPrintStack(ulong *bt_stack) /* print stack */
     150void mmPrintStack(unsigned long *bt_stack) /* print stack */
    149151{
    150152  int i=0;
     153  PrintS(" ");
    151154  do
    152155  {
    153     Print(":%x(%s)",bt_stack[i],mmP2cName(bt_stack[i]));
     156    char *s;
     157    fprintf( stderr,":%x",bt_stack[i]);
     158    s=mmP2cName(bt_stack[i]);
     159    if (s!=NULL)
     160      fprintf( stderr,"/%s",s);
    154161    i++;
    155162  } while ((i<BT_MAXSTACK) && (bt_stack[i]!=0));
    156   PrintLn();
     163  fprintf( stderr,"\n");
    157164}
    158165#endif /* linux, i386 */
  • Singular/mmbt.h

    r7df2ef r105efec  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mmbt.h,v 1.1 1999-03-18 16:30:52 Singular Exp $ */
     6/* $Id: mmbt.h,v 1.2 1999-03-19 16:00:05 Singular Exp $ */
    77/*
    88* ABSTRACT: backtrace: part of memory subsystem (for linux/elf)
     
    2121#if defined(linux) && defined(__i386__)
    2222
    23 #undef ulong
    24 #define ulong unsigned long
    25 
    2623int mmTrackInit (); /* init. of global variables */
    27 void mmTrack (ulong *bt_stack); /* store the current stack into bt_stack */
     24void mmTrack (unsigned long *bt_stack); /* store the current stack into bt_stack */
    2825
    2926void mmP2cNameInit(); /* init. of PC -> Name resolution */
    30 char * mmP2cName(ulong p); /* PC -> Name resolution */
    31 void mmPrintStack(ulong *bt_stack); /* print stack */
     27char * mmP2cName(unsigned long p); /* PC -> Name resolution */
     28void mmPrintStack(unsigned long *bt_stack); /* print stack */
    3229
    3330#endif /* linux, i386 */
  • Singular/mmcheck.c

    r7df2ef r105efec  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmcheck.c,v 1.4 1999-03-18 17:00:15 Singular Exp $ */
     4/* $Id: mmcheck.c,v 1.5 1999-03-19 16:00:06 Singular Exp $ */
    55
    66/*
     
    2121#include "mmpage.h"
    2222#include "mmheap.h"
     23#ifdef MTRACK
     24#include "mmbt.h"
     25#endif
    2326
    2427
     
    168171  memset(what->front_pattern, MM_FRONT_PATTERN, MM_NUMBER_OF_FRONT_PATTERNS);
    169172  memset((char*) addr + size, MM_BACK_PATTERN, DebugOffsetBack);
    170   #ifdef MTRACK
    171   mmTrack(what->bt_stack);
    172   #endif
    173173}
    174174
  • Singular/mmisc.c

    r7df2ef r105efec  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmisc.c,v 1.3 1999-03-19 14:18:02 obachman Exp $ */
     4/* $Id: mmisc.c,v 1.4 1999-03-19 16:00:07 Singular Exp $ */
    55
    66/*
     
    1313#include "mmpage.h"
    1414#include "febase.h"
     15#ifdef MTRACK
     16#include "mmbt.h"
     17#endif
    1518
    1619static int mm_specIndex = 0;
     
    143146  while (what!=NULL)
    144147  {
    145     (void)fprintf( stderr, "%d bytes at %p in: %s:%d\n",
     148    fprintf( stderr, "%d bytes at %p in: %s:%d",
    146149      (int)what->size, what, what->fname, what->lineno);
     150#ifdef MTRACK
     151    mmPrintStack(what->bt_stack);
     152#else
     153    fprintf( stderr, "\n");
     154#endif
    147155    what=what->next;
    148156  }
  • Singular/mmprivate.h

    r7df2ef r105efec  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: mmprivate.h,v 1.6 1999-03-19 14:18:03 obachman Exp $ */
     6/* $Id: mmprivate.h,v 1.7 1999-03-19 16:00:07 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    1010#include "structs.h"
    1111#include "mmheap.h"
     12
     13#define MAX_BLOCK_SIZE  (((SIZE_OF_HEAP_PAGE) / 16)*4)
    1214
    1315#define INDEX_ENTRY_T   char
     
    3234  struct DBMCB * next;
    3335  struct DBMCB * prev;
    34   #ifdef MTRACK
    35   unsigned long bt_stack[BT_STACKMAX];
    36   #endif
    3736  char * fname;
     37  unsigned long bt_stack[BT_MAXSTACK];
    3838  size_t size;
    3939  int lineno;
  • Singular/mod2.h.in

    r7df2ef r105efec  
    273273extern int pShortOut;
    274274
     275/* the maximal level of stacks to remembre in debug (MTRACK) mode */
     276#define BT_MAXSTACK 10
     277
    275278#ifdef DO_PROFILE
    276279/* define to enable explicit profiling of some crucial inline
     
    330333#endif
    331334
    332 
    333335/* define MTRACK for allowing to keep track of Alloc/Free with a backtrace */
    334336/* #define MTRACK */
     337
    335338
    336339/* define PDEBUG checking polys, undefine otherwise */
Note: See TracChangeset for help on using the changeset viewer.