[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] common/util trace.c,1.19,1.20
From:       dcollins () helixcommunity ! org
Date:       2010-08-11 15:35:11
Message-ID: 201008112024.o7BKOIAk015847 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/common/util
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv6094/server/common/util

Modified Files:
	trace.c 
Log Message:
Synopsis
========
Eliminates some obsolete platform-specific code from trace.c/trace.h (no PR)

Branches: HEAD
Reviewer: Chytanya


Description
===========

The trace.c/trace.h file contains code for platforms we haven't supported
for ~10 years (AIX, Tru64, HP-UX, FreeBSD).  If some of it were needed
again in the future it can always be resurrected from CVS.


Files Affected
==============

server/common/util/trace.c
server/common/util/pub/trace.h


Testing Performed
=================

Unit Tests:
- N/A

Integration Tests:
- N/A

Leak Tests:
- N/A

Performance Tests:
- N/A

Platforms Tested: N/A
Build verified: linux-rhel5-x86_64 (debug and release)


QA Hints
========
* N/A


Index: trace.c
===================================================================
RCS file: /cvsroot/server/common/util/trace.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- trace.c	10 Aug 2010 21:41:47 -0000	1.19
+++ trace.c	11 Aug 2010 15:35:09 -0000	1.20
@@ -41,10 +41,17 @@
 #define FRAME_LIMIT 250
 #endif /* _LINUX */
 
-#if defined(i386) && defined(_UNIX)
+/***********************************************************************
+ * LINUX
+ */
+#if defined(_LINUX)
+#define __USE_GNU
+#include <dlfcn.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
+
 #include <ucontext.h>
 #if defined(__i386__)
 #if !defined(REG_EBP)
@@ -54,171 +61,7 @@
 #define REG_EIP 14
 #endif
 #endif
-#endif
-
-#if defined(__GNUC__) && defined (DEBUG) && \
-    (defined(_FREEBSD) || defined(_OPENBSD) || defined(_NETBSD)) && \
-    (defined(i386) || defined(__i386__))
 
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stab.h>
-
-#include "nm.h"
-
-struct alist	*linelist;
-int		len;
-
-
-char*
-find(caddr_t addr, int moo)
-{
-    int j, bFirst;
-    char pName[2048];
-    char pWhere[2048];
-    char pArgs[2048];
-    char pThisArg[2048];
-    static char z_pTemp[2048];
-    int i = len / 2;
-    int step = len / 2;
-
-    for (;;)
-    {
-#if defined(_FREEBSD) && (!defined(FREEBSD_ELF) && !defined(__ELF__))
-	if ((addr >= linelist[i].addr) && (addr <= linelist[i+1].addr))
-	{
-	    if (!linelist[i].filename)
-		return "";
-
-	    strcpy(pName, linelist[i].entry->n_name);
-	    *(strstr(pName, ":")) = 0;
-	    sprintf(pWhere, "%s:%d", linelist[i].filename, linelist[i].line);
-	    pArgs[0] = 0;
-
-	    bFirst = 1;
-	    for (j = 1;; j++)
-	    {
-		if ((linelist[i].entry + j)->n_type == N_PSYM)
-		{
-		    int foo = (linelist[i].entry + j)->n_value;
-		    if (!bFirst)
-			strcat(pArgs, ", ");
-		    strcpy(pThisArg, (linelist[i].entry + j)->n_name);
-		    *(strstr(pThisArg, ":")) = 0;
-		    //sprintf (z_pTemp, "%s=%p", pThisArg, (void *)*((int *)(foo + moo)));
-		    //strcat(pArgs, z_pTemp);
-		    bFirst = 0;
-		}
-		else
-		    break;
-	    }
-	    sprintf (z_pTemp, "%s(%s) at %s\n", pName, pArgs, pWhere);
-	    return z_pTemp;
-	}
-	else
-#endif
-	{
-            if (linelist == NULL)
-            {
-		sprintf (z_pTemp, "%p\n", addr);
-                return z_pTemp;
-            }
-	    step = (step + 1) / 2;
-	    if (addr > linelist[i].addr)
-		i = i + step;
-	    else
-		i = i - step;
-	    if (i >= len)
-	    {
-		sprintf (z_pTemp, "%p\n", addr);
-		return z_pTemp;
-	    }
-	    if (i < 0)
-	    {
-		sprintf (z_pTemp, "%p\n", addr);
-		return z_pTemp;
-	    }
-	}
-    }
-}
-
-
-char*
-get_trace()
-{
-    void** pCurrentFrame = 0;
-    static char trace[32768];
-
-    trace[0] = 0;
-
-    __asm __volatile("movl %%ebp, %0" : "=d" (pCurrentFrame));
-
-    while (*(void **)*pCurrentFrame)
-    {
-	strcat(trace, find((*(pCurrentFrame + 1)), (int)*pCurrentFrame));
-	pCurrentFrame = *pCurrentFrame;
-    }
-   
-    return trace;
-}
-
-void**
-get_stack(int* size)
-{
-    void** pCurrentFrame = 0;
-    static void* stack[32768];
-    int nframes = 0;
-    int frame = 0;
-
-    __asm __volatile("movl %%ebp, %0" : "=d" (pCurrentFrame));
-    while(*(void **)*pCurrentFrame)
-    {
-	stack[frame++] = (*(pCurrentFrame + 1));
-	pCurrentFrame = *pCurrentFrame;
-    }
-    *size = frame;
-    return stack;
-}
-
-char*
-get_trace_from_stack(void** stack, int size)
-{
-    int i;
-    static char trace[32768];
-
-    trace[0] = 0;
-
-    for(i = 0; i < size; i++)
-    {
-	strcat(trace, find(stack[i], 0));
-    }
-    return trace;
-}
-
-void
-setup_trace(char *prog)
-{
-#if (defined(FREEBSD_ELF) || defined(__ELF__))
-    linelist = NULL;
-    return;
-#else
-    FILE* f;
-
-    f = fopen(prog, "r");
-    setup_stab(prog, f, &linelist, &len);
-    fclose(f);
-#endif
-}
-
-#elif defined(_LINUX)
-#define __USE_GNU
-#include <dlfcn.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <ucontext.h>
 #ifdef __amd64__
 #define REGISTER_IP REG_RIP
 #define REGISTER_FRAMEPTR REG_RBP
@@ -227,8 +70,6 @@
 #define REGISTER_FRAMEPTR REG_EBP
 #endif
 
-extern void* pMakeProcess;
-
 void
 setup_trace(char* prog)
 {
@@ -375,10 +216,6 @@
 
     while (pCurrentFrame && pIP && nFrameCount < FRAME_LIMIT)
     {
-	//if (((*(pCurrentFrame + 1) > pMakeProcess - 64)) &&
-	//    ((*(pCurrentFrame + 1) < pMakeProcess + 64)))
-	//    break;
-
 	stack[nFrameCount++] = pIP;
         pCurrentFrame = *pCurrentFrame;
         pIP = pCurrentFrame ? pCurrentFrame[1] : NULL;
@@ -403,6 +240,9 @@
     return trace;
 }
 
+/***********************************************************************
+ * SOLARIS
+ */
 #elif defined _SOLARIS
 
 #include <dlfcn.h>
@@ -657,687 +497,9 @@
     return stack;
 }
 
-#elif defined _HPUX && !defined _IA64
-
-#include <stdio.h>
-#include <string.h>
-#include "unwind.h"
-
-extern void U_get_frame_info(cframe_info *);
-extern void U_STACK_TRACE(void);
-#ifndef __LP64__
-static void copy_prev_to_curr(cframe_info *curr_frame,pframe_info *prev_frame);
-#endif
-
-void
-get_ustack_trace()
-{
-    /* Prints to stderr. */
-    U_STACK_TRACE();
-}
-
-char*
-get_trace_from_stack(void** stack, int size)
-{
-    int i;
-    int at = 0;
-    static char trace[32768];
-
-    trace[0] = 0;
-
-    for(i = 0; i < size; i++)
-    {
-	at += sprintf(&(trace[at]), "0x%08x\n", stack[i]);
-    }
-    return trace;
-}
-
-char*
-get_trace()
-{
-    static char stack_trace[65536];
-    cframe_info curr_frame;
-    pframe_info prev_frame;
-    int depth, status;
-
-    *stack_trace = '\0';
-  
-#ifdef __LP64__
-    /* this is ok for 11.x and 32 bit */
-    U_init_frame_record(&curr_frame);
-    U_prep_frame_rec_for_unwind(&curr_frame);
-#else
-    /* set up a valid curr_frame by calling an assembly routine.
-     * This assembly routine is not exported by HP, but can
-     * be extracted from /usr/lib/libcl.a ... it is called
-     * ugetfram.o. The U_get_frame_info routine MUST be put into 
-     * the same image as this routine. It can then set up a dummy
-     * curr_frame that has the correct values set.
-     */
-    U_get_frame_info(&curr_frame);
-#endif
-
-
-    /* throw away the first frame ... since its a dummy frame
-     * created by the call to U_get_frame_info.
-     */
-
-    status = U_get_previous_frame_x(&curr_frame, &prev_frame, sizeof(cframe_info));
-
-    /* Check to make sure everything is okay */
-
-    if (status)
-    {
-      fprintf(stderr, "Stack_Trace: error while unwinding stack %d\n", status);
-      return 0;
-    }
-
-    /* copy the prev_frame to the curr_frame */
-
-#ifdef __LP64__
-    U_copy_frame_info(&curr_frame, &prev_frame);
-#else
-    copy_prev_to_curr(&curr_frame, &prev_frame);
-#endif
-
-    /* Now for the real work. Initialize the trace string, and then
-     * loop, unwinding a frame at a time until there are no more frames
-     * to unwind (i.e. the offset portion of the return address is 0).
-     */
-
-    *stack_trace=0;
-    for (depth = 0; curr_frame.currlo && depth < FRAME_LIMIT; depth++)
-    {
-        status = U_get_previous_frame_x(&curr_frame, &prev_frame, sizeof(cframe_info));
-
-        /* Check to make sure everything is okay */
-
-        if (status)
-	{
-	    fprintf(stderr,"Stack_Trace: error while unwinding stack depth=%d\n", depth);
-	    fflush(stderr);
-	    return 0;
-	}
-
-        /* Now, we'd like to print out the return pointer. However,
-         * U_get_previous_frame returns the prev_frame for the 1st NON-STUB
-         * frame in the call chain. It may be the case that the return
-         * pointer for this frame points into another stub. What we'd 
-         * really like to see is the return point for all NON-STUBS.
-         * U_get_previous_frame updates curr_frame so that it contains
-         * a frame whose return point is a NON-STUB. Print out this value
-         * before copying over prev_frame into curr_frame.
-         */
-
-        sprintf(stack_trace + strlen(stack_trace),
-	        "0x%l08x\n", curr_frame.currlo & ~3L);
-
-#ifdef __LP64__
-        U_copy_frame_info(&curr_frame, &prev_frame);
-#else
-        copy_prev_to_curr(&curr_frame, &prev_frame);
-#endif
-    }
-
-    return stack_trace;
-}
-
-void**
-get_stack(int* size)
-{
-    static char stack_trace[65536];
-    cframe_info curr_frame;
-    pframe_info prev_frame;
-    int depth, status;
-    void* stack[32768];
-    int frame = 0;
-
-    *stack_trace = '\0';
-  
-#ifdef __LP64__
-    /* this is ok for 11.x and 32 bit */
-    U_init_frame_record(&curr_frame);
-    U_prep_frame_rec_for_unwind(&curr_frame);
-#else
-    /* set up a valid curr_frame by calling an assembly routine.
-     * This assembly routine is not exported by HP, but can
-     * be extracted from /usr/lib/libcl.a ... it is called
-     * ugetfram.o. The U_get_frame_info routine MUST be put into 
-     * the same image as this routine. It can then set up a dummy
-     * curr_frame that has the correct values set.
-     */
-    U_get_frame_info(&curr_frame);
-#endif
-
-
-    /* throw away the first frame ... since its a dummy frame
-     * created by the call to U_get_frame_info.
-     */
-
-    status = U_get_previous_frame_x(&curr_frame, &prev_frame, sizeof(cframe_info));
-
-    /* Check to make sure everything is okay */
-
-    if (status)
-    {
-      fprintf(stderr, "get_stack: error while unwinding stack %d\n", status);
-      return 0;
-    }
-
-    /* copy the prev_frame to the curr_frame */
-
-#ifdef __LP64__
-    U_copy_frame_info(&curr_frame, &prev_frame);
-#else
-    copy_prev_to_curr(&curr_frame, &prev_frame);
-#endif
-
-    /* Now for the real work. Initialize the trace string, and then
-     * loop, unwinding a frame at a time until there are no more frames
-     * to unwind (i.e. the offset portion of the return address is 0).
-     */
-
-    *stack_trace=0;
-    for (depth = 0; curr_frame.currlo && depth < FRAME_LIMIT; depth++)
-    {
-        status = U_get_previous_frame_x(&curr_frame, &prev_frame, sizeof(cframe_info));
-
-        /* Check to make sure everything is okay */
-
-        if (status)
-	{
-	    fprintf(stderr,"get_stack: error while unwinding stack depth=%d\n", depth);
-	    fflush(stderr);
-	    return 0;
-	}
-
-        /* Now, we'd like to print out the return pointer. However,
-         * U_get_previous_frame returns the prev_frame for the 1st NON-STUB
-         * frame in the call chain. It may be the case that the return
-         * pointer for this frame points into another stub. What we'd 
-         * really like to see is the return point for all NON-STUBS.
-         * U_get_previous_frame updates curr_frame so that it contains
-         * a frame whose return point is a NON-STUB. Print out this value
-         * before copying over prev_frame into curr_frame.
-         */
-
-        stack[frame++] = curr_frame.currlo & ~3L;
-
-#ifdef __LP64__
-        U_copy_frame_info(&curr_frame, &prev_frame);
-#else
-        copy_prev_to_curr(&curr_frame, &prev_frame);
-#endif
-    }
-
-    *size = frame;
-    return stack;
-}
-
-#ifndef __LP64__
-static void
-copy_prev_to_curr(cframe_info *curr_frame, pframe_info *prev_frame)
-{
-    /* Update curr_frame with values returned in prev_frame */
-    curr_frame->cur_frsize = prev_frame->prev_frsize;
-    curr_frame->cursp = prev_frame->prevsp;
-    curr_frame->currls = prev_frame->prevrls;
-    curr_frame->currlo = prev_frame->prevrlo;
-    curr_frame->curdp = prev_frame->prevdp;
-    curr_frame->r3 = prev_frame->PFIinitR3;
-    curr_frame->r4 = prev_frame->PFIinitR4;
-
-    /* don't update curr_frame.cur_r19 because U_get_previous_frame does
-     * it directly.
-     */
-}
-#endif
-
-#elif defined (_OSF1)
-/* 
- * EDIT HISTORY:
- *
- * 
- * V1.01	whb		19-Mar-2001
- *    Hacked out the symbolic stack trace info and add in the __init_*
- * initialization routine to define the address of main() at library
- * image init time... Code's getting uglier, clean up needed big time!
- * Also note that static global context means this is will not work
- * with threads.
- *
- * V1.00	whb		16-Mar-2001
- *    Created hack for Atin to experiment with... No real review or testing!
- * It simply is a jacket routine on is_function_on_stack() and searches for
- * main()...
- *
- * 
- */
-
-/*
- * This module contains is_function_on_stack and its support routines.
- * It's an example routine which takes an unsigned long which is presumed to 
- * be the address of an interesting function, and checks whether the 
- * function is on the current call stack.  
- *
- * Returns a "boolean" [long], 1 if the routine is on the stack, 0
- * otherwise.
- *
- * Compile with 
- *    cc [-g] is_routine_on_stack -lexc
- * for the UNIT_TEST version. Otherwise, remember to use -lexc on the
- * link of the program into which it is being included.
- *
- */
-#include <excpt.h>
-
-extern __start;
-extern main;
-
-unsigned long get_trace_base_addr;
-
-static unsigned long sp;
-static unsigned long pc;
-static unsigned long prev_func;
-static pdsc_rpd    * func_rpd;
-
-extern long __exc_crd_list_head;
-
-/*
- * Use an init routine to initialize the address of the main() routine.
- *
- */
-
-void
-__init_get_trace(void)
-{
-    // get_trace_base_addr = (unsigned long) &__start;
-    get_trace_base_addr = (unsigned long) &main;
-
-    // printf("get_trace_base_addr = 0x%lp\n", get_trace_base_addr);
-
-}
-
-static pdsc_rpd * 
-get_primary_rpd (exc_address pc) 
-{
-    /*
-     * As of Tru64 UNIX V5.1 there may be many "linked" RPDs, describing
-     * a single procedure.  To detect whether two PCs fall in the same 
-     * procedure, we must find the primary (distinguished) RPD for the
-     * procedure.  This one will have a RETURN_ADDRESS field of zero.
-     * Prior to V5.1, this linking was not used, and *ALL* RPDs had a
-     * zero RETURN_ADDRESS field.
-     */
-    pdsc_rpd		* rpd;
-    PRUNTIME_FUNCTION	crd;
-    int			return_address;
-    union pdsc_crd	* crd_base;
-
-    return_address = 1;
-    while (return_address) {
-	crd = exc_remote_lookup_function_entry(
-			       NULL, NULL, pc,
-			       (exc_address)&__exc_crd_list_head,
-			       &crd_base, NULL);
-	rpd = PDSC_CRD_PRPD(crd);
-	crd = 0;
-	if (!rpd)
-	    /*
-	     * The routine is a null frame procedure, which doesn't
-	     * have an RPD.  Our caller will have to know how to handle
-	     * it. Note that a null frame procedure can't call anyone,
-	     * therefore we can't get here.
-	     */
-	    return rpd;
-
-#ifdef PDSC_RPD_RETURN_ADDRESS_FIELD
-	return_address = PDSC_RPD_RETURN_ADDRESS_FIELD(rpd);
-	if (return_address)
-	    pc = PDSC_RPD_RETURN_ADDRESS(crd_base, rpd);
-#else
-	return_address = 0;
-#endif
-    }
-
-    return(rpd);
-}
-
-
-/*
- * Determining end of the stack walk:
- * We have reached the end of the stack walk if either of two events happen,
- *  - the returned pc is 0, or
- *  - the stack pointer doesn't change and the pc doesn't change.
- */
-static long 
-done(PCONTEXT ctx) 
-{
-    if (ctx->sc_pc==0 || (ctx->sc_pc==pc && ctx->sc_regs[R_SP]==sp))
-	return 1;
-    pc = ctx->sc_pc;
-    sp = ctx->sc_regs[R_SP];
-    return 0;
-}
-
-/*
- * This is the main entry point for this file. Everything else is support!
- */
-char * 
-get_trace()
-{
-    static void* stack[32768];
-    static char stack_trace[65536];
-    struct sigcontext ctx;
-    int nFrameCount = 0;
-
-    *stack_trace = '\0';
-
-    /*
-     * Capture the current context (i.e., this routine's)
-     */
-    exc_capture_context(&ctx);
-
-    /*
-     * We can't really be done yet.  But we use the done function to 
-     * initialize static variables.  Since we're calling it, abort if
-     * it returns true.
-     */
-    if (done(&ctx))
-    {
-	sprintf(stack_trace + strlen(stack_trace),
-	    "couldn't get entire call stack!\n");
-	return stack_trace;
-    }
-  
-    /*
-     * Unwind once to get rid of the caller of this routine (get_trace).
-     */
-    exc_virtual_unwind(0, &ctx);
-
-    sprintf(stack_trace + strlen(stack_trace), "0x%lp\n", 
-	ctx.sc_pc);
-
-    if (done(&ctx))
-	return stack_trace;
-
-    /*
-     * Setup: Find the runtime procedure descriptor (RPD) for the
-     * desired procedure.
-     */
-    if (prev_func != get_trace_base_addr || func_rpd == 0) {
-	func_rpd = get_primary_rpd(get_trace_base_addr);
-
-	/*
-	 * Sanity: Make sure we got one! (Major foul-up somewhere!)
-	 */
-	if (func_rpd == 0)
-	{
-	    sprintf(stack_trace + strlen(stack_trace),
-		"couldn't get stack frame!\n");
-	    return stack_trace;
-	}
-
-	prev_func = get_trace_base_addr;
-    }
-  
-
-    /*
-     * Now walk the rest of the stack, and for each returned PC check
-     * whether it is in the same routine as the desired PC.
-     */
-    
-    while (nFrameCount < FRAME_LIMIT) {
-	if (func_rpd == get_primary_rpd(pc))
-	    break;
-
-	exc_virtual_unwind(0, &ctx);
-
-        nFrameCount++;
-	sprintf(stack_trace + strlen(stack_trace), "0x%lp\n", 
-	    ctx.sc_pc);
-
-	if (done(&ctx))
-	    break;
-    }
-
-    return stack_trace;
-}
-
-
-void**
-get_stack(int* size) 
-{
-    static void* stack[32768];
-    struct sigcontext ctx;
-    int frame = 0;
-
-    /*
-     * Capture the current context (i.e., this routine's)
-     */
-    exc_capture_context(&ctx);
-
-    /*
-     * We can't really be done yet.  But we use the done function to 
-     * initialize static variables.  Since we're calling it, abort if
-     * it returns true.
-     */
-    if (done(&ctx))
-    {
-	stack[frame++] = 0;
-	return stack;
-    }
-  
-    /*
-     * Unwind once to get rid of the caller of this routine (get_trace).
-     */
-    exc_virtual_unwind(0, &ctx);
-
-    stack[frame++] = ctx.sc_pc;
-
-    if (done(&ctx))
-    {
-	stack[frame++] = 0;
-	return stack;
-    }
-
-    /*
-     * Setup: Find the runtime procedure descriptor (RPD) for the
-     * desired procedure.
-     */
-    if (prev_func != get_trace_base_addr || func_rpd == 0) {
-	func_rpd = get_primary_rpd(get_trace_base_addr);
-
-	/*
-	 * Sanity: Make sure we got one! (Major foul-up somewhere!)
-	 */
-	if (func_rpd == 0)
-	{
-	    stack[frame++] = 0;
-	    return stack;
-	}
-
-	prev_func = get_trace_base_addr;
-    }
-  
-
-    /*
-     * Now walk the rest of the stack, and for each returned PC check
-     * whether it is in the same routine as the desired PC.
-     */
-    while (1) {    /* We'll return from within the loop. */
-	if (func_rpd == get_primary_rpd(pc))
-	    break;
-
-	exc_virtual_unwind (0, &ctx);
-
-	stack[frame++] = (void *)ctx.sc_pc;
-	if (done(&ctx))
-	{
-	    break;
-	}
-    }
-    *size = frame;
-    return stack;
-}
-
-char*
-get_trace_from_stack(void** stack, int size)
-{
-    int i;
-    int at = 0;
-    static char trace_from_stack[32768];
-
-    trace_from_stack[0] = 0;
-
-    for(i = 0; i < size; i++)
-    {
-	at += sprintf(&(trace_from_stack[at]), "0x%lx\n", stack[i]);
-    }
-    return trace_from_stack;
-}
-
-
-#elif defined _AIX
-
-/*
- * AIX stack frames look like this:
- *
- *  offset
- *      .--------------------------.
- *    0 | ptr to prev. stack frame |
- *      +--------------------------+
- *    4 | ...                      |
- *      +--------------------------+
- *    8 | saved program counter[1] |
- *      +--------------------------+
- *   12 | ...                      |
- *      +--------------------------+
- *   16 | ...                      |
- *      +--------------------------+
- *   20 | ...                      |
- *      +--------------------------+
- *   24 | Arguments 1-8            |
- *      | (space for 8 32-bit args |
- *      | is always reserved)      |
- *      +--------------------------+
- *   56 |local variables           |
- *      +--------------------------+
- *      ...etc...
- *      +--------------------------+
- *   xx | register save area[2]    |
- *      `--------------------------'
- *
- *  
- *  [1]: set by prolog of callee routine, unless it doesn't call any
- *       other routines.
- *  [2]: This area is where the callee saves any registers it
- *       will be modifying so it can restore them when returning,
- * 
- *  General Purpose Register 1 contains the stack pointer.
+/***********************************************************************
+ * WINDOWS
  */
-#include <stdio.h>
-#include <ucontext.h>
-
-extern char* HXGetStackFrame(); //implemented in servutil/unix/aix/stackframe.s
-
-typedef struct stack_frame
-{
-    struct stack_frame *prev;
-    int                 unused;
-    int                 pc;
-} stackFrame;
-
-char*
-get_trace_from_context(ucontext_t* u)
-{
-    static char stack_trace[65536];
-    char* pCur;
-    int nFrame;
-    ucontext_t* pContext;
-    int* pFunc;
-    stackFrame* pStackFrame;
-
-    pCur = stack_trace;
-    pContext = u;
-    stack_trace[0] = '\0';
-    nFrame = 0;
-
-    if (pContext)
-    {
-        pStackFrame = (stackFrame*)pContext->uc_mcontext.jmp_context.gpr[1];
-
-        for (nFrame=0; pStackFrame && nFrame < FRAME_LIMIT; ++nFrame)
-        {
-            pFunc = (int*)(pStackFrame->pc);
-            pCur += sprintf(pCur, "0x%08lx\n", pFunc);
-            pStackFrame = pStackFrame->prev;
-        }
-    }
-
-    return stack_trace;
-}
-
-char*
-get_trace()
-{
-    ucontext_t u;
-    getcontext(&u);
-    return get_trace_from_context(&u);
-}
-
-void**
-get_stack(int* size)
-{
-    static int* stack[32768];
-    int nFrame=0;
-    stackFrame* pStackFrame;
-
-    pStackFrame = (stackFrame*)HXGetStackFrame();
-
-    for (nFrame=0; pStackFrame && nFrame < FRAME_LIMIT; ++nFrame)
-    {
-        stack[nFrame] = (int*)(pStackFrame->pc);
-        pStackFrame = pStackFrame->prev;
-    }
-
-    stack[nFrame] = 0;
-    *size = nFrame;
-
-    return (void**)&stack;
-}
-
-char*
-get_trace_from_stack(void** stack, int size)
-{
-    int i;
-    int at = 0;
-    static char trace_from_stack[32768];
-
-    trace_from_stack[0] = 0;
-
-    for(i = 0; i < size; i++)
-    {
-	at += sprintf(&(trace_from_stack[at]), "0x%08lx\n", stack[i]);
-    }
-    return trace_from_stack;
-}
-
-char*
-find(unsigned long addr)
-{
-    static char pName[2048];
-    int i = 0;
-
-    sprintf(pName, "0x%08lx\n", (int*)addr);
-    return pName;
-}
-
-void
-setup_trace(char *prog)
-{
-}
-
-
 #elif defined _WIN32
 
 #include <windows.h>
@@ -1479,6 +641,9 @@
 {
 }
 
+/***********************************************************************
+ * UNKNOWN - STUBS
+ */
 #else
 
 char*


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic