Skip to content

Commit a3057fc

Browse files
committed
773* driver/signal.c: Put in the missing assembler code for i386.
1 parent cbb965f commit a3057fc

File tree

8 files changed

+90
-13
lines changed

8 files changed

+90
-13
lines changed

.release

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
date=Sun Aug 19 16:05:24 BST 2012
2-
release=dtrace-20120819
3-
build=419
1+
date=Mon Aug 20 22:03:17 BST 2012
2+
release=dtrace-20120820
3+
build=420

Changes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
Mon Aug 20 22:03:03 2012 fox
2+
3+
773* driver/signal.c: Put in the missing assembler code for i386.
4+
15
Sun Aug 19 16:05:01 2012 fox
26

7+
772* scripts/dt.pl: Rename to dt.
8+
9+
771* scripts/dt.pl: Add 'dt func <pid>'
10+
11+
770* archive: 1.0145
12+
313
769* libproc/common/Pcontrol.c: Some changes to Pxcreate to handle
414
parent/child sync with a forked child from 'dtrace -c cmd'.
515

Status.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ Working Features
3131
not yet ready in Linux/dtrace (eg cannot run standard scripts like
3232
iosnoop.d or other scripts out there).
3333
o vminfo provider - probes for the stats in /proc/vmstats
34-
o PID provider (dtrace -n pidNNN:::). Needs to be more thoroughly
35-
verified.
34+
o PID provider (dtrace -n pidNNN:::).
3635

3736
Partially Working / Not yet quality controlled:
3837

archive.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME=dtrace
22
MAJ_VERSION=1
3-
MIN_VERSION=0144
3+
MIN_VERSION=0145
44
EXCLUDE="*.ko *.o .git"
55
EXCLUDE_DIRS="build-"
6-
#date Sat Aug 11 10:05:53 BST 2012
6+
#date Sun Aug 19 17:57:46 BST 2012

driver/fbt_linux.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,10 @@ TODO();
399399
# endif
400400

401401
int init;
402+
403+
if (strcmp(modname, "dtracedrv") == 0)
404+
return;
405+
402406
/***********************************************/
403407
/* Possible memleak here...we allocate a */
404408
/* parallel struct, but need to free if we */
@@ -415,8 +419,6 @@ TODO();
415419

416420
if (dtrace_here)
417421
printk("%s(%d):modname=%s num_symtab=%u\n", dtrace_basename(__FILE__), __LINE__, modname, (unsigned) mp->num_symtab);
418-
if (strcmp(modname, "dtracedrv") == 0)
419-
return;
420422

421423
for (i = 1; i < mp->num_symtab; i++) {
422424
uint8_t *instr, *limit;
@@ -575,7 +577,7 @@ if (strcmp(modname, "dummy") == 0) dtrace_here = 1;
575577
modname, name,
576578
(uint8_t *) sym->st_value,
577579
instr, limit, i);
578-
}
580+
}
579581
}
580582

581583
static int
@@ -857,8 +859,9 @@ fbt_disable(void *arg, dtrace_id_t id, void *parg)
857859
/* fiddle with other things tho. */
858860
/***********************************************/
859861
if (*fbt->fbtp_patchpoint == fbt->fbtp_patchval) {
860-
if (1 || memory_set_rw(fbt->fbtp_patchpoint, 1, TRUE))
862+
if (1 || memory_set_rw(fbt->fbtp_patchpoint, 1, TRUE)) {
861863
*fbt->fbtp_patchpoint = fbt->fbtp_savedval;
864+
}
862865

863866
/***********************************************/
864867
/* "Logically" mark probe as gone. So we */

driver/signal.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ init_signal_dummy(void)
2222
{
2323
__asm(
2424
FUNCTION(dnr1_handler)
25+
#if defined(__amd64)
2526
"push %r15\n"
2627
"push %r14\n"
2728
"push %r13\n"
@@ -36,10 +37,20 @@ init_signal_dummy(void)
3637
"push %rbx\n"
3738
"push %rcx\n"
3839
"push %rdx\n"
40+
#else
41+
"push %eax\n"
42+
"push %ebx\n"
43+
"push %ecx\n"
44+
"push %edx\n"
45+
"push %esi\n"
46+
"push %edi\n"
47+
"push %ebp\n"
48+
#endif
3949

4050
// "call dtrace_safe_synchronous_signal\n"
4151
"call sig_send_wrapper\n"
4252

53+
#if defined(__amd64)
4354
"pop %rdx\n"
4455
"pop %rcx\n"
4556
"pop %rbx\n"
@@ -54,6 +65,15 @@ init_signal_dummy(void)
5465
"pop %r13\n"
5566
"pop %r14\n"
5667
"pop %r15\n"
68+
#else
69+
"pop %ebp\n"
70+
"pop %edi\n"
71+
"pop %esi\n"
72+
"pop %edx\n"
73+
"pop %ecx\n"
74+
"pop %ebx\n"
75+
"pop %eax\n"
76+
#endif
5777

5878
/***********************************************/
5979
/* Pretend we never got here. */
@@ -107,7 +127,7 @@ sig_send_callback(uint8_t *instr, int size)
107127
/* Compute new address (rip-relative for */
108128
/* amd64). */
109129
/***********************************************/
110-
ptbl[pidx].p_addr = instr + 1;
130+
ptbl[pidx].p_addr = (uintptr_t) instr + 1;
111131
ptbl[pidx].p_val = *(uint32_t *) &instr[1];
112132
pidx++;
113133
#if defined(__amd64)
@@ -116,6 +136,7 @@ sig_send_callback(uint8_t *instr, int size)
116136

117137
*(uint32_t *) &instr[1] = addr;
118138
#else
139+
addr = (uintptr_t) target;
119140
*(uint32_t *) &instr[1] = addr;
120141
#endif
121142
}

librtld/rtld_db.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ rd_loadobj_iter(rd_agent_t *rap, rl_iter_f *cb, void *client_data)
224224
ret = cb(&lobj, client_data);
225225
}
226226
fclose(fp);
227-
printf("%s\n", __func__);
228227
}
229228
rd_err_e
230229
rd_get_dyns(rd_agent_t *rap, psaddr_t addr, void **dynpp, size_t *dynpp_sz)

scripts/dt.pl renamed to scripts/dt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,34 @@
5050
secs => 5
5151
);
5252

53+
sub do_func
54+
{
55+
my $pid = shift @ARGV;
56+
usage() if !$pid;
57+
58+
my $exe = readlink("/proc/$pid/exe");
59+
if (!$exe) {
60+
print "Error: cannot read /proc/$pid/exe - $!\n";
61+
exit(1);
62+
}
63+
$exe = basename($exe);
64+
65+
print "Type Ctrl-C to see results\n";
66+
my $d = <<EOF;
67+
pid${pid}:${exe}::entry
68+
{
69+
\@func[probefunc] = count();
70+
}
71+
END
72+
{
73+
printa(\@func);
74+
}
75+
EOF
76+
do_dtrace($d);
77+
78+
exit(0);
79+
}
80+
5381
sub main
5482
{
5583
Getopt::Long::Configure('no_ignore_case');
@@ -63,6 +91,10 @@ sub main
6391
usage() if ($opts{help});
6492

6593
my $cmd = shift @ARGV;
94+
if ($cmd eq 'func') {
95+
do_func();
96+
}
97+
6698
my $mode = shift @ARGV || "scroll";
6799
usage() if !$cmd;
68100
usage() if !defined($calls{$cmd});
@@ -171,6 +203,8 @@ sub usage
171203
The following commands are available, and expand into traces against
172204
the listed system calls.
173205
206+
dt func <pid> - Show function calls for a running process.
207+
174208
EOF
175209
foreach my $s (sort(keys(%calls))) {
176210
printf " %-10s => %s\n", $s, $calls{$s} || " (n/a)";
@@ -197,6 +231,17 @@ sub usage
197231
198232
dt fork count2
199233
234+
\$ dt func 1234
235+
Type Ctrl-C to see results
236+
...
237+
lex_get_token 28988
238+
vt_parse_machine 29480
239+
eval_expr2 30437
240+
thread_verify 40003
241+
lex_unget_char 69696
242+
dstr_add_char 111018
243+
lex_get_char 331968
244+
200245
EOF
201246

202247
exit(1);

0 commit comments

Comments
 (0)