[pypy-commit] pypy dtrace-support: finish dtrace for freebsd
fijal
noreply at buildbot.pypy.org
Wed Mar 18 08:55:43 CET 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: dtrace-support
Changeset: r76448:b4cac385ef48
Date: 2015-03-18 08:55 +0100
http://bitbucket.org/pypy/pypy/changeset/b4cac385ef48/
Log: finish dtrace for freebsd
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -790,7 +790,7 @@
name_for_op = 'START'
else:
name_for_op = 'END'
- prefix = 'PYPY_PROBES_%s_%s();' % (
+ prefix = 'RPYTHON_%s_%s();' % (
val.replace('-', '_').upper(), name_for_op)
else:
prefix = ''
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -253,9 +253,9 @@
return cfile
def _generate_dtrace_probe_file(self, debug_nodes):
- name = self.targetdir.join('pypy.d')
+ name = self.targetdir.join('rpython.d')
f = name.open('w')
- f.write('provider pypy_probes {\n')
+ f.write('provider rpython {\n')
for debug_node in debug_nodes:
debug_node = debug_node.replace('-', '_')
f.write(' probe %s__start();\n' % debug_node)
@@ -263,7 +263,7 @@
f.write('};\n')
f.close()
returncode, stdout, stderr = runsubprocess.run_subprocess(
- 'dtrace', ['-o', str(self.targetdir.join('pypy_probes.h')),
+ 'dtrace', ['-o', str(self.targetdir.join('rpython_dtrace.h')),
'-h', '-s', str(name)])
if returncode:
raise Exception("Dtrace exploded: %s" % stderr)
@@ -488,18 +488,16 @@
mk.definition('DEBUGFLAGS', '-O1 -g -fPIC')
else:
mk.definition('DEBUGFLAGS', '-O1 -g')
- if (self.config.translation.dtrace and
- not self.translator.platform.name.startswith('darwin')):
- # right now dtrace is incompatible with asmgcc on all platforms
- # I think
- assert self.config.translation.gcrootfinder != 'asmgcc'
- mk.definition('OBJECTS1', '$(subst .c,.o,$(SOURCES))')
- mk.definition('OBJECTS', '$(OBJECTS1) dtrace_marker')
- mk.rule('dtrace_marker', '', 'dtrace -G -s pypy.d $(OBJECTS)')
if self.translator.platform.name == 'msvc':
mk.rule('debug_target', 'debugmode_$(DEFAULT_TARGET)', 'rem')
else:
mk.rule('debug_target', '$(DEFAULT_TARGET)', '#')
+ if (self.config.translation.dtrace and
+ not self.translator.platform.name.startswith('darwin')):
+ assert self.config.translation.gcrootfinder != 'asmgcc'
+ mk.definition('OBJECTS1', '$(subst .c,.o,$(SOURCES))')
+ mk.definition('OBJECTS', '$(OBJECTS1) rpython_dtrace.o')
+ mk.rule('rpython_dtrace.o', 'rpython.d $(OBJECTS1)', 'dtrace -G -s rpython.d -o rpython_dtrace.o $(OBJECTS1)')
mk.write()
#self.translator.platform,
# ,
@@ -854,7 +852,7 @@
eci.write_c_header(fi)
print >> fi, '#include "src/g_prerequisite.h"'
if dtrace:
- print >> fi, '#include "pypy_probes.h"'
+ print >> fi, '#include "rpython_dtrace.h"'
fi.write('#endif /* _PY_COMMON_HEADER_H*/\n')
fi.close()
diff --git a/rpython/translator/c/test/test_dtrace.py b/rpython/translator/c/test/test_dtrace.py
--- a/rpython/translator/c/test/test_dtrace.py
+++ b/rpython/translator/c/test/test_dtrace.py
@@ -1,4 +1,5 @@
+import subprocess
from rpython.translator.c.test.test_standalone import StandaloneTests
from rpython.rlib.debug import debug_start, debug_stop
from rpython.config.translationoption import get_combined_translation_config
@@ -16,4 +17,10 @@
return 0
_, cbuilder = self.compile(f)
- cbuilder.cmdexec('')
+ exe = cbuilder.executable_name
+ p = subprocess.Popen(['dtrace', '-n', ':' + exe.basename + '::',
+ '-c', str(exe)], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out = p.stdout.read()
+ assert 'pypy_g_f:x-start' in out
+ assert 'pypy_g_f:x-end' in out
diff --git a/rpython/translator/platform/freebsd.py b/rpython/translator/platform/freebsd.py
--- a/rpython/translator/platform/freebsd.py
+++ b/rpython/translator/platform/freebsd.py
@@ -7,7 +7,7 @@
name = "freebsd"
link_flags = tuple(
- ['-pthread'] +
+ ['-pthread', '-lelf'] +
os.environ.get('LDFLAGS', '').split())
cflags = tuple(
['-O3', '-pthread', '-fomit-frame-pointer'] +
diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -172,9 +172,11 @@
for args in definitions:
m.definition(*args)
+ target_rule = ('$(CC_LINK) $(LDFLAGSEXTRA) -o $@ $(OBJECTS)'
+ ' $(LIBDIRS) $(LIBS) $(LINKFILES) $(LDFLAGS)')
rules = [
('all', '$(DEFAULT_TARGET)', []),
- ('$(TARGET)', '$(OBJECTS)', '$(CC_LINK) $(LDFLAGSEXTRA) -o $@ $(OBJECTS) $(LIBDIRS) $(LIBS) $(LINKFILES) $(LDFLAGS)'),
+ ('$(TARGET)', '$(OBJECTS)', target_rule),
('%.o', '%.c', '$(CC) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'),
('%.o', '%.cxx', '$(CXX) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'),
]
More information about the pypy-commit
mailing list