kdebase-workspace needs help

Sune Vuorela Sune at vuorela.dk
Sun May 25 10:49:53 UTC 2008


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

Hi!

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>
#endif

#ifdef __i386__
        #define REG_ORIG_ACCUM orig_eax
        #define REG_ACCUM eax
        #define REG_PARAM1 ebx
        #define REG_PARAM2 ecx
        #define REG_PARAM3 edx
#else
#ifdef __amd64__
        #define REG_ORIG_ACCUM orig_rax
        #define REG_ACCUM rax
        #define REG_PARAM1 rdi
        #define REG_PARAM2 rsi
        #define REG_PARAM3 rdx
#else
#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
#endif
#endif
#endif
#endif

[.....]

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(modified)
                        ensureCursorVisible();
                return;
        }
#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);
#else
        struct user_regs_struct regs;
        ptrace(PTRACE_GETREGS, pid, 0, &regs);
#endif
        /*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)
                        attach(regs.REG_ACCUM);
        }
        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);
#endif
                        if(!modified) {
                                //Before we add text or change the color, make sure we are at the end
                                moveCursor(QTextCursor::End);
                        }
                        if(regs.REG_ORIG_ACCUM != lastdir) {
                                if(regs.REG_ORIG_ACCUM == SYS_read)
                                        setTextColor(readColor);
                                else
                                        setTextColor(writeColor);
                                lastdir = regs.REG_ORIG_ACCUM;
                        }
                        char c = a&0xff;
                        /** Use the KTextEditVT specific function to parse the character 'c' */
                        insertVTChar(QChar(c));
                }
                modified = true;
        }
        ptrace(PTRACE_SYSCALL, pid, 0, 0);
        update(modified);
}




-- 
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.alioth.debian.org/pipermail/pkg-kde-talk/attachments/20080525/0765ea0d/attachment.pgp 


More information about the pkg-kde-talk mailing list