|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
memprof-0.5.1 ported to a 32-bit linuxPPC running YellowDogLinux-4.0.1This is an attempt at hacking memprof-0.5.1 to run on a 32 bit PPC.
Attached are files to implement the changes within the GARNOME framework: http://cipherfunk.org/garnome/ Discussion ----------- Three files were patched in order to get memprof to build, install, and run. * bfdutils.c coding changes made because libbfd has changed since 2002 * memintercept-utils.c atomic operations taken from glibc to implement atomic_increment/decrement for platforms that uses glibc [Must have /usr/include/asm/atomic.h installed]. * stack-frame.c removed an __i386__ restriction and got away with it on a 32 bit PPC [maybe...] Observations ------------- * I doubt this version of memprof will work on a 64 bit machine. * The build generates a few warnings that appear to be unimportant on a 32 bit machine. * running the application sometimes generates warnings about failure to access the very first element in a memory block. For example: ** (memprof:7657): WARNING **: Cannot read word 0/52 in block 0x1ffc18d4: Input/output error ** (memprof:7657): WARNING **: Cannot read word 0/2444 in block 0x3fc577fc: Input/output error ** (memprof:7657): WARNING **: Cannot read word 0/61 in block 0x3fc57000: Input/output error -Joseph -- jsacco [at] ydl [dot] net GARNAME = memprof GARVERSION = 0.5.1 CATEGORIES = hacker-tools DISTFILES = $(GARNAME)-$(GARVERSION).tar.bz2 LIBDEPS = platform/libgnomeui platform/GConf PATCHFILES = memprof.patch DESCRIPTION = memprof define BLURB #FIXME: blurb goes here endef CONFIGURE_SCRIPTS = $(WORKSRC)/configure BUILD_SCRIPTS = $(WORKSRC)/Makefile INSTALL_SCRIPTS = $(WORKSRC)/Makefile CONFIGURE_ARGS = $(DIRPATHS) include ../category.mk 2d83704352a584ea7c78fbda9540c5cb download/memprof-0.5.1.tar.bz2 c407090574c2a8e0b8548d8e8536e0e6 download/memprof.patch [memprof.patch] --- ./bfdutils.c- 2005-02-17 17:04:02.000000000 -0500 +++ ./bfdutils.c 2005-02-17 17:04:15.000000000 -0500 @@ -164,7 +164,7 @@ * into the internals instead. :-( */ /* (*func) (addr, bfd_section_size (map->abfd, section), user_data); */ - (*func) (addr, section->_cooked_size, user_data); + (*func) (addr, section->size, user_data); } } } --- ./memintercept-utils.c- 2005-02-17 16:59:56.000000000 -0500 +++ ./memintercept-utils.c 2005-07-11 10:02:08.000000000 -0400 @@ -30,6 +30,12 @@ #include "memintercept-utils.h" +/* include atomic operations macros from glibc */ +#ifndef __KERNEL__ +#define __KERNEL__ +#endif +#include <asm/atomic.h> + static int write_all (int fd, const void *buf, @@ -264,30 +270,22 @@ uint32_t mi_atomic_increment(uint32_t *addr) { -#if defined (__GNUC__) && defined (__i386__) - uint32_t result; - __asm__ __volatile__("lock; xaddl %0, %1; incl %0" - : "=r"(result), "=m"(*(addr)) - : "0" (1), "m"(*(addr)) : "memory"); - return result; +#if defined (__GNUC__) + return((uint32_t)atomic_inc_return((atomic_t *)addr)); #else /* Hope for the best */ - return *++p; + return *++addr; #endif } uint32_t mi_atomic_decrement(uint32_t *addr) { -#if defined (__GNUC__) && defined (__i386__) - uint32_t result; - __asm__ __volatile__("lock; xaddl %0, %1; decl %0" - : "=r"(result), "=m"(*(addr)) - : "0" (-1), "m"(*(addr)) : "memory"); - return result; +#if defined (__GNUC__) + return((uint32_t)atomic_dec_return((atomic_t *)addr)); #else /* Hope for the best */ - return *--p; + return *--addr; #endif } --- ./stack-frame.c- 2005-02-17 17:02:22.000000000 -0500 +++ ./stack-frame.c 2005-02-17 17:02:37.000000000 -0500 @@ -69,7 +69,7 @@ #define HAVE_FRAME_ACCESSORS -#if defined (__GNUC__) && defined (__i386__) +#if defined (__GNUC__) typedef struct stack_frame_struct stack_frame; struct stack_frame_struct { stack_frame *next; _______________________________________________ memprof-list mailing list memprof-list@... http://mail.gnome.org/mailman/listinfo/memprof-list |
| Free embeddable forum powered by Nabble | Forum Help |