Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to access the contents of a specific memory address?

by Khen1950fx (Canon)
on Jul 30, 2012 at 00:23 UTC ( #984325=note: print w/ replies, xml ) Need Help??


in reply to How to access the contents of a specific memory address?

When you try to access the contents of a specific memory address, the only thing that can happen is a segmentation fault. I experimented with this:

#!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use strict; use autodie; use warnings FATAL => 'syntax'; use Data::Dumper::Concise; use POSIX; use POSIX::RT::Signal qw/sigwaitinfo sigqueue/; use threads; use Scalar::Util qw/refaddr/; use Devel::Pointer::PP; POSIX::sigprocmask( POSIX::SIG_BLOCK, POSIX::SigSet->new(&POSIX::SIGRT +MIN) ); my $thr = threads->create( \&_thread ); sub _thread { my $sigset = POSIX::SigSet->new(&POSIX::SIGRTMIN); my $info = sigwaitinfo($sigset); } my $address = 5; refaddr( \$address ); my $new_address = \$address; $$new_address = $$new_address * 4; sigqueue( $$, &POSIX::SIGRTMIN, $address ); $thr->join(); print Dumper($address); my $smash = unsmash_sv( 0 + $address ); print Dumper($smash); exit(0);


Comment on Re: How to access the contents of a specific memory address?
Download Code
Re^2: How to access the contents of a specific memory address?
by bulk88 (Priest) on Jul 30, 2012 at 03:59 UTC
    my $address = 5; refaddr( \$address ); my $new_address = \$address; $$new_address = $$new_address * 4; sigqueue( $$, &POSIX::SIGRTMIN, $address ); $thr->join(); print Dumper($address); my $smash = unsmash_sv( 0 + $address );
    I can't understand what you are doing here. times 4? "(char *) 5" will of course crash, so will "(char *) 20". If you use Windows, learn what WONT seg fault, Virtual Memory Map Viewer (FOSS I think) and VMMAP more advanced.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984325]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-07-02 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls