components/python/python26/patches/Python26-20-py_db.patch
branchs11-update
changeset 3788 66a6b4289021
parent 115 c360825c3a3f
equal deleted inserted replaced
3787:e0eb0826110c 3788:66a6b4289021
     1 diff --git Python-2.6.4/Makefile.pre.in.orig Python-2.6.4/Makefile.pre.in
     1 This patch adds Python debugger support.  It may be contributed upstream at
     2 --- Python-2.6.4/Makefile.pre.in.orig	Sun Feb 13 19:37:16 2011
     2 some point, but the suitability (or lack thereof) has not yet been determined.
     3 +++ Python-2.6.4/Makefile.pre.in	Sun Feb 13 20:55:04 2011
     3 
     4 @@ -354,7 +354,7 @@
     4 --- Python-2.6.8/Makefile.pre.in.~4~	2014-11-11 14:12:28.159605507 -0800
       
     5 +++ Python-2.6.8/Makefile.pre.in	2014-11-11 14:12:28.295152443 -0800
       
     6 @@ -355,7 +355,7 @@
     5  
     7  
     6  # Default target
     8  # Default target
     7  all:		build_all
     9  all:		build_all
     8 -build_all:	$(BUILDPYTHON) oldsharedmods sharedmods
    10 -build_all:	$(BUILDPYTHON) oldsharedmods sharedmods
     9 +build_all:	$(BUILDPYTHON) oldsharedmods sharedmods build-py_db
    11 +build_all:	$(BUILDPYTHON) oldsharedmods sharedmods build-py_db
    10  
    12  
    11  # Compile a binary with gcc profile guided optimization.
    13  # Compile a binary with gcc profile guided optimization.
    12  profile-opt:
    14  profile-opt:
    13 @@ -677,6 +677,20 @@
    15 @@ -678,6 +678,16 @@
    14  
    16  
    15  $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
    17  $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
    16  
    18  
    17 +SHLIB_FLAGS = -shared -fpic -M $(srcdir)/py_db/mapfile-vers
    19 +SHLIB_FLAGS = -shared -fpic -M $(srcdir)/py_db/mapfile-vers
    18 +
    20 +
    19 +libpython2.6_db.so.1.0:	$(srcdir)/py_db/libpython26_db.c
    21 +libpython2.6_db.so.1.0:	$(srcdir)/py_db/libpython26_db.c
    20 +	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
    22 +	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(SHLIB_FLAGS) $<
    21 +
    23 +
    22 +check_offset:	$(srcdir)/py_db/check_offsets.c
    24 +build-py_db:	libpython2.6_db.so.1.0
    23 +	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $<
    25 +
    24 +
    26 +install-py_db:	libpython2.6_db.so.1.0
    25 +build-py_db:	libpython2.6_db.so.1.0 check_offset
       
    26 +
       
    27 +install-py_db:	libpython2.6_db.so.1.0 check_offset
       
    28 +	$(INSTALL_SHARED) libpython2.6_db.so.1.0 $(DESTDIR)$(LIBDIR)
    27 +	$(INSTALL_SHARED) libpython2.6_db.so.1.0 $(DESTDIR)$(LIBDIR)
    29 +	$(INSTALL_PROGRAM) check_offset $(DESTDIR)$(BINDIR)
       
    30 +
    28 +
    31  install-pycc:	$(srcdir)/pycc
    29  install-pycc:	$(srcdir)/pycc
    32         $(INSTALL_SCRIPT $< $(DESTDIR)$(BINLIBDEST)
    30  	$(INSTALL_SCRIPT) $< $(DESTDIR)$(BINLIBDEST)
    33 
    31  
    34 @@ -742,7 +755,7 @@
    32 @@ -743,7 +753,7 @@
    35  		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
    33  		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
    36  
    34  
    37  # Install everything
    35  # Install everything
    38 -install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ install-pycc
    36 -install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ install-pycc
    39 +install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ install-py_db install-pycc
    37 +install:	@FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ install-py_db install-pycc
    40  
    38  
    41  # Install almost everything without disturbing previous versions
    39  # Install almost everything without disturbing previous versions
    42  altinstall:	@FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
    40  altinstall:	@FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
    43 
       
    44 diff --git Python-2.6.4/py_db/check_offsets.c Python-2.6.4/py_db/check_offsets.c
       
    45 new file mode 100644
       
    46 --- /dev/null
       
    47 +++ Python-2.6.4/py_db/check_offsets.c
       
    48 @@ -0,0 +1,88 @@
       
    49 +/*
       
    50 + * CDDL HEADER START
       
    51 + *
       
    52 + * The contents of this file are subject to the terms of the
       
    53 + * Common Development and Distribution License (the "License").
       
    54 + * You may not use this file except in compliance with the License.
       
    55 + *
       
    56 + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
    57 + * or http://www.opensolaris.org/os/licensing.
       
    58 + * See the License for the specific language governing permissions
       
    59 + * and limitations under the License.
       
    60 + *
       
    61 + * When distributing Covered Code, include this CDDL HEADER in each
       
    62 + * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    63 + * If applicable, add the following below this CDDL HEADER, with the
       
    64 + * fields enclosed by brackets "[]" replaced with your own identifying
       
    65 + * information: Portions Copyright [yyyy] [name of copyright owner]
       
    66 + *
       
    67 + * CDDL HEADER END
       
    68 + */
       
    69 +/*
       
    70 + * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
       
    71 + * Use is subject to license terms.
       
    72 + */
       
    73 +
       
    74 +#include <stdio.h>
       
    75 +
       
    76 +#include <Python.h>
       
    77 +#include <frameobject.h>
       
    78 +
       
    79 +#include "libpython26_db_32.h"
       
    80 +
       
    81 +#if 0
       
    82 +#define	offsetof(s, m)	((size_t)(&(((s *)0)->m)))
       
    83 +#endif
       
    84 +
       
    85 +int
       
    86 +main(void)
       
    87 +{
       
    88 +/*
       
    89 + * PyCodeObject co_name
       
    90 + * PyCodeObject co_filename
       
    91 + * PyCodeObject co_lnotab
       
    92 + * PyFrameObject f_back
       
    93 + * PyFrameObject f_code
       
    94 + * PyFrameObject f_lasti
       
    95 + * PyInterpreterState next
       
    96 + * PyInterpreterState tstate_head
       
    97 + * PyStringObject ob_sval
       
    98 + * PyStringObject ob_size
       
    99 + * PyThreadState frame
       
   100 + * PyThreadState next
       
   101 + */
       
   102 +
       
   103 +	printf("struct member: native 32\n");
       
   104 +	printf("PyCodeObject co_name: %d %d\n", offsetof(PyCodeObject, co_name),
       
   105 +	    offsetof(PyCodeObject32, co_name));
       
   106 +	printf("PyCodeObject co_filename: %d %d\n", offsetof(PyCodeObject,
       
   107 +	    co_filename), offsetof(PyCodeObject32, co_filename));
       
   108 +	printf("PyCodeObject co_lnotab: %d %d\n", offsetof(PyCodeObject,
       
   109 +	    co_lnotab), offsetof(PyCodeObject32, co_lnotab));
       
   110 +	printf("PyFrameObject f_back: %d %d\n", offsetof(PyFrameObject, f_back),
       
   111 +	    offsetof(PyFrameObject32, f_back));
       
   112 +	printf("PyFrameObject f_code: %d %d\n", offsetof(PyFrameObject, f_code),
       
   113 +	    offsetof(PyFrameObject32, f_code));
       
   114 +	printf("PyFrameObject f_lasti: %d %d\n", offsetof(PyFrameObject,
       
   115 +	    f_lasti), offsetof(PyFrameObject32, f_lasti));
       
   116 +	printf("PyInterpreterState next: %d %d\n", offsetof(PyInterpreterState,
       
   117 +	    next), offsetof(PyInterpreterState32, next));
       
   118 +	printf("PyInterpreterState tstate_head: %d %d\n",
       
   119 +	    offsetof(PyInterpreterState, tstate_head),
       
   120 +	    offsetof(PyInterpreterState32, tstate_head));
       
   121 +	printf("PyStringObject ob_sval: %d %d\n", offsetof(PyStringObject,
       
   122 +	    ob_sval), offsetof(PyStringObject32, ob_sval));
       
   123 +	printf("PyStringObject ob_size: %d %d\n", offsetof(PyStringObject,
       
   124 +	    ob_size), offsetof(PyStringObject32, ob_size));
       
   125 +	printf("PyThreadState frame: %d %d\n", offsetof(PyThreadState, frame),
       
   126 +	    offsetof(PyThreadState32, frame));
       
   127 +	printf("PyThreadState next: %d %d\n", offsetof(PyThreadState, next),
       
   128 +	    offsetof(PyThreadState32, next));
       
   129 +
       
   130 +	printf("\nObject sizes\n");
       
   131 +	printf("PyObject: %d %d\n", sizeof (PyObject), sizeof (PyObject32));
       
   132 +	printf("PyVarObject: %d %d\n", sizeof (PyVarObject),
       
   133 +	    sizeof (PyVarObject32));
       
   134 +
       
   135 +	return (0);
       
   136 +}
       
   137 diff --git Python-2.6.4/py_db/libpython26_db.c Python-2.6.4/py_db/libpython26_db.c
       
   138 new file mode 100644
       
   139 --- /dev/null
    41 --- /dev/null
   140 +++ Python-2.6.4/py_db/libpython26_db.c
    42 +++ Python-2.6.4/py_db/libpython26_db.c
   141 @@ -0,0 +1,655 @@
    43 @@ -0,0 +1,655 @@
   142 +/*
    44 +/*
   143 + * CDDL HEADER START
    45 + * CDDL HEADER START