Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4061 - trunk/src/target/gsm/src/gsmd
      ([EMAIL PROTECTED])
   2. r4062 - in developers: . tick tick/ecoreglib tick/stackutil
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: erin_yueh
Date: 2008-02-13 07:59:22 +0100 (Wed, 13 Feb 2008)
New Revision: 4061

Modified:
   trunk/src/target/gsm/src/gsmd/usock.c
Log:
gsmd: remove dead imsi code and fix bug (Paulius Zaleckas)


Modified: trunk/src/target/gsm/src/gsmd/usock.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/usock.c       2008-02-13 03:48:28 UTC (rev 
4060)
+++ trunk/src/target/gsm/src/gsmd/usock.c       2008-02-13 06:59:22 UTC (rev 
4061)
@@ -613,14 +613,6 @@
                        cmd->id, sizeof(ret), &ret);
 }
 
-static int get_imsi_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
-{
-       DEBUGP("resp: %s\n", resp);
-
-       return gsmd_ucmd_submit(ctx, GSMD_MSG_PHONE, GSMD_PHONE_GET_IMSI,
-                       cmd->id, strlen(resp) + 1, resp);
-}
-
 static int usock_rcv_phone(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, 
                           int len)
 {
@@ -639,7 +631,7 @@
                break;
        case GSMD_PHONE_GET_IMSI:
                return gsmd_ucmd_submit(gu, GSMD_MSG_PHONE, GSMD_PHONE_GET_IMSI,
-                       0, strlen(gu->gsmd->imsi), gu->gsmd->imsi);
+                       0, strlen(gu->gsmd->imsi) + 1, gu->gsmd->imsi);
                break;
 
        default:




--- End Message ---
--- Begin Message ---
Author: tick
Date: 2008-02-13 10:05:23 +0100 (Wed, 13 Feb 2008)
New Revision: 4062

Added:
   developers/tick/
   developers/tick/ecoreglib/
   developers/tick/ecoreglib/ecoreglib.c
   developers/tick/ecoreglib/ecoreglib.h
   developers/tick/stackutil/
   developers/tick/stackutil/Makefile
   developers/tick/stackutil/stack_util.c
   developers/tick/stackutil/stack_util.h
   developers/tick/stackutil/stackdemo.c
Log:
stackutil: A debug util
ecoreglib: Integrate the main loop of E into glib


Added: developers/tick/ecoreglib/ecoreglib.c
===================================================================
--- developers/tick/ecoreglib/ecoreglib.c       2008-02-13 06:59:22 UTC (rev 
4061)
+++ developers/tick/ecoreglib/ecoreglib.c       2008-02-13 09:05:23 UTC (rev 
4062)
@@ -0,0 +1,38 @@
+#include <glib.h>
+#include <Ecore.h>
+
+#include "ecoreglib.h"
+
+static gboolean GEvas_prepare (GSource *source, gint *timeout_) {
+       return TRUE;
+}
+
+static gboolean GEvas_check(GSource *source) {
+       return TRUE;
+}
+
+static gboolean GEvas_dispatch (GSource *source, GSourceFunc  callback, 
gpointer user_data) {
+       ecore_main_loop_iterate ();
+       return TRUE;
+}
+
+static GSourceFuncs  Iterator_funcs = {
+       GEvas_prepare,
+       GEvas_check,
+       GEvas_dispatch,
+       NULL,
+       NULL,
+       NULL
+};
+
+void ecore_glib_main_begin (GMainContext *context) {
+       GSource *source = g_source_new(&Iterator_funcs,sizeof(GSource));
+       GMainLoop *loop =  g_main_loop_new (context,FALSE);
+       if (!context) {
+               context= g_main_context_default();
+       }
+       loop =  g_main_loop_new (context,FALSE);
+
+       g_source_attach((GSource *)source, context);
+       g_main_run(loop);
+}

Added: developers/tick/ecoreglib/ecoreglib.h
===================================================================
--- developers/tick/ecoreglib/ecoreglib.h       2008-02-13 06:59:22 UTC (rev 
4061)
+++ developers/tick/ecoreglib/ecoreglib.h       2008-02-13 09:05:23 UTC (rev 
4062)
@@ -0,0 +1,13 @@
+/*
+ * @Auther Tick
+ * @License GPL
+ * @brief integrate Ecore main loop into glib main loop
+ */ 
+
+#ifndef __ECORE_GLIB_MAIN_loop_H__
+#define __ECORE_GLIB_MAIN_loop_H__
+
+#include <glib.h>
+void ecore_glib_main_begin (GMainContext *context) ;
+
+#endif

Added: developers/tick/stackutil/Makefile
===================================================================
--- developers/tick/stackutil/Makefile  2008-02-13 06:59:22 UTC (rev 4061)
+++ developers/tick/stackutil/Makefile  2008-02-13 09:05:23 UTC (rev 4062)
@@ -0,0 +1,6 @@
+### File: Makefile
+CFLAGS=-finstrument-functions -g2
+CC=gcc
+
+all: 
+       gcc $(CFLAGS) -o stackdemo stackdemo.c stack_util.c

Added: developers/tick/stackutil/stack_util.c
===================================================================
--- developers/tick/stackutil/stack_util.c      2008-02-13 06:59:22 UTC (rev 
4061)
+++ developers/tick/stackutil/stack_util.c      2008-02-13 09:05:23 UTC (rev 
4062)
@@ -0,0 +1,131 @@
+/** @file stack_util.c
+ *  @auther Tick
+ *  @License GPL
+ */
+
+#include "stack_util.h"
+
+#include <signal.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+
+#define _STACK_BUFFER_SIZE 4096
+void *__stack_buffer_[_STACK_BUFFER_SIZE];
+int __stack_pid_buffer[_STACK_BUFFER_SIZE];
+int __stack_buffer_index__private__ =0;
+volatile int __stack_spin_lock__=0;
+inline void dumpstack() {
+    int i,max=__stack_buffer_index__private__;
+    printf("Stack Trace:\n");
+    for (i=0;i<__stack_buffer_index__private__;i++) {
+        printf("[%3d] pid:[%3d]   
0x%08x\n",i,__stack_pid_buffer[i],__stack_buffer_[i]);
+    }
+}
+
+void setSignalHandler() {
+    int ans;
+    struct sigaction act,oldact;
+    act.sa_handler=DumpStack;
+    act.sa_flags= SA_ONESHOT | SA_NOMASK;
+    //act.sa_flags= SA_RESETHAND;
+    ans=sigaction(SIGUSR1,&act,&oldact);
+    if (ans) {
+        printf("Set SIGUSR1 Failed!!!!!\n");
+        printf ("ErrorNumber: %d\n",errno);
+    }else {
+        printf("Set SIGUSR1 OK!!!!!\n");
+    }
+
+    signal(SIGHUP,SignalHandler);
+ //   signal(SIGFPE,SignalHandler);
+    signal(SIGQUIT,SignalHandler);
+    signal(SIGILL,SignalHandler);
+    signal(SIGKILL,SignalHandler);
+    signal(SIGSEGV,SignalHandler);
+    signal(SIGTERM,SignalHandler);
+    signal(SIGPWR,SignalHandler);
+}
+
+void DumpStack(int sig) {
+    struct sigaction act,oldact;
+    act.sa_handler=DumpStack;
+    act.sa_flags= SA_ONESHOT | SA_NOMASK;
+    sigaction(SIGUSR1,&act,&oldact);
+
+    printf("Stack:\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n");
+
+   printf ("Signal Type: %d\n",sig);
+   printf ("ErrorNumber: %d\n",errno);
+   printf ("PID: %d\n",getpid());
+   dumpstack();
+}
+
+void SignalHandler(int sig) {
+    if (sig==SIGTERM || sig==SIGKILL) {
+
+        //close device here
+    }
+    if (sig==SIGTERM) {
+        printf ("Signal Type: %d\n",sig);
+        printf ("PID: %d goes die\n",getpid());
+        fflush(stdout);
+        fflush(stderr);
+        sleep(1);
+        exit(0);
+    }
+
+    printf("Stack:\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x 0x%08x 0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 
0x%08x\n0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n");
+
+   printf ("Signal Type: %d\n",sig);
+   printf ("ErrorNumber: %d\n",errno);
+   printf ("PID: %d\n",getpid());
+   printf ("\n");
+   dumpstack();
+   fflush(stdout);
+   fflush(stderr);
+    if (sig==SIGSEGV || sig==SIGILL) {
+        //exit(EXIT_FAILURE);
+        // If you want to kill whole tick when page fault happens 
+        // please USE "exit(EXIT_FAILURE);"
+        _exit(129);
+    }
+}
+
+
+void __cyg_profile_func_enter(void *func,void *caller) {
+    while (__stack_spin_lock__) ;
+    __stack_spin_lock__=1;
+    if (__stack_buffer_index__private__ < _STACK_BUFFER_SIZE) {
+      __stack_buffer_[__stack_buffer_index__private__]=func;
+      __stack_pid_buffer[__stack_buffer_index__private__]=getpid();
+      __stack_buffer_index__private__++;  
+    }
+    __stack_spin_lock__=0;
+}
+void __cyg_profile_func_exit(void *func,void *caller) {
+    while (__stack_spin_lock__) ;
+    __stack_spin_lock__=1;
+    int i,pid=getpid();
+    if (__stack_buffer_index__private__ > 0) {
+        for (i=__stack_buffer_index__private__-1;i >0;i--) {
+            if (__stack_pid_buffer[i]==pid) {
+                break;
+            }
+        }
+        for (;i<__stack_buffer_index__private__-1;i++) {
+            __stack_buffer_[i]=__stack_buffer_[i+1];
+            __stack_pid_buffer[i]=__stack_pid_buffer[i+1];
+        }
+        __stack_buffer_index__private__--;
+    }
+    __stack_spin_lock__=0;
+}

Added: developers/tick/stackutil/stack_util.h
===================================================================
--- developers/tick/stackutil/stack_util.h      2008-02-13 06:59:22 UTC (rev 
4061)
+++ developers/tick/stackutil/stack_util.h      2008-02-13 09:05:23 UTC (rev 
4062)
@@ -0,0 +1,15 @@
+/** @file stack_util.h 
+ *  @auther Tick
+ *  @License GPL
+ */
+
+#ifndef __TICK_DEMO_STACK___
+#define __TICK_DEMO_STACK___
+
+void setSignalHandler();
+void SignalHandler(int) __attribute__((__no_instrument_function__));
+void DumpStack(int sig) __attribute__((__no_instrument_function__));
+void __cyg_profile_func_enter(void *func,void *caller) 
__attribute__((__no_instrument_function__));
+void __cyg_profile_func_exit(void *func,void *caller) 
__attribute__((__no_instrument_function__));
+
+#endif

Added: developers/tick/stackutil/stackdemo.c
===================================================================
--- developers/tick/stackutil/stackdemo.c       2008-02-13 06:59:22 UTC (rev 
4061)
+++ developers/tick/stackutil/stackdemo.c       2008-02-13 09:05:23 UTC (rev 
4062)
@@ -0,0 +1,84 @@
+/**
+ * @file stackdemo.c
+ * @author Tick
+ * @license GPL
+ */ 
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+#include "stack_util.h"
+
+struct LALA {
+    int data;
+    int lala;
+};
+
+void run_me_will_crash_null_point () {
+    struct LALA *lala=NULL;
+    lala->lala++;
+}
+
+void run_me_will_crash_divid_zero() {
+    int a=1;
+    int b= 200/ --a;
+}
+
+void run_me_will_crash_buffer_overflow() {
+    char buf[4];
+    char *src;
+    src =(char *) malloc (64);
+    memset(src,'A',64);
+    memcpy(buf,src,64);
+}
+
+
+void prompt() {
+    printf("What way do you want to die?\n");
+    printf("1. segment fault\n");
+    printf("2. divid zero\n");
+    printf("3. buffer overflow\n");
+    printf("> ");
+}
+
+void do_die () {
+    char buf[128];
+    while(1) {
+        prompt();
+        fgets(buf,sizeof(buf),stdin);
+        if (isdigit(buf[0])) {
+            switch (buf[0]) {
+                case '1':
+                    run_me_will_crash_null_point();
+                    break;
+                case '2':
+                    run_me_will_crash_divid_zero();
+                    break;
+                case '3':
+                    run_me_will_crash_buffer_overflow();
+                    break;
+                default:
+                    continue;
+            }
+        }
+    }
+}
+
+void showmaps() {
+     char buf[128];
+    sprintf(buf,"cat /proc/%d/maps",getpid());
+    system(buf);
+}
+
+void function_D() {do_die();}
+void function_C() {function_D();}
+void function_B() {function_C();}
+void function_A() {function_B();}
+int main (void) {
+    setSignalHandler();
+    showmaps();
+    function_A();
+}
+
+




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to