gnucobol-users
[Top][All Lists]
Advanced

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

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


From: Keisuke Nishida
Subject: Re: [open-cobol-list] gdb support from gcc-cobol
Date: Thu Jun 5 06:49:13 2003
User-agent: Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryƍmae) APEL/10.3 Emacs/21.2 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI)

At Thu, 05 Jun 2003 08:26:39 +0200,
Bernard Giroud wrote:
> 
> Taking this example:
> 
> 01 one-rec.
>   05 one-fld1 pic x(2).
>   05 one-fld2 pic 9(2) comp.
>  (... 200 other fields ...)
>   05 one-fldn pic s9(3)v99 comp-3.
> 
> Without separate names, you won't have separate symbols
> in gdb, and consequently you won't be able to say:
> p one-fldn because we won't have the fact that this
> field is a comp-3 with 2 decimal places.

Maybe I did not write exactly what I do now.
My compiler produces something like this:

  unsigned char b_ONE_REC[2411];
  cob_field f_ONE_REC = {2411, b_ONE_REC, &cob_group_attr};
  cob_field f_ONE_FLD1 = {2, b_ONE_REC + 0, &cob_alnum_attr};
  cob_field_attr a_1 = {COB_TYPE_NUMERIC_BINARY, 2, 0, 0, 0};
  cob_field f_ONE_FLD2 = {1, b_ONE_REC + 2, &a_1};
  ...
  cob_field_attr a_m = {COB_TYPE_NUMERIC_PACKED, 5, 2, COB_FLAG_HAVE_SIGN, 0};
  cob_field f_ONE_FLDN = {3, b_ONE_REC + 2408, &a_m};

There IS a symbol `f_ONE_FLDN', and you should be able to
display the value of `one-fldn'.  Actually, you can do
"p cob_display(&f_ONE_FLDN, 1)" in GDB to display it.

To be precise, the structures `cob_field_attr' and `cob_field'
are defined as follows:

typedef struct {
  char type;    /* field type (alphanumeric, numeric binary, etc.) */
  char digits;  /* the total number of digits */
  char expt;    /* exponent (10^expt) */
  char flags;   /* other flags (SIGN SEPERATE, etc.) */
  const char *pic; /* packed picture string (edited item only) */
} cob_field_attr;

typedef struct {
  size_t size;          /* the byte size of this field */
  unsigned char *data;  /* the base data address */
  cob_field_attr *attr; /* the field attribute */
} cob_field;

You can access to these data at run time via symbols `f_*'.

Keisuke


reply via email to

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