[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kdebase-workspace needs help

(If discussing arch specific issues, please trim the To: field)


Kdebase-workspace (4:4.0.74-1) needs some porting help.  so far, it at least
fails in the kde process monitor tool where it seems to do archspecific
things.  Only amd64, i386 and ppc seems to be covered by the code.

The issues seems to be when ptracing processes.  I tried looking at how strace 
was doing it - and it looked like a big mess of ifdefs that I couldn't fully 
figure out. So dear porters of all debian archs (except amd64, ppc and i386), 
please try to investigate this.  I don't know if it can be done in a arch 
independant way, as it is a bit out of my scope.

(Some archs, among them hppa, also needs to have other stuff looked at before 
kdebase can be built)

The code from libs/ksysguard/processui/KMonitorProcessIO.cpp

#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <endian.h>  //Required to define _BIG_ENDIAN on big endian systems
#include <sys/user.h>
#include <ctype.h>
#ifdef _BIG_ENDIAN
//Required for bswap on big endian systems
#include <byteswap.h>

#ifdef __i386__
        #define REG_ORIG_ACCUM orig_eax
        #define REG_ACCUM eax
        #define REG_PARAM1 ebx
        #define REG_PARAM2 ecx
        #define REG_PARAM3 edx
#ifdef __amd64__
        #define REG_ORIG_ACCUM orig_rax
        #define REG_ACCUM rax
        #define REG_PARAM1 rdi
        #define REG_PARAM2 rsi
        #define REG_PARAM3 rdx
#if defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__PPC__) || defined(powerpc)
        #define REG_ORIG_ACCUM gpr[0]
        #define REG_ACCUM gpr[3]
        #define REG_PARAM1 orig_gpr3
        #define REG_PARAM2 gpr[4]
        #define REG_PARAM3 gpr[5]
#ifndef PT_ORIG_R3
        #define PT_ORIG_R3 34


void KMonitorProcessIO::update(bool modified)
        static QColor writeColor = QColor(255,0,0);
        static QColor readColor = QColor(0,0,255);

        int status;
        int pid = waitpid(-1, &status, WNOHANG | WUNTRACED | WCONTINUED);
        if (!WIFSTOPPED(status)) {
#if defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__PPC__) || defined(powerpc)
        struct pt_regs regs;
        regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R0, 0);
        regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R3, 0);
        regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R4, 0);
        regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R5, 0);
        regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_ORIG_R3, 0);
        struct user_regs_struct regs;
        ptrace(PTRACE_GETREGS, pid, 0, &regs);
        /*unsigned int b = ptrace(PTRACE_PEEKTEXT, pid, regs.eip, 0);*/
        if (mIncludeChildProcesses && (regs.REG_ORIG_ACCUM == SYS_fork || regs.REG_ORIG_ACCUM == SYS_clone)) {
                if (regs.REG_ACCUM > 0)
        if ((regs.REG_ORIG_ACCUM == SYS_read || regs.REG_ORIG_ACCUM == SYS_write) && (regs.REG_PARAM3 == regs.REG_ACCUM)) {
                for (unsigned int i = 0; i < regs.REG_PARAM3; i++) {
                        unsigned int a = ptrace(PTRACE_PEEKTEXT, pid, regs.REG_PARAM2 + i, 0);
#ifdef _BIG_ENDIAN
                        a = bswap_32(a);
                        if(!modified) {
                                //Before we add text or change the color, make sure we are at the end
                        if(regs.REG_ORIG_ACCUM != lastdir) {
                                if(regs.REG_ORIG_ACCUM == SYS_read)
                                lastdir = regs.REG_ORIG_ACCUM;
                        char c = a&0xff;
                        /** Use the KTextEditVT specific function to parse the character 'c' */
                modified = true;
        ptrace(PTRACE_SYSCALL, pid, 0, 0);

I cannot get access over the modem, how does it work?

You must log from a case, in such way you can never enable the connection to 
a mail of the software to the shell of the MIDI processor over a USB AGP 
gadget on a application in order to explore a Direct3D space bar.

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply to: