On Fri, 17 Nov 2006, Steinar H. Gunderson wrote:
> Well, it's a step, at least, but it doesn't really help all that much. Lines
> 123 and 124 are
> 
>   123       wWorkspaceMenuUpdate(scr, scr->workspace_menu);
>   124       wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);

I've put a breakpoint on line 122 and checked the evolution of the various
variables here:
Breakpoint 1, wWorkspaceNew (scr=0x80f0530)
    at 
/home/rhertzog-deb/partages/debian/paquets/NMU/wmaker-0.92.0/src/workspace.c:123
123             wWorkspaceMenuUpdate(scr, scr->workspace_menu);
(gdb) print scr
$1 = (WScreen *) 0x80f0530
(gdb) print scr->clip_ws_menu
$2 = (struct WMenu *) 0x0
(gdb) print scr->workspace_menu
$3 = (struct WMenu *) 0x817da38
(gdb) n
121             scr->workspaces = list;
(gdb) n
123             wWorkspaceMenuUpdate(scr, scr->workspace_menu);
(gdb) print scr
$4 = (WScreen *) 0x80f0530
(gdb) print scr->clip_ws_menu
$5 = (struct WMenu *) 0x0
(gdb) print scr->workspace_menu
$6 = (struct WMenu *) 0x817da38
(gdb) n
124             wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
(gdb) print scr->clip_ws_menu
Cannot access memory at address 0x3220c0a0
(gdb) print scr
$7 = (WScreen *) 0x3220bed0

I tried to look in the code how "scr" could be modified but I didn't find
anything self-evident. :-/

> And the only way it could SIGSEGV in line 124, was if scr (that is, the
> pointer) was somehow invalid -- but if line 123 was run first (which I'd
> assume, even with -O2), scr would have to be valid (unless, of course,
> wWorkspaceMenuUpdate was inlined, but it's big and -O2 doesn't normally
> inline functions like that).

Stepping inside the function line 123 gives this:

Breakpoint 1, wWorkspaceNew (scr=0x80f0530)
    at 
/home/rhertzog-deb/partages/debian/paquets/NMU/wmaker-0.92.0/src/workspace.c:123
123             wWorkspaceMenuUpdate(scr, scr->workspace_menu);
(gdb) print scr
$1 = (WScreen *) 0x80f0530
(gdb) step
121             scr->workspaces = list;
(gdb) step
123             wWorkspaceMenuUpdate(scr, scr->workspace_menu);
(gdb) step
wWorkspaceMenuUpdate (scr=0x80f0530, menu=0x817da38)
    at 
/home/rhertzog-deb/partages/debian/paquets/NMU/wmaker-0.92.0/src/workspace.c:1410
1410        if (!menu)
(gdb) step
1403    {
(gdb) step
1410        if (!menu)
(gdb) step
1413        if (menu->entry_no < scr->workspace_count+2) {
(gdb) n
1415            i = scr->workspace_count-(menu->entry_no-2);
(gdb) s
1417            while (i>0) {
(gdb) s
1418                strcpy(title, scr->workspaces[ws]->name);
(gdb) print title
$2 = "\000\002\000\000\000ô_Þ·ÀtÞ·\030%\026\bhsÚ¿ÂåÑ·ÀtÞ·\030%\026\b"
(gdb) n
1422                entry->flags.editable = 1;
(gdb) print title
$3 = "\000\002\000\000\000ô_Þ·ÀtÞ·\030%\026\bhsÚ¿ÂåÑ·ÀtÞ·\030%\026\b"
(gdb) n
1418                strcpy(title, scr->workspaces[ws]->name);
(gdb) n
1422                entry->flags.editable = 1;
(gdb) n
1420                entry = wMenuAddCallback(menu, title, switchWSCommand, 
(void*)ws);
(gdb) n
1422                entry->flags.editable = 1;
(gdb) n
1417            while (i>0) {
(gdb) n
1433        wMenuRealize(menu);
(gdb) n
1435        for (i=0; i<scr->workspace_count; i++) {
(gdb) n
1436            menu->entries[i+2]->flags.indicator_on = 0;
(gdb) n
1435        for (i=0; i<scr->workspace_count; i++) {
(gdb) n
1436            menu->entries[i+2]->flags.indicator_on = 0;
(gdb) n
1435        for (i=0; i<scr->workspace_count; i++) {
(gdb) n
1436            menu->entries[i+2]->flags.indicator_on = 0;
(gdb) n
1435        for (i=0; i<scr->workspace_count; i++) {
(gdb) n
1436            menu->entries[i+2]->flags.indicator_on = 0;
(gdb) n
1435        for (i=0; i<scr->workspace_count; i++) {
(gdb) n
1438        menu->entries[scr->current_workspace+2]->flags.indicator_on = 1;
(gdb) n
1441        if (scr->current_workspace == scr->workspace_count-1) {
(gdb) n
1444            wMenuSetEnabled(menu, 1, True);
(gdb) print menu
$5 = (WMenu *) 0x817da38
(gdb) n
1447        tmp = menu->frame->top_width + 5;
(gdb) n
1449        if (menu->frame_x < tmp - (int)menu->frame->core->width)
(gdb) n
1447        tmp = menu->frame->top_width + 5;
(gdb) n
1449        if (menu->frame_x < tmp - (int)menu->frame->core->width)
(gdb) n
1452        wMenuPaint(menu);
(gdb) n
1453    }
(gdb) n
wWorkspaceNew (scr=0x3220bed0)
    at 
/home/rhertzog-deb/partages/debian/paquets/NMU/wmaker-0.92.0/src/workspace.c:124
124             wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);

So the only solution is that something is overwriting the part of the
memory which contains the pointer "scr". But I don't know how to find out
what is responsible of that.

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/

Reply via email to