Bug 621

Summary: libglib-2.0: g_mem_profle() return a error result
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Xiaofeng Yan <Xiaofeng.yan>
Component: meta-yoctoAssignee: Dongxiao Xu <dongxiao.xu>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jingdong.lu, poky.bs.watcher, poky.watcher, sgw
Version: 1.0   
Target Milestone: 1.0 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Xiaofeng Yan 2010-12-28 21:36:15 UTC
During Desktop-T2C test from lsb test suite I get a error from libglib-2.0. 

The detailed information is belows:

/glib-t2c/tests/glib_memory/glib_memory	
Message from the test:

Target interface(s):
 g_mem_profile
--------
g_mem_profile: no summary was produced by this call.
 
Requirement failed:
{g_mem_profile.01}
Outputs a summary of memory usage. 
================================================================================
The next c program is an example to apply function g_mem_progfile()

Host: ubuntu 10.04 x86_32
Compile environment:i586-poky-linux-gcc, pkg-config point to poky sysroot
Target Platform: qemux86  
PC$:Operation on Host
Target# Operation on qemux86
================================================================================

PC$ vim g_mem.c
#include <stdlib.h> /* atexit() */
#include <glib.h>

int main() {
    GList *list;

    atexit(g_mem_profile);
    g_mem_set_vtable(glib_mem_profiler_table);

    list = 0;
    list = g_list_append(list,0);
    g_list_free(list);

    return 0;
}
===============================================================================
PC$i586-poky-linux-gcc `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` g_mem.c -o g_mem 
PC$./g_mem
GLib Memory statistics (successful operations):
 blocks of | allocated  | freed      | allocated  | freed      | n_bytes   
  n_bytes  | n_times by | n_times by | n_times by | n_times by | remaining 
           | malloc()   | free()     | realloc()  | realloc()  |           
===========|============|============|============|============|===========
       508 |          3 |          0 |          0 |          0 |      +1524
      2040 |          1 |          0 |          0 |          0 |      +2040
GLib Memory statistics (failing operations):
 --- none ---
Total bytes: allocated=3564, zero-initialized=3564 (100.00%), freed=0 (0.00%), remaining=3564
===============================================================================
I copy this binary program to qemux86

Target#./g_mem
Target#

So It's nothing when running "./g_mem" on qemux86 platform.
Comment 1 Jingdong Lu 2010-12-28 23:31:54 UTC
Source code:
glib-2.27.3/glib/gmem.c
/* notes on macros:
 * having G_DISABLE_CHECKS defined disables use of glib_mem_profiler_table and
 * g_mem_profile().

glib-2.0_2.27.3.bb
|-- glib.inc
    |-- EXTRA_OECONF = "--disable-debug --enable-included-printf=no"

So, remove "--disable-debug", this will be fixed.
Comment 2 Xiaofeng Yan 2010-12-28 23:41:54 UTC
Thanks Jingdong Lu. perhaps We should add this modification to libglib bb file.