Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Jun 2006 12:05:13 +0300
From:      Tofik Suleymanov <tofik@oxygen.az>
To:        David Nugent <davidn@datalinktech.com.au>
Cc:        Tofik Suleymanov <tofik@oxygen.az>, freebsd-stable@FreeBSD.ORG
Subject:   Re: reading process memory
Message-ID:  <4487E849.1020601@oxygen.az>
In-Reply-To: <448777B1.5030308@datalinktech.com.au>
References:  <4486A111.6020300@oxygen.az>	<ED5EC8BD-0A92-4D73-BC01-48FD930311FF@wisc.edu>	<4486EFC8.6080601@oxygen.az> <448777B1.5030308@datalinktech.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
David Nugent wrote:
> Tofik Suleymanov wrote:
>> Thank you for brief and altogether extensive explanation of the 
>> case.The thing i wanted to do is to read let's say portions of memory 
>> where .bss and .data block of a running program reside.
>>
>> is that possible ?
> Yes. Debuggers offer this functionality, for example.
>
> man 2 ptrace
>
man 2 ptrace says:

    PT_READ_I, PT_READ_D
                   These requests read a single int of data from the traced
                   process's address space.  Traditionally, ptrace() has
                   allowed for machines with distinct address spaces for
                   instruction and data, which is why there are two 
requests:
                   conceptually, PT_READ_I reads from the instruction space
                   and PT_READ_D reads from the data space.  In the current
                   FreeBSD implementation, these two requests are completely
                   identical.  The addr argument specifies the address 
(in the
                   traced process's virtual address space) at which the read
                   is to be done.  This address does not have to meet any
                   alignment constraints.  The value read is returned as the
                   return value from ptrace().


where do i get the addr argument ? how can i know which address do i 
need to start from ?

Sincerely,
Tofik Suleymanov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4487E849.1020601>