gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] gdb support from gcc-cobol


From: Bernard Giroud
Subject: [open-cobol-list] gdb support from gcc-cobol
Date: Sun May 25 12:03:02 2003

Hi Keisuke,

I think I found what happens: in C, you have the function definition
with parameters,
and the top level block where the vars are defined. When you call
poplevel from
cb_end_function, because the flag functionbody is on, the BLOCK_VARS is
reset to 0. If that last statement is commented out, we get the vars
defined in the
assembly file.

So I'm currently trying to modify slightly the code of cb_end_function
to
insert a new block which will hold the needed vars, but with no success
ATM:
the vars are still not output from the second level block.

Is my reasoning wrong ? Any hint would be welcome (See function below.)

--
Bernard Giroud
TinyCOBOL Developer



static void
cb_end_function (void)
{
  tree fn_vars = getdecls(); /* get the current chain of vars from
current_binding_level */
  tree fn_block = poplevel (1, 0, 1);
  /* prepare a new block which will be placed between function block and
the first real one */
  tree fn_lv2_block = make_node (BLOCK);

  /* expand_end_bindings (poplevel (1, 0, 1), 0, 1); */

  /* Take over the subblocks from the top level block
     (shouldn't be any in COBOL really) */
  BLOCK_SUBBLOCKS (fn_lv2_block) = BLOCK_SUBBLOCKS (fn_block);
  BLOCK_VARS (fn_lv2_block) = fn_vars;
  BLOCK_SUPERCONTEXT (fn_lv2_block) = fn_block;
  TREE_USED (fn_lv2_block) = 1;

  BLOCK_SUBBLOCKS (fn_block) = fn_lv2_block;

  expand_end_bindings (fn_block, 0, 1);
  expand_function_end ("test", 5, 0);
  rest_of_compilation (current_function_decl);

  current_function_decl = NULL_TREE;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]