From: amir@cs.columbia.edu (Amiran Eliashvili)
Subject: Memory leaks
Organization: Columbia University Department of Computer Science
Date: Wed, 22 Jul 1992 03:09:06 GMT



Hi all,



I am having problems running ptrace(2) succesfully. I am trying to get
the first 100 dynamic memory location of a running process.


What I am trying to do is to fork a process and get its pid and then
exec the executable I am trying to trace. Everything seems to work
except ptrace(). This is my first time using this system call so I am
not quite sure if I am using it correctly. Here is a sample program
that shows my attepmts at using ptrace(2). I'll appreciate greatly any
pointers of how to gp about using ptrace correctly.


						Many Thanks In advance
						   --Amiran

---- Sample program -----



/*
 *
 * Design
 * _______
 *
 * The parent forks a child and gets its pid.
 * Then, we set the child to have it traced by the parent
 * at each time we inrement the data segment by four
 * and get all the registers (please reffer to 
 * machine/reg.h to get the name of the registers
 * I am printing Thanks.
 *
 *
 */


#include <stdio.h>
#include <machine/reg.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>

main(argc, argv)
     int argc;
     char *argv[];
{

  enum ptracereq request;

  struct  regs addr;
  int data;
  char *addr2;
  int i=1;
  int pid;
  
  int tmp;


  if (( pid = fork()) == 0){
    ptrace( PTRACE_TRACEME, 0, 0, 0);
    execl(argv[1],argv[1],0);
    exit(1);
  }
  for(i = 0; i < 100; i++){
    wait((int *)0);
    tmp += sizeof(int); 
/*    if(ptrace(PTRACE_POKEDATA,pid,tmp,i) == -1)
      exit(-1);  */



/*    if(ptrace(PTRACE_ATTACH,pid,0,0) == -1)
      exit(-1);   */                             
    if(ptrace(PTRACE_GETREGS,pid,&addr,i) == -1)
      exit(-1);

    printf("addr.r_pc = %d\n",addr.r_pc);
    printf("addr.r_npc = %u\n",addr.r_npc);
    printf("addr.r_psr = %u\n",addr.r_psr);
    printf("addr.r_y = %u\n",addr.r_y);
    printf("addr.r_g1 = %u\n",addr.r_g1); 
    printf("addr.r_g1 = %u\n\n",addr.r_g1); 

  }
  /* traced process should resume execution */
  ptrace(PTRACE_CONT, pid, 1, 0);
 
}  /* end */
  

Newsgroups: comp.unix.questions, comp.unix.w
Subject: ptrace(2) problems
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 

Hi all,



I am having problems running ptrace(2) succesfully. I am trying to get
the first 100 dynamic memory location of a running process.


What I am trying to do is to fork a process and get its pid and then
exec the executable I am trying to trace. Everything seems to work
except ptrace(). This is my first time using this system call so I am
not quite sure if I am using it correctly. Here is a sample program
that shows my attepmts at using ptrace(2). I'll appreciate greatly any
pointers of how to gp about using ptrace correctly.


						Many Thanks In advance
						   --Amiran

---- Sample program -----



/*
 *
 * Design
 * _______
 *
 * The parent forks a child and gets its pid.
 * Then, we set the child to have it traced by the parent
 * at each time we inrement the data segment by four
 * and get all the registers (please reffer to 
 * machine/reg.h to get the name of the registers
 * I am printing Thanks.
 *
 *
 */


#include <stdio.h>
#include <machine/reg.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>

main(argc, argv)
     int argc;
     char *argv[];
{

  enum ptracereq request;

  struct  regs addr;
  int data;
  char *addr2;
  int i=1;
  int pid;
  
  int tmp;


  if (( pid = fork()) == 0){
    ptrace( PTRACE_TRACEME, 0, 0, 0);
    execl(argv[1],argv[1],0);
    exit(1);
  }
  for(i = 0; i < 100; i++){
    wait((int *)0);
    tmp += sizeof(int); 
/*    if(ptrace(PTRACE_POKEDATA,pid,tmp,i) == -1)
      exit(-1);  */



/*    if(ptrace(PTRACE_ATTACH,pid,0,0) == -1)
      exit(-1);   */                             
    if(ptrace(PTRACE_GETREGS,pid,&addr,i) == -1)
      exit(-1);

    printf("addr.r_pc = %d\n",addr.r_pc);
    printf("addr.r_npc = %u\n",addr.r_npc);
    printf("addr.r_psr = %u\n",addr.r_psr);
    printf("addr.r_y = %u\n",addr.r_y);
    printf("addr.r_g1 = %u\n",addr.r_g1); 
    printf("addr.r_g1 = %u\n\n",addr.r_g1); 

  }
  /* traced process should resume execution */
  ptrace(PTRACE_CONT, pid, 1, 0);
 
}  /* end */
  

Newsgroups: comp.unix.questions,comp.unix.admin,comp.unix.wizards,comp.unix.ultrix
Subject: ptrace(2) problems
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 



Hi all,



I am having problems running ptrace(2) succesfully. I am trying to get
the first 100 dynamic memory location of a running process.


What I am trying to do is to fork a process and get its pid and then
exec the executable I am trying to trace. Everything seems to work
except ptrace(). This is my first time using this system call so I am
not quite sure if I am using it correctly. Here is a sample program
that shows my attepmts at using ptrace(2). I'll appreciate greatly any
pointers of how to gp about using ptrace correctly.


						Many Thanks In advance
						   --Amiran

---- Sample program -----



/*
 *
 * Design
 * _______
 *
 * The parent forks a child and gets its pid.
 * Then, we set the child to have it traced by the parent
 * at each time we inrement the data segment by four
 * and get all the registers (please reffer to 
 * machine/reg.h to get the name of the registers
 * I am printing Thanks.
 *
 *
 */


#include <stdio.h>
#include <machine/reg.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>

main(argc, argv)
     int argc;
     char *argv[];
{

  enum ptracereq request;

  struct  regs addr;
  int data;
  char *addr2;
  int i=1;
  int pid;
  
  int tmp;


  if (( pid = fork()) == 0){
    ptrace( PTRACE_TRACEME, 0, 0, 0);
    execl(argv[1],argv[1],0);
    exit(1);
  }
  for(i = 0; i < 100; i++){
    wait((int *)0);
    tmp += sizeof(int); 
/*    if(ptrace(PTRACE_POKEDATA,pid,tmp,i) == -1)
      exit(-1);  */



/*    if(ptrace(PTRACE_ATTACH,pid,0,0) == -1)
      exit(-1);   */                             
    if(ptrace(PTRACE_GETREGS,pid,&addr,i) == -1)
      exit(-1);

    printf("addr.r_pc = %d\n",addr.r_pc);
    printf("addr.r_npc = %u\n",addr.r_npc);
    printf("addr.r_psr = %u\n",addr.r_psr);
    printf("addr.r_y = %u\n",addr.r_y);
    printf("addr.r_g1 = %u\n",addr.r_g1); 
    printf("addr.r_g1 = %u\n\n",addr.r_g1); 

  }
  /* traced process should resume execution */
  ptrace(PTRACE_CONT, pid, 1, 0);
 
}  /* end */
  

Newsgroups: comp.unix.wizards
Subject: ptrace(2) problems
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 



Hi all,



I am having problems running ptrace(2) succesfully. I am trying to get
the first 100 dynamic memory location of a running process.


What I am trying to do is to fork a process and get its pid and then
exec the executable I am trying to trace. Everything seems to work
except ptrace(). This is my first time using this system call so I am
not quite sure if I am using it correctly. Here is a sample program
that shows my attepmts at using ptrace(2). I'll appreciate greatly any
pointers of how to gp about using ptrace correctly.


						Many Thanks In advance
						   --Amiran
Please respond via e-mail

---- Sample program -----



/*
 *
 * Design
 * _______
 *
 * The parent forks a child and gets its pid.
 * Then, we set the child to have it traced by the parent
 * at each time we inrement the data segment by four
 * and get all the registers (please reffer to 
 * machine/reg.h to get the name of the registers
 * I am printing Thanks.
 *
 *
 */


#include <stdio.h>
#include <machine/reg.h>
#include <signal.h>
#include <sys/ptrace.h>
#include <sys/wait.h>

main(argc, argv)
     int argc;
     char *argv[];
{

  enum ptracereq request;

  struct  regs addr;
  int data;
  char *addr2;
  int i=1;
  int pid;
  
  int tmp;


  if (( pid = fork()) == 0){
    ptrace( PTRACE_TRACEME, 0, 0, 0);
    execl(argv[1],argv[1],0);
    exit(1);
  }
  for(i = 0; i < 100; i++){
    wait((int *)0);
    tmp += sizeof(int); 
/*    if(ptrace(PTRACE_POKEDATA,pid,tmp,i) == -1)
      exit(-1);  */



/*    if(ptrace(PTRACE_ATTACH,pid,0,0) == -1)
      exit(-1);   */                             
    if(ptrace(PTRACE_GETREGS,pid,&addr,i) == -1)
      exit(-1);

    printf("addr.r_pc = %d\n",addr.r_pc);
    printf("addr.r_npc = %u\n",addr.r_npc);
    printf("addr.r_psr = %u\n",addr.r_psr);
    printf("addr.r_y = %u\n",addr.r_y);
    printf("addr.r_g1 = %u\n",addr.r_g1); 
    printf("addr.r_g1 = %u\n\n",addr.r_g1); 

  }
  /* traced process should resume execution */
  ptrace(PTRACE_CONT, pid, 1, 0);
 
}  /* end */
  

Newsgroups: comp.protocols.tcp-ip
Subject: 10BASE-F
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 


I am looking for documentations or any litrature on the following
subject:

	FIBER OPTIC-BASED HIGH-SPEED LOCAL AREA NETWORK.

Are there any good books or articles on the subject?
Hwo does one go about finding more about the subject?


Please reply by e-mail  to amir@cs.columbia.edu. Thanks

/amiran

Newsgroups: comp.unix.programmer
Subject: Ramdisk
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 


Hi all:

	Does anyone out there has any experience, good or bad, reading
and writing to ramdisks. I am trying to speed up the reading from
files and I heard that ramdisk might be the way to go about this. I
would appreciate more details on this scheme -- why it might be
faster, what are the big disadvantage, ... . Also, is it true that one
can only use fopen(), fwrite(), and fread() with ramdisks?
 

All relevant comments are welcomed.

Pleases respond via e-mail to: amir@cs.columbia.edu

Thanks
/amiran
Newsgroups: sci.math.num-analysis
Subject: An efficient way of finding the the delta of two numbers
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 


Hi all:

	I am trying to come up with an efficient way (fewest number of
iteration ) to find in a list of numbers (not sorted) two numbers
whose delta (x - y) is the least. So far I could see O(n^2) and
possibly n*log(n). Are there any kind souls out there that know of a
better methods that will improve on the above number of iterations?

	I am not quite sure that this is the most appropriate place to
post this so I apologize head of time for those who resent the question.


Please reply to amir@cs.columbia.edu 
Thanks.
/amiran
Newsgroups: comp.unix.questions
Subject: Memory leaks
Summary: 
Expires: 
Followup-To: 
Distribution: 
Organization: Columbia University Department of Computer Science
Keywords: 



Hi all:


	I was wondering if there are any utilities in PD that will
check for memory leaks. Has anyone used such utilities before? If so,
how helpful were they?

Please reply to amir@cs.columbia.edu

Thanks
/amiran
Newsgroups: comp.unix.questions