COMMON_SRCS = $(UTILITY_SRCS) $(PROBE_SRCS)
UTILITY_SRCS = \
+ ./helper/real_functions.c \
./helper/libdaprobe.c \
./helper/dahelper.c \
./helper/btsym.c \
#include "da_chart.h"
#include "binproto.h"
+#include "real_functions.h"
#define ERR_THREAD_CREATE_FAIL -2001 // thread creation fail
{
chart_interval_callback* newelem;
- newelem = (chart_interval_callback*)malloc(sizeof(chart_interval_callback));
+ newelem = (chart_interval_callback*)real_malloc(sizeof(chart_interval_callback));
newelem->chart_handle = charthandle;
newelem->series_handle = series_handle;
newelem->callback = callback;
#include "da_gles20.h"
#include "binproto.h"
#include "common_probe_init.h"
+#include "real_functions.h"
//#define EGL_TEST
Evas_GL_API *__gl_api;
#include <Evas.h>
#include <Evas_Engine_Buffer.h>
+#include "real_functions.h"
#include "daprobe.h"
#include "dahelper.h"
}
// ARGB32 is sizeof(int), that is 4 bytes, per pixel
- pixels = malloc(width * height * sizeof(int));
+ pixels = real_malloc(width * height * sizeof(int));
if (unlikely(pixels == NULL)) {
//fputs("ERROR: could not allocate canvas pixels!\n", stderr);
evas_free(canvas);
#include <unistd.h>
#include "dahelper.h"
+#include "real_functions.h"
struct data_list_t {
union {
#include "damaps.h"
#include "dastdout.h"
#include "common_probe_init.h"
+#include "real_functions.h"
#define APP_INSTALL_PATH "/opt/apps"
#define TISEN_APP_POSTFIX ".exe"
bool printLog(log_t* log, int msgType);
-void *(*real_malloc)(size_t) = NULL;
-
/******************************************************************************
* internal functions
(this means that these functions do not need to set enter/exit flag)
void __attribute__((constructor)) _init_probe()
{
+ if (_init_real_functions()) {
+ PRINTERR("cannot init real functions\n");
+ exit(1);
+ }
rtdl_next_set_once(real_malloc, "malloc");
/* init maps */
--- /dev/null
+/*
+ * DA probe
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Vitaliy Cherepanov <v.cherepanov@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <stdint.h> // fot uint32_t,uint64_t
+#include "daprobe.h"
+
+void *(*real_malloc)(size_t) = NULL;
+
+int _init_real_functions()
+{
+ rtdl_next_set_once(real_malloc, "malloc");
+ return 0;
+}
#include <pthread.h> // for pthread_mutex_t
#include "khash.h"
+#include "real_functions.h"
#ifdef __cplusplus
extern "C"{
char** da_backtrace_symbols (void* const* array, int size);
char** cached_backtrace_symbols (void* const* array, int size);
-/* real malloc function pointer */
-extern void *(*real_malloc)(size_t);
-
/* pid/tid values */
pid_t _getpid();
pid_t _gettid();
} \
if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; \
else { \
- new_flags = (uint32_t*)malloc(((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \
+ new_flags = (uint32_t*)real_malloc(((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \
memset(new_flags, 0xaa, ((new_n_buckets>>4) + 1) * sizeof(uint32_t)); \
if (h->n_buckets < new_n_buckets) { \
h->keys = (khkey_t*)realloc(h->keys, new_n_buckets * sizeof(khkey_t)); \
--- /dev/null
+/*
+ * DA probe
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Vitaliy Cherepanov <v.cherepanov@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _REAL_FUNCTIONS_H_
+#define _REAL_FUNCTIONS_H_
+
+/* real malloc function pointer */
+extern void *(*real_malloc)(size_t);
+
+extern int _init_real_functions();
+#endif /* _REAL_FUNCTIONS_H_ */
#include "dahelper.h"
#include "probeinfo.h"
#include "binproto.h"
+#include "real_functions.h"
#include "common_probe_init.h"
#include "api_config.h"
#include "da_event.h"
#include "binproto.h"
+#include "real_functions.h"
static int external_angle = 0;
static int internal_angle = 0;
#include "da_event.h"
#include "binproto.h"
+#include "real_functions.h"
bool touch_pressed = false;
#include <errno.h>
#include "binproto.h"
+#include "real_functions.h"
static enum DaOptions _sopt = OPT_FILE;
#include "da_io.h"
#include "binproto.h"
+#include "real_functions.h"
static enum DaOptions _sopt = OPT_FILE;
#include "daprobe.h"
#include "binproto.h"
#include "common_probe_init.h"
+#include "real_functions.h"
static enum DaOptions _sopt = OPT_GLES;
#include "da_gles20.h"
#include "binproto.h"
#include "common_probe_init.h"
+#include "real_functions.h"
/* GL __local_* functions prototypes */
#define X(func) extern void __local_##func(void);
void __init_gl_api__(void)
{
if (__gl_api == NULL)
- __gl_api = malloc(sizeof(*__gl_api));
+ __gl_api = real_malloc(sizeof(*__gl_api));
memset(__gl_api, 0, sizeof(*__gl_api));
}
#include "da_gles20.h"
#include "daprobe.h"
#include "binproto.h"
+#include "real_functions.h"
#include "common_probe_init.h"
#ifndef REAL_NAME
#include "da_memory.h"
#include "binproto.h"
#include "common_probe_init.h"
+#include "real_functions.h"
static enum DaOptions _sopt = OPT_ALLOC;
#include "dahelper.h"
#include "api_id_mapping.h"
#include "binproto.h"
+#include "real_functions.h"
#define OBJ_DUMMY 0
}
int sendMaxSize = SOCKET_SEND_SIZE;
- char* out = (char*) malloc(sendMaxSize + 5);
+ char* out = (char*) real_malloc(sendMaxSize + 5);
if (sret <= 0) {
out[0] = '\0';
} else {
memset(&message, 0, sizeof(message));
}
int sendMaxSize = SOCKET_SEND_SIZE;
- char* out = (char*) malloc(sendMaxSize + 5);
+ char* out = (char*) real_malloc(sendMaxSize + 5);
if (sret <= 0) {
out[0] = '\0';
} else {
*
*/
-#include <stdlib.h> // for malloc
#include <string.h> // for memcpy
#include <errno.h> // for errno
#include "daprobe.h"
#include "dahelper.h"
+#include "real_functions.h"
+
int daemon_close_allv(const int except_fds[])
{
static int (*daemon_close_allvp)(const int except_fds[]);
}
// allocate memory for new except fds
- fds = (int*)malloc((i + 2) * sizeof(int));
+ fds = (int*)real_malloc((i + 2) * sizeof(int));
// copy fds
if(fds)
#include "da_sync.h"
#include "binproto.h"
+#include "real_functions.h"
static enum DaOptions _sopt = OPT_THREAD;
#include "da_thread.h"
#include "da_sync.h"
#include "binproto.h"
+#include "real_functions.h"
typedef struct thread_routine_call_t {
void *(*thread_routine)(void *);
{
probeBlockStart();
thread_routine_call *ptrc =
- (thread_routine_call *) malloc(sizeof(thread_routine_call));
+ (thread_routine_call *) real_malloc(sizeof(thread_routine_call));
ptrc->thread_routine = start_routine;
ptrc->argument = arg;
probeBlockEnd();