components/python/python34/patches/12-py_db.patch
branchs11-update
changeset 3788 66a6b4289021
parent 3786 fa9d2da4d216
child 3869 eb4c6284602f
equal deleted inserted replaced
3787:e0eb0826110c 3788:66a6b4289021
    10 -build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed python-config
    10 -build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed python-config
    11 +build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed python-config build-py_db
    11 +build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed python-config build-py_db
    12  
    12  
    13  # Compile a binary with gcc profile guided optimization.
    13  # Compile a binary with gcc profile guided optimization.
    14  profile-opt:
    14  profile-opt:
    15 @@ -673,6 +673,19 @@
    15 @@ -673,6 +673,15 @@
    16  	@mv config.c Modules
    16  	@mv config.c Modules
    17  	@echo "The Makefile was updated, you may need to re-run make."
    17  	@echo "The Makefile was updated, you may need to re-run make."
    18  
    18  
    19 +SHLIB_FLAGS = -shared -fpic
    19 +SHLIB_FLAGS = -shared -fpic
    20 +
    20 +
    21 +libpython$(LDVERSION)_db.so.1.0:        $(srcdir)/py_db/libpython34_db.c
    21 +libpython$(LDVERSION)_db.so.1.0:        $(srcdir)/py_db/libpython34_db.c
    22 +	$(CC) -o $@ $(CFLAGS) $(PY_CPPFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
    22 +	$(CC) -o $@ $(CFLAGS) $(PY_CPPFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
    23 +
    23 +
    24 +check_offset:  $(srcdir)/py_db/check_offsets.c
    24 +build-py_db:   libpython$(LDVERSION)_db.so.1.0
    25 +	$(CC) -o $@ $(CFLAGS) $(PY_CPPFLAGS) $(CPPFLAGS) $<
    25 +
    26 +
    26 +install-py_db: libpython$(LDVERSION)_db.so.1.0
    27 +build-py_db:   libpython$(LDVERSION)_db.so.1.0 check_offset
       
    28 +
       
    29 +install-py_db: libpython$(LDVERSION)_db.so.1.0 check_offset
       
    30 +	$(INSTALL_SHARED) libpython$(LDVERSION)_db.so.1.0 $(DESTDIR)$(LIBDIR)
    27 +	$(INSTALL_SHARED) libpython$(LDVERSION)_db.so.1.0 $(DESTDIR)$(LIBDIR)
    31 +	$(INSTALL_PROGRAM) check_offset $(DESTDIR)$(BINDIR)
       
    32  
    28  
    33  Modules/Setup: $(srcdir)/Modules/Setup.dist
    29  Modules/Setup: $(srcdir)/Modules/Setup.dist
    34  	@if test -f Modules/Setup; then \
    30  	@if test -f Modules/Setup; then \
    35 @@ -1042,7 +1055,7 @@
    31 @@ -1042,7 +1051,7 @@
    36  		$(TESTRUNNER) $(QUICKTESTOPTS)
    32  		$(TESTRUNNER) $(QUICKTESTOPTS)
    37  
    33  
    38  
    34  
    39 -install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
    35 -install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKINSTALLLAST@
    40 +install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall install-py_db @FRAMEWORKINSTALLLAST@
    36 +install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall install-py_db @FRAMEWORKINSTALLLAST@
    41  	if test "x$(ENSUREPIP)" != "xno"  ; then \
    37  	if test "x$(ENSUREPIP)" != "xno"  ; then \
    42  		case $(ENSUREPIP) in \
    38  		case $(ENSUREPIP) in \
    43  			upgrade) ensurepip="--upgrade" ;; \
    39  			upgrade) ensurepip="--upgrade" ;; \
    44 --- /dev/null
       
    45 +++ Python-3.4.0/py_db/check_offsets.c
       
    46 @@ -0,0 +1,87 @@
       
    47 +/*
       
    48 + * CDDL HEADER START
       
    49 + *
       
    50 + * The contents of this file are subject to the terms of the
       
    51 + * Common Development and Distribution License (the "License").
       
    52 + * You may not use this file except in compliance with the License.
       
    53 + *
       
    54 + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
    55 + * or http://www.opensolaris.org/os/licensing.
       
    56 + * See the License for the specific language governing permissions
       
    57 + * and limitations under the License.
       
    58 + *
       
    59 + * When distributing Covered Code, include this CDDL HEADER in each
       
    60 + * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    61 + * If applicable, add the following below this CDDL HEADER, with the
       
    62 + * fields enclosed by brackets "[]" replaced with your own identifying
       
    63 + * information: Portions Copyright [yyyy] [name of copyright owner]
       
    64 + *
       
    65 + * CDDL HEADER END
       
    66 + */
       
    67 +/*
       
    68 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
       
    69 + */
       
    70 +
       
    71 +#include <stdio.h>
       
    72 +
       
    73 +#include <Python.h>
       
    74 +#include <frameobject.h>
       
    75 +
       
    76 +#include "libpython34_db_32.h"
       
    77 +
       
    78 +#if 0
       
    79 +#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
       
    80 +#endif
       
    81 +
       
    82 +int
       
    83 +main(void)
       
    84 +{
       
    85 +/*
       
    86 + * PyCodeObject co_name
       
    87 + * PyCodeObject co_filename
       
    88 + * PyCodeObject co_lnotab
       
    89 + * PyFrameObject f_back
       
    90 + * PyFrameObject f_code
       
    91 + * PyFrameObject f_lasti
       
    92 + * PyInterpreterState next
       
    93 + * PyInterpreterState tstate_head
       
    94 + * PyBytesObject ob_sval
       
    95 + * PyBytesObject ob_size
       
    96 + * PyThreadState frame
       
    97 + * PyThreadState next
       
    98 + */
       
    99 +
       
   100 +	printf("struct member: native 32\n");
       
   101 +	printf("PyCodeObject co_name: %d %d\n", offsetof(PyCodeObject, co_name),
       
   102 +	    offsetof(PyCodeObject32, co_name));
       
   103 +	printf("PyCodeObject co_filename: %d %d\n", offsetof(PyCodeObject,
       
   104 +	    co_filename), offsetof(PyCodeObject32, co_filename));
       
   105 +	printf("PyCodeObject co_lnotab: %d %d\n", offsetof(PyCodeObject,
       
   106 +	    co_lnotab), offsetof(PyCodeObject32, co_lnotab));
       
   107 +	printf("PyFrameObject f_back: %d %d\n", offsetof(PyFrameObject, f_back),
       
   108 +	    offsetof(PyFrameObject32, f_back));
       
   109 +	printf("PyFrameObject f_code: %d %d\n", offsetof(PyFrameObject, f_code),
       
   110 +	    offsetof(PyFrameObject32, f_code));
       
   111 +	printf("PyFrameObject f_lasti: %d %d\n", offsetof(PyFrameObject,
       
   112 +	    f_lasti), offsetof(PyFrameObject32, f_lasti));
       
   113 +	printf("PyInterpreterState next: %d %d\n", offsetof(PyInterpreterState,
       
   114 +	    next), offsetof(PyInterpreterState32, next));
       
   115 +	printf("PyInterpreterState tstate_head: %d %d\n",
       
   116 +	    offsetof(PyInterpreterState, tstate_head),
       
   117 +	    offsetof(PyInterpreterState32, tstate_head));
       
   118 +	printf("PyBytesObject ob_sval: %d %d\n", offsetof(PyBytesObject,
       
   119 +	    ob_sval), offsetof(PyBytesObject32, ob_sval));
       
   120 +	printf("PyBytesObject ob_size: %d %d\n", offsetof(PyBytesObject,
       
   121 +	    ob_base.ob_size), offsetof(PyBytesObject32, ob_size));
       
   122 +	printf("PyThreadState frame: %d %d\n", offsetof(PyThreadState, frame),
       
   123 +	    offsetof(PyThreadState32, frame));
       
   124 +	printf("PyThreadState next: %d %d\n", offsetof(PyThreadState, next),
       
   125 +	    offsetof(PyThreadState32, next));
       
   126 +
       
   127 +	printf("\nObject sizes\n");
       
   128 +	printf("PyObject: %d %d\n", sizeof (PyObject), sizeof (PyObject32));
       
   129 +	printf("PyVarObject: %d %d\n", sizeof (PyVarObject),
       
   130 +	    sizeof (PyVarObject32));
       
   131 +
       
   132 +	return (0);
       
   133 +}
       
   134 --- /dev/null
    40 --- /dev/null
   135 +++ Python-3.4.0/py_db/libpython34_db.c
    41 +++ Python-3.4.0/py_db/libpython34_db.c
   136 @@ -0,0 +1,654 @@
    42 @@ -0,0 +1,654 @@
   137 +/*
    43 +/*
   138 + * CDDL HEADER START
    44 + * CDDL HEADER START