From: Krisztian Litkey Date: Fri, 26 Oct 2012 15:43:07 +0000 (+0300) Subject: repo-fixing: fixup #1. X-Git-Tag: accepted/2.0alpha/20121203.182640~330 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51b4bbae84b3afebd9b2c773f8396a481f48c33e;hp=bfcfd91485bd70e1342886852f1bbdd59bd92aa2;p=profile%2Fivi%2Fmurphy.git repo-fixing: fixup #1. --- diff --git a/COPYING b/COPYING index fde7dc7..bfd055d 100644 --- a/COPYING +++ b/COPYING @@ -1,14 +1 @@ -All Murphy source code files are licensed under the three-clause BSD -license. See file LICENSE-BSD for the license text. - -It is possible to configure Murphy to use GPLv2-licensed libraries. At -least libdbus is licensed under the GPLv2, and under some circumstances -PulseAudio client library might also fall under the GPLv2. If Murphy is -configured to use these GPL-licensed libraries, Murphy must be -distributed under the restrictions defined in GPLv2 license text. - -To prevent mistakes in licensing, Murphy needs to be configured with ---enable-gpl configuration option in order to use the GPLv2-licensed -libaries. This is meant as a heads-up for the system integrator to -double-check the licensing and distribution of possible proprietary -Murphy plugins. +See LICENSE-BSD. diff --git a/src/common/debug.c b/src/common/debug.c index 98f63a2..bdd16c4 100644 --- a/src/common/debug.c +++ b/src/common/debug.c @@ -27,10 +27,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define _GNU_SOURCE -#include -#include - #include #include @@ -330,133 +326,6 @@ int mrp_debug_dump_config(FILE *fp) return TRUE; } -#undef __DUMP_ELF_INFO__ - -#ifdef __DUMP_ELF_IFDO__ -static const char *segment_type(uint32_t type) -{ -#define T(type) case type: return #type - switch (type) { - T(PT_NULL); - T(PT_LOAD); - T(PT_DYNAMIC); - T(PT_INTERP); - T(PT_NOTE); - T(PT_SHLIB); - T(PT_PHDR); - T(PT_TLS); - T(PT_NUM); - T(PT_LOOS); - T(PT_GNU_EH_FRAME); - T(PT_GNU_STACK); - T(PT_GNU_RELRO); - T(PT_LOPROC); - T(PT_HIPROC); - default: - return "unknown"; - } -} - - -static const char *segment_flags(uint32_t flags) -{ - static char buf[4]; - - buf[0] = (flags & PF_R) ? 'r' : '-'; - buf[1] = (flags & PF_W) ? 'w' : '-'; - buf[2] = (flags & PF_X) ? 'x' : '-'; - buf[3] = '\0'; - - return buf; -} - -#endif /* __DUMP_ELF_INFO__ */ - -typedef struct { - FILE *fp; - int indent; -} list_opt_t; - -static int list_cb(struct dl_phdr_info *info, size_t size, void *data) -{ -#define P(fmt, args...) fprintf(opt->fp, "%*.*s"fmt, \ - opt->indent, opt->indent, "" , ## args) -#define RELOC(addr) (info->dlpi_addr + addr) - - list_opt_t *opt = (list_opt_t *)data; - const ElfW(Phdr) *h; - int i; - const char *beg, *end, *s, *func; - char file[512], *p; - int line; - - MRP_UNUSED(size); - -#ifdef __DUMP_ELF_INFO__ - P("%s (@%p)\n", - info->dlpi_name && *info->dlpi_name ? info->dlpi_name : "", - info->dlpi_addr); - P(" %d segments\n", info->dlpi_phnum); -#endif - - file[sizeof(file) - 1] = '\0'; - - for (i = 0; i < info->dlpi_phnum; i++) { - h = &info->dlpi_phdr[i]; -#if __DUMP_ELF_INFO__ - P(" #%d:\n", i); - P(" type: 0x%x (%s)\n", h->p_type, segment_type(h->p_type)); - P(" offset: 0x%lx\n", h->p_offset); - P(" vaddr: 0x%lx (0x%lx)\n", h->p_vaddr, RELOC(h->p_vaddr)); - P(" paddr: 0x%lx (0x%lx)\n", h->p_paddr, RELOC(h->p_paddr)); - P(" filesz: 0x%lx\n", h->p_filesz); - P(" memsz: 0x%lx\n", h->p_memsz); - P(" flags: 0x%x (%s)\n", h->p_flags, segment_flags(h->p_flags)); - P(" align: 0x%lx\n", h->p_align); -#endif - if (h->p_flags & PF_W) - continue; - - beg = (const char *)RELOC(h->p_vaddr); - end = (const char *)beg + h->p_memsz; - -#define PREFIX "__DEBUG_SITE_" -#define PREFIX_LEN 13 - for (s = beg; s < end - PREFIX_LEN; s++) { - if (!strncmp(s, PREFIX, PREFIX_LEN)) { - s += PREFIX_LEN; - if (*s != '\0') { - strncpy(file, s, sizeof(file) - 1); - p = strchr(file, ':'); - - if (p != NULL) { - *p = '\0'; - line = (int)strtoul(p + 1, NULL, 10); - func = mrp_debug_site_function(file, line); - } - else - func = NULL; - - if (func != NULL) - P("%s@%s\n", func, s); - else - P("%s\n", s); - } - } - } - } - - return 0; -} - - -void mrp_debug_dump_sites(FILE *fp, int indent) -{ - list_opt_t opt = { .fp = fp, .indent = indent }; - - dl_iterate_phdr(list_cb, (void *)&opt); -} - void mrp_debug_msg(const char *site, const char *file, int line, const char *func, const char *format, ...) diff --git a/src/common/debug.h b/src/common/debug.h index 1064896..0c5ab9b 100644 --- a/src/common/debug.h +++ b/src/common/debug.h @@ -37,8 +37,6 @@ MRP_CDECL_BEGIN -#define MRP_DEBUG_SITE_PREFIX "__DEBUG_SITE" - /** Macro to generate a debug site string. */ #define MRP_DEBUG_SITE(file, line, func) \ "__DEBUG_SITE_"file":"MRP_STRINGIFY(line) @@ -75,9 +73,6 @@ int mrp_debug_set_config(const char *cmd); /** Dump the active debug configuration. */ int mrp_debug_dump_config(FILE *fp); -/** Dump all known debug sites. */ -void mrp_debug_dump_sites(FILE *fp, int indent); - /** Low-level log wrapper for debug messages. */ void mrp_debug_msg(const char *site, const char *file, int line, const char *func, const char *format, ...); diff --git a/src/core/console-command.c b/src/core/console-command.c index 1d58ea2..ef680e2 100644 --- a/src/core/console-command.c +++ b/src/core/console-command.c @@ -298,6 +298,128 @@ static void debug_show(mrp_console_t *c, void *user_data, mrp_debug_dump_config(c->stdout); } +#define __GNU_SOURCE +#include +#include + +typedef struct { + mrp_console_t *c; +} list_data_t; + + +#undef __DUMP_ELF_INFO__ + +#ifdef __DUMP_ELF_IFDO__ +static const char *segment_type(uint32_t type) +{ +#define T(type) case type: return #type + switch (type) { + T(PT_NULL); + T(PT_LOAD); + T(PT_DYNAMIC); + T(PT_INTERP); + T(PT_NOTE); + T(PT_SHLIB); + T(PT_PHDR); + T(PT_TLS); + T(PT_NUM); + T(PT_LOOS); + T(PT_GNU_EH_FRAME); + T(PT_GNU_STACK); + T(PT_GNU_RELRO); + T(PT_LOPROC); + T(PT_HIPROC); + default: + return "unknown"; + } +} + + +static const char *segment_flags(uint32_t flags) +{ + static char buf[4]; + + buf[0] = (flags & PF_R) ? 'r' : '-'; + buf[1] = (flags & PF_W) ? 'w' : '-'; + buf[2] = (flags & PF_X) ? 'x' : '-'; + buf[3] = '\0'; + + return buf; +} + +#endif /* __DUMP_ELF_INFO__ */ + +static int list_cb(struct dl_phdr_info *info, size_t size, void *data) +{ +#define P(fmt, args...) fprintf(c->stdout, fmt , ## args) +#define RELOC(addr) (info->dlpi_addr + addr) + + mrp_console_t *c = (mrp_console_t *)data; + const ElfW(Phdr) *h; + int i; + const char *beg, *end, *s, *func; + char file[512], *p; + int line; + + MRP_UNUSED(size); + +#ifdef __DUMP_ELF_INFO__ + P("%s (@%p)\n", + info->dlpi_name && *info->dlpi_name ? info->dlpi_name : "", + info->dlpi_addr); + P(" %d segments\n", info->dlpi_phnum); +#endif + + file[sizeof(file) - 1] = '\0'; + + for (i = 0; i < info->dlpi_phnum; i++) { + h = &info->dlpi_phdr[i]; +#if __DUMP_ELF_INFO__ + P(" #%d:\n", i); + P(" type: 0x%x (%s)\n", h->p_type, segment_type(h->p_type)); + P(" offset: 0x%lx\n", h->p_offset); + P(" vaddr: 0x%lx (0x%lx)\n", h->p_vaddr, RELOC(h->p_vaddr)); + P(" paddr: 0x%lx (0x%lx)\n", h->p_paddr, RELOC(h->p_paddr)); + P(" filesz: 0x%lx\n", h->p_filesz); + P(" memsz: 0x%lx\n", h->p_memsz); + P(" flags: 0x%x (%s)\n", h->p_flags, segment_flags(h->p_flags)); + P(" align: 0x%lx\n", h->p_align); +#endif + if (h->p_flags & PF_W) + continue; + + beg = (const char *)RELOC(h->p_vaddr); + end = (const char *)beg + h->p_memsz; + +#define PREFIX "__DEBUG_SITE_" +#define PREFIX_LEN 13 + for (s = beg; s < end - PREFIX_LEN; s++) { + if (!strncmp(s, PREFIX, PREFIX_LEN)) { + s += PREFIX_LEN; + if (*s != '\0') { + strncpy(file, s, sizeof(file) - 1); + p = strchr(file, ':'); + + if (p != NULL) { + *p = '\0'; + line = (int)strtoul(p + 1, NULL, 10); + func = mrp_debug_site_function(file, line); + } + else + func = NULL; + + if (func != NULL) + P(" %s@%s\n", func, s); + else + P(" %s\n", s); + } + } + } + } + + return 0; +} + static void debug_list(mrp_console_t *c, void *user_data, int argc, char **argv) @@ -308,7 +430,7 @@ static void debug_list(mrp_console_t *c, void *user_data, MRP_UNUSED(argv); fprintf(c->stdout, "Available debug sites:\n"); - mrp_debug_dump_sites(c->stdout, 4); + dl_iterate_phdr(list_cb, (void *)c); } diff --git a/src/linker-script.common b/src/linker-script.common index 7035116..06fb460 100644 --- a/src/linker-script.common +++ b/src/linker-script.common @@ -15,7 +15,6 @@ mrp_data_get_blob_size; mrp_debug_check; mrp_debug_dump_config; - mrp_debug_dump_sites; mrp_debug_enable; mrp_debug_msg; mrp_debug_register_file;