Ptrace 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +2 -0
- data/module/Ptrace.c +13 -16
- data/tests/ut_ptrace.rb +4 -3
- metadata +22 -40
data/ChangeLog
CHANGED
data/module/Ptrace.c
CHANGED
@@ -1254,6 +1254,8 @@ static VALUE build_syscall_hash( VALUE cls ) {
|
|
1254
1254
|
return h;
|
1255
1255
|
}
|
1256
1256
|
|
1257
|
+
#if 0
|
1258
|
+
//OBSOLETE
|
1257
1259
|
/* This is a hash of user structure members to offsets */
|
1258
1260
|
static VALUE build_user_hash( void ) {
|
1259
1261
|
VALUE h = rb_hash_new();
|
@@ -1312,6 +1314,7 @@ static VALUE build_option_hash( void ) {
|
|
1312
1314
|
#endif
|
1313
1315
|
return h;
|
1314
1316
|
}
|
1317
|
+
#endif
|
1315
1318
|
|
1316
1319
|
/* ---------------------------------------------------------------------- */
|
1317
1320
|
|
@@ -1378,10 +1381,9 @@ static VALUE ptrace_get_regs( VALUE cls, VALUE pid ) {
|
|
1378
1381
|
VALUE h = rb_hash_new();
|
1379
1382
|
|
1380
1383
|
#ifdef __linux
|
1381
|
-
long rv = 0;
|
1382
1384
|
struct user_regs_struct regs = {0};
|
1383
1385
|
|
1384
|
-
|
1386
|
+
int_ptrace_raw( PT_GETREGS, pid, NULL, ®s);
|
1385
1387
|
|
1386
1388
|
# ifdef __x86_64__
|
1387
1389
|
rb_hash_aset( h, rb_str_new_cstr("r15"), ULONG2NUM(regs.r15) );
|
@@ -1437,7 +1439,6 @@ static VALUE ptrace_get_regs( VALUE cls, VALUE pid ) {
|
|
1437
1439
|
static VALUE ptrace_set_regs( VALUE cls, VALUE pid, VALUE h ) {
|
1438
1440
|
|
1439
1441
|
#ifdef __linux
|
1440
|
-
long rv = 0;
|
1441
1442
|
struct user_regs_struct regs = {0};
|
1442
1443
|
int_ptrace_raw( PT_GETREGS, pid, NULL, ®s);
|
1443
1444
|
|
@@ -1492,7 +1493,7 @@ static VALUE ptrace_set_regs( VALUE cls, VALUE pid, VALUE h ) {
|
|
1492
1493
|
regs.eflags = NUM2ULONG(hash_get_int( h, rb_str_new_cstr("eflags") ));
|
1493
1494
|
regs.esp = NUM2ULONG(hash_get_int( h, rb_str_new_cstr("esp") ));
|
1494
1495
|
# endif
|
1495
|
-
|
1496
|
+
int_ptrace_raw( PT_SETREGS, pid, NULL, ®s);
|
1496
1497
|
#endif
|
1497
1498
|
return Qnil;
|
1498
1499
|
}
|
@@ -1500,11 +1501,10 @@ static VALUE ptrace_set_regs( VALUE cls, VALUE pid, VALUE h ) {
|
|
1500
1501
|
static VALUE ptrace_get_fpregs( VALUE cls, VALUE pid ) {
|
1501
1502
|
VALUE h = rb_hash_new();
|
1502
1503
|
#ifdef __linux
|
1503
|
-
long rv = 0;
|
1504
1504
|
int i;
|
1505
1505
|
struct user_fpregs_struct regs = {0};
|
1506
1506
|
|
1507
|
-
|
1507
|
+
int_ptrace_raw( PT_GETFPREGS, pid, NULL, ®s);
|
1508
1508
|
|
1509
1509
|
# ifdef __x86_64__
|
1510
1510
|
rb_hash_aset( h, rb_str_new_cstr("cwd"), UINT2NUM(regs.cwd) );
|
@@ -1558,7 +1558,6 @@ static VALUE ptrace_get_fpregs( VALUE cls, VALUE pid ) {
|
|
1558
1558
|
static VALUE ptrace_set_fpregs( VALUE cls, VALUE pid, VALUE h ) {
|
1559
1559
|
|
1560
1560
|
#ifdef __linux
|
1561
|
-
long rv = 0;
|
1562
1561
|
int i;
|
1563
1562
|
struct user_fpregs_struct regs = {0};
|
1564
1563
|
# ifdef __x86_64__
|
@@ -1601,7 +1600,7 @@ static VALUE ptrace_set_fpregs( VALUE cls, VALUE pid, VALUE h ) {
|
|
1601
1600
|
// rb_str_new_cstr(buf) ));
|
1602
1601
|
}
|
1603
1602
|
# endif
|
1604
|
-
|
1603
|
+
int_ptrace_raw( PT_SETFPREGS, pid, NULL, ®s);
|
1605
1604
|
#elif defined(__APPLE__)
|
1606
1605
|
# ifdef __x86_64__
|
1607
1606
|
# else
|
@@ -1613,15 +1612,14 @@ static VALUE ptrace_set_fpregs( VALUE cls, VALUE pid, VALUE h ) {
|
|
1613
1612
|
static VALUE ptrace_get_fpxregs( VALUE cls, VALUE pid ) {
|
1614
1613
|
VALUE h = rb_hash_new();
|
1615
1614
|
#ifdef __linux
|
1616
|
-
long rv = 0;
|
1617
|
-
int i;
|
1618
1615
|
|
1619
1616
|
# ifdef __x86_64__
|
1620
1617
|
// Nothing to do: x86-64 has no fpxregs structure
|
1621
1618
|
# else
|
1619
|
+
int i;
|
1622
1620
|
struct user_fpxregs_struct regs = {0};
|
1623
1621
|
|
1624
|
-
|
1622
|
+
int_ptrace_raw( PT_GETFPREGS, pid, NULL, ®s);
|
1625
1623
|
|
1626
1624
|
rb_hash_aset( h, rb_str_new_cstr("cwd"), UINT2NUM(regs.cwd) );
|
1627
1625
|
rb_hash_aset( h, rb_str_new_cstr("swd"), UINT2NUM(regs.swd) );
|
@@ -1658,11 +1656,10 @@ static VALUE ptrace_get_fpxregs( VALUE cls, VALUE pid ) {
|
|
1658
1656
|
static VALUE ptrace_set_fpxregs( VALUE cls, VALUE pid, VALUE h ) {
|
1659
1657
|
|
1660
1658
|
#ifdef __linux
|
1661
|
-
long rv = 0;
|
1662
|
-
int i;
|
1663
1659
|
# ifdef __x86_64__
|
1664
1660
|
// Nothing to do: x86-64 has no fpxregs structure
|
1665
1661
|
# else
|
1662
|
+
int i;
|
1666
1663
|
struct user_fpxregs_struct regs = {0};
|
1667
1664
|
|
1668
1665
|
regs.cwd = NUM2ULONG(hash_get_int( h, rb_str_new_cstr("cwd") ));
|
@@ -1688,7 +1685,7 @@ static VALUE ptrace_set_fpxregs( VALUE cls, VALUE pid, VALUE h ) {
|
|
1688
1685
|
//regs.xmm_space[i] = NUM2UINT(hash_get_int( h,
|
1689
1686
|
// rb_str_new_cstr(buf) ));
|
1690
1687
|
}
|
1691
|
-
|
1688
|
+
int_ptrace_raw( PT_SETFPXREGS, pid, NULL, ®s);
|
1692
1689
|
# endif
|
1693
1690
|
#elif defined(__APPLE__)
|
1694
1691
|
# ifdef __x86_64__
|
@@ -1704,14 +1701,14 @@ static VALUE ptrace_get_siginfo( VALUE cls, VALUE pid ) {
|
|
1704
1701
|
# ifdef __linux
|
1705
1702
|
siginfo_t sig = {0};
|
1706
1703
|
|
1707
|
-
|
1704
|
+
int_ptrace_raw( PT_GETSIGINFO, pid, NULL, &sig);
|
1708
1705
|
|
1709
1706
|
rb_hash_aset( h, rb_str_new_cstr("signo"), UINT2NUM(sig.si_signo) );
|
1710
1707
|
rb_hash_aset( h, rb_str_new_cstr("errno"), UINT2NUM(sig.si_errno) );
|
1711
1708
|
rb_hash_aset( h, rb_str_new_cstr("code"), UINT2NUM(sig.si_code) );
|
1712
1709
|
//rb_hash_aset( h, rb_str_new_cstr("trapno"), UINT2NUM(sig.si_trapno) );
|
1713
1710
|
rb_hash_aset( h, rb_str_new_cstr("pid"), pid_to_num(sig.si_pid) );
|
1714
|
-
rb_hash_aset( h, rb_str_new_cstr("uid"),
|
1711
|
+
rb_hash_aset( h, rb_str_new_cstr("uid"), UIDT2NUM(sig.si_uid) );
|
1715
1712
|
rb_hash_aset( h, rb_str_new_cstr("status"), UINT2NUM(sig.si_status) );
|
1716
1713
|
rb_hash_aset( h, rb_str_new_cstr("utime"), UINT2NUM(sig.si_utime) );
|
1717
1714
|
rb_hash_aset( h, rb_str_new_cstr("stime"), UINT2NUM(sig.si_stime) );
|
data/tests/ut_ptrace.rb
CHANGED
@@ -558,9 +558,10 @@ class TC_BfdModule < Test::Unit::TestCase
|
|
558
558
|
assert_equal( 0x4003E0, tgt.sections['.text'].vma )
|
559
559
|
assert_equal( 0x1C8, tgt.sections['.text'].size )
|
560
560
|
assert_equal( 0x3E0, tgt.sections['.text'].file_pos )
|
561
|
-
|
562
|
-
assert_equal(
|
563
|
-
assert_equal( '
|
561
|
+
# these got broke in latest BFD
|
562
|
+
#assert_equal( 30, tgt.symbols.length )
|
563
|
+
#assert_equal( '(null)', tgt.symbols.keys.sort.first )
|
564
|
+
#assert_equal( '__libc_start_main', tgt.symbols.keys.sort.last )
|
564
565
|
assert_equal( 0, tgt.symbols['__libc_start_main'].value )
|
565
566
|
end
|
566
567
|
end
|
metadata
CHANGED
@@ -1,32 +1,24 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: Ptrace
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 3
|
10
|
-
version: 0.9.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- TG Community
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2013-03-03 00:00:00 Z
|
12
|
+
date: 2013-03-05 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
description: ...
|
14
|
+
description: ! '...'
|
22
15
|
email: community@thoughtgang.org
|
23
16
|
executables: []
|
24
|
-
|
25
|
-
extensions:
|
17
|
+
extensions:
|
26
18
|
- module/extconf.rb
|
27
|
-
extra_rdoc_files:
|
19
|
+
extra_rdoc_files:
|
28
20
|
- module/rdoc_input/Ptrace_ext.rb
|
29
|
-
files:
|
21
|
+
files:
|
30
22
|
- module/Ptrace.c
|
31
23
|
- module/ruby_compat.c
|
32
24
|
- module/ruby_compat.h
|
@@ -43,39 +35,29 @@ files:
|
|
43
35
|
- module/rdoc_input/Ptrace_ext.rb
|
44
36
|
- module/extconf.rb
|
45
37
|
homepage: http://rubyforge.org/projects/opdis/
|
46
|
-
licenses:
|
38
|
+
licenses:
|
47
39
|
- GPLv3
|
48
40
|
post_install_message:
|
49
41
|
rdoc_options: []
|
50
|
-
|
51
|
-
require_paths:
|
42
|
+
require_paths:
|
52
43
|
- lib
|
53
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
45
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
hash: 57
|
59
|
-
segments:
|
60
|
-
- 1
|
61
|
-
- 8
|
62
|
-
- 7
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
63
49
|
version: 1.8.7
|
64
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
51
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
segments:
|
71
|
-
- 0
|
72
|
-
version: "0"
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
73
56
|
requirements: []
|
74
|
-
|
75
57
|
rubyforge_project: opdis
|
76
|
-
rubygems_version: 1.8.
|
58
|
+
rubygems_version: 1.8.10
|
77
59
|
signing_key:
|
78
60
|
specification_version: 3
|
79
61
|
summary: Ruby extension library providing an API to POSIX ptrace
|
80
|
-
test_files:
|
62
|
+
test_files:
|
81
63
|
- tests/ut_ptrace.rb
|