1 /* Print in infix form a struct expression.
2 Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 #include "expression.h"
26 #include "parser-defs.h"
28 /* Prototypes for local functions */
31 print_subexp
PARAMS ((struct expression
*, int *, GDB_FILE
*, enum precedence
));
34 print_simple_m2_func
PARAMS ((char *, struct expression
*, int *, GDB_FILE
*));
37 print_expression (exp
, stream
)
38 struct expression
*exp
;
42 print_subexp (exp
, &pc
, stream
, PREC_NULL
);
45 /* Print the subexpression of EXP that starts in position POS, on STREAM.
46 PREC is the precedence of the surrounding operator;
47 if the precedence of the main operator of this subexpression is less,
48 parentheses are needed here. */
51 print_subexp (exp
, pos
, stream
, prec
)
52 register struct expression
*exp
;
57 register unsigned tem
;
58 register const struct op_print
*op_print_tab
;
61 register char *op_str
;
62 int assign_modify
= 0;
63 enum exp_opcode opcode
;
64 enum precedence myprec
= PREC_NULL
;
65 /* Set to 1 for a right-associative operator. */
70 op_print_tab
= exp
->language_defn
->la_op_print_tab
;
72 opcode
= exp
->elts
[pc
].opcode
;
80 fputs_filtered (type_name_no_tag (exp
->elts
[pc
+ 1].type
), stream
);
81 fputs_filtered ("::", stream
);
82 nargs
= longest_to_int (exp
->elts
[pc
+ 2].longconst
);
83 (*pos
) += 4 + BYTES_TO_EXP_ELEM (nargs
+ 1);
84 fputs_filtered (&exp
->elts
[pc
+ 3].string
, stream
);
89 value_print (value_from_longest (exp
->elts
[pc
+ 1].type
,
90 exp
->elts
[pc
+ 2].longconst
),
91 stream
, 0, Val_no_prettyprint
);
96 value_print (value_from_double (exp
->elts
[pc
+ 1].type
,
97 exp
->elts
[pc
+ 2].doubleconst
),
98 stream
, 0, Val_no_prettyprint
);
105 b
= exp
->elts
[pc
+ 1].block
;
107 && BLOCK_FUNCTION (b
) != NULL
108 && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b
)) != NULL
)
110 fputs_filtered (SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b
)), stream
);
111 fputs_filtered ("::", stream
);
113 fputs_filtered (SYMBOL_SOURCE_NAME (exp
->elts
[pc
+ 2].symbol
), stream
);
119 fprintf_filtered (stream
, "$%d",
120 longest_to_int (exp
->elts
[pc
+ 1].longconst
));
125 fprintf_filtered (stream
, "$%s",
126 reg_names
[longest_to_int (exp
->elts
[pc
+ 1].longconst
)]);
131 fprintf_filtered (stream
, "%s",
132 longest_to_int (exp
->elts
[pc
+ 1].longconst
)
138 fprintf_filtered (stream
, "$%s",
139 internalvar_name (exp
->elts
[pc
+ 1].internalvar
));
144 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
145 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
146 fputs_filtered (" (", stream
);
147 for (tem
= 0; tem
< nargs
; tem
++)
150 fputs_filtered (", ", stream
);
151 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
153 fputs_filtered (")", stream
);
157 nargs
= longest_to_int (exp
-> elts
[pc
+ 1].longconst
);
158 (*pos
) += 3 + BYTES_TO_EXP_ELEM (nargs
+ 1);
159 /* LA_PRINT_STRING will print using the current repeat count threshold.
160 If necessary, we can temporarily set it to zero, or pass it as an
161 additional parameter to LA_PRINT_STRING. -fnf */
162 LA_PRINT_STRING (stream
, &exp
->elts
[pc
+ 2].string
, nargs
, 0);
166 error ("support for OP_BITSTRING unimplemented");
171 nargs
= longest_to_int (exp
->elts
[pc
+ 2].longconst
);
172 nargs
-= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
175 if (exp
->elts
[pc
+ 4].opcode
== OP_LONG
176 && exp
->elts
[pc
+ 5].type
== builtin_type_char
177 && exp
->language_defn
->la_language
== language_c
)
179 /* Attempt to print C character arrays using string syntax.
180 Walk through the args, picking up one character from each
181 of the OP_LONG expression elements. If any array element
182 does not match our expection of what we should find for
183 a simple string, revert back to array printing. Note that
184 the last expression element is an explicit null terminator
185 byte, which doesn't get printed. */
186 tempstr
= alloca (nargs
);
190 if (exp
->elts
[pc
].opcode
!= OP_LONG
191 || exp
->elts
[pc
+ 1].type
!= builtin_type_char
)
193 /* Not a simple array of char, use regular array printing. */
200 longest_to_int (exp
->elts
[pc
+ 2].longconst
);
207 LA_PRINT_STRING (stream
, tempstr
, nargs
- 1, 0);
212 int is_chill
= exp
->language_defn
->la_language
== language_chill
;
213 fputs_filtered (is_chill
? " [" : " {", stream
);
214 for (tem
= 0; tem
< nargs
; tem
++)
218 fputs_filtered (", ", stream
);
220 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
222 fputs_filtered (is_chill
? "]" : "}", stream
);
227 tem
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
228 (*pos
) += 3 + BYTES_TO_EXP_ELEM (tem
+ 1);
230 if (exp
->language_defn
->la_language
== language_chill
)
232 fputs_filtered (".", stream
);
233 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
234 fputs_filtered (exp
->elts
[*pos
].opcode
== OP_LABELED
? ", "
240 /* Gcc support both these syntaxes. Unsure which is preferred. */
242 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
243 fputs_filtered (": ", stream
);
245 fputs_filtered (".", stream
);
246 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
247 fputs_filtered ("=", stream
);
250 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
254 if ((int) prec
> (int) PREC_COMMA
)
255 fputs_filtered ("(", stream
);
256 /* Print the subexpressions, forcing parentheses
257 around any binary operations within them.
258 This is more parentheses than are strictly necessary,
259 but it looks clearer. */
260 print_subexp (exp
, pos
, stream
, PREC_HYPER
);
261 fputs_filtered (" ? ", stream
);
262 print_subexp (exp
, pos
, stream
, PREC_HYPER
);
263 fputs_filtered (" : ", stream
);
264 print_subexp (exp
, pos
, stream
, PREC_HYPER
);
265 if ((int) prec
> (int) PREC_COMMA
)
266 fputs_filtered (")", stream
);
269 case STRUCTOP_STRUCT
:
270 tem
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
271 (*pos
) += 3 + BYTES_TO_EXP_ELEM (tem
+ 1);
272 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
273 fputs_filtered (".", stream
);
274 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
277 /* Will not occur for Modula-2 */
279 tem
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
280 (*pos
) += 3 + BYTES_TO_EXP_ELEM (tem
+ 1);
281 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
282 fputs_filtered ("->", stream
);
283 fputs_filtered (&exp
->elts
[pc
+ 2].string
, stream
);
286 case BINOP_SUBSCRIPT
:
287 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
288 fputs_filtered ("[", stream
);
289 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
290 fputs_filtered ("]", stream
);
293 case UNOP_POSTINCREMENT
:
294 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
295 fputs_filtered ("++", stream
);
298 case UNOP_POSTDECREMENT
:
299 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
300 fputs_filtered ("--", stream
);
305 if ((int) prec
> (int) PREC_PREFIX
)
306 fputs_filtered ("(", stream
);
307 fputs_filtered ("(", stream
);
308 type_print (exp
->elts
[pc
+ 1].type
, "", stream
, 0);
309 fputs_filtered (") ", stream
);
310 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
311 if ((int) prec
> (int) PREC_PREFIX
)
312 fputs_filtered (")", stream
);
317 if ((int) prec
> (int) PREC_PREFIX
)
318 fputs_filtered ("(", stream
);
319 if (exp
->elts
[pc
+ 1].type
->code
== TYPE_CODE_FUNC
&&
320 exp
->elts
[pc
+ 3].opcode
== OP_LONG
) {
321 /* We have a minimal symbol fn, probably. It's encoded
322 as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
323 Swallow the OP_LONG (including both its opcodes); ignore
324 its type; print the value in the type of the MEMVAL. */
326 val
= value_at_lazy (exp
->elts
[pc
+ 1].type
,
327 (CORE_ADDR
) exp
->elts
[pc
+ 5].longconst
);
328 value_print (val
, stream
, 0, Val_no_prettyprint
);
330 fputs_filtered ("{", stream
);
331 type_print (exp
->elts
[pc
+ 1].type
, "", stream
, 0);
332 fputs_filtered ("} ", stream
);
333 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
335 if ((int) prec
> (int) PREC_PREFIX
)
336 fputs_filtered (")", stream
);
339 case BINOP_ASSIGN_MODIFY
:
340 opcode
= exp
->elts
[pc
+ 1].opcode
;
342 myprec
= PREC_ASSIGN
;
346 for (tem
= 0; op_print_tab
[tem
].opcode
!= OP_NULL
; tem
++)
347 if (op_print_tab
[tem
].opcode
== opcode
)
349 op_str
= op_print_tab
[tem
].string
;
352 if (op_print_tab
[tem
].opcode
!= opcode
)
353 /* Not found; don't try to keep going because we don't know how
354 to interpret further elements. */
355 error ("Invalid expression");
362 fputs_filtered ("this", stream
);
367 case MULTI_SUBSCRIPT
:
369 nargs
= longest_to_int (exp
->elts
[pc
+ 1].longconst
);
370 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
371 fprintf_unfiltered (stream
, " [");
372 for (tem
= 0; tem
< nargs
; tem
++)
375 fprintf_unfiltered (stream
, ", ");
376 print_subexp (exp
, pos
, stream
, PREC_ABOVE_COMMA
);
378 fprintf_unfiltered (stream
, "]");
383 fprintf_unfiltered(stream
,"VAL(");
384 type_print(exp
->elts
[pc
+1].type
,"",stream
,0);
385 fprintf_unfiltered(stream
,",");
386 print_subexp(exp
,pos
,stream
,PREC_PREFIX
);
387 fprintf_unfiltered(stream
,")");
391 print_simple_m2_func("CAP",exp
,pos
,stream
);
395 print_simple_m2_func("CHR",exp
,pos
,stream
);
399 print_simple_m2_func("ORD",exp
,pos
,stream
);
403 print_simple_m2_func("ABS",exp
,pos
,stream
);
407 print_simple_m2_func("FLOAT",exp
,pos
,stream
);
411 print_simple_m2_func("HIGH",exp
,pos
,stream
);
415 print_simple_m2_func("MAX",exp
,pos
,stream
);
419 print_simple_m2_func("MIN",exp
,pos
,stream
);
423 print_simple_m2_func("ODD",exp
,pos
,stream
);
427 print_simple_m2_func("TRUNC",exp
,pos
,stream
);
432 error("print_subexp: Not implemented.");
438 for (tem
= 0; op_print_tab
[tem
].opcode
!= OP_NULL
; tem
++)
439 if (op_print_tab
[tem
].opcode
== opcode
)
441 op_str
= op_print_tab
[tem
].string
;
442 myprec
= op_print_tab
[tem
].precedence
;
443 assoc
= op_print_tab
[tem
].right_assoc
;
446 if (op_print_tab
[tem
].opcode
!= opcode
)
447 /* Not found; don't try to keep going because we don't know how
448 to interpret further elements. For example, this happens
449 if opcode is OP_TYPE. */
450 error ("Invalid expression");
453 if ((int) myprec
< (int) prec
)
454 fputs_filtered ("(", stream
);
455 if ((int) opcode
> (int) BINOP_END
)
459 /* Unary postfix operator. */
460 print_subexp (exp
, pos
, stream
, PREC_SUFFIX
);
461 fputs_filtered (op_str
, stream
);
465 /* Unary prefix operator. */
466 fputs_filtered (op_str
, stream
);
467 print_subexp (exp
, pos
, stream
, PREC_PREFIX
);
472 /* Binary operator. */
473 /* Print left operand.
474 If operator is right-associative,
475 increment precedence for this operand. */
476 print_subexp (exp
, pos
, stream
,
477 (enum precedence
) ((int) myprec
+ assoc
));
478 /* Print the operator itself. */
480 fprintf_filtered (stream
, " %s= ", op_str
);
481 else if (op_str
[0] == ',')
482 fprintf_filtered (stream
, "%s ", op_str
);
484 fprintf_filtered (stream
, " %s ", op_str
);
485 /* Print right operand.
486 If operator is left-associative,
487 increment precedence for this operand. */
488 print_subexp (exp
, pos
, stream
,
489 (enum precedence
) ((int) myprec
+ !assoc
));
492 if ((int) myprec
< (int) prec
)
493 fputs_filtered (")", stream
);
496 /* Print out something of the form <s>(<arg>).
497 This is used to print out some builtin Modula-2
499 FIXME: There is probably some way to get the precedence
500 rules to do this (print a unary operand with parens around it). */
502 print_simple_m2_func(s
,exp
,pos
,stream
)
504 register struct expression
*exp
;
508 fprintf_unfiltered(stream
,"%s(",s
);
509 print_subexp(exp
,pos
,stream
,PREC_PREFIX
);
510 fprintf_unfiltered(stream
,")");
513 /* Return the operator corresponding to opcode OP as
514 a string. NULL indicates that the opcode was not found in the
515 current language table. */
521 register const struct op_print
*op_print_tab
;
523 op_print_tab
= current_language
->la_op_print_tab
;
524 for (tem
= 0; op_print_tab
[tem
].opcode
!= OP_NULL
; tem
++)
525 if (op_print_tab
[tem
].opcode
== op
)
526 return op_print_tab
[tem
].string
;
530 #ifdef DEBUG_EXPRESSIONS
532 /* Support for dumping the raw data from expressions in a human readable
536 dump_expression (exp
, stream
, note
)
537 struct expression
*exp
;
546 fprintf_filtered (stream
, "Dump of expression @ ");
547 gdb_print_address (exp
, stream
);
548 fprintf_filtered (stream
, ", %s:\n", note
);
549 fprintf_filtered (stream
, "\tLanguage %s, %d elements, %d bytes each.\n",
550 exp
->language_defn
->la_name
, exp
-> nelts
,
551 sizeof (union exp_element
));
552 fprintf_filtered (stream
, "\t%5s %20s %16s %s\n", "Index", "Opcode",
553 "Hex Value", "String Value");
554 for (elt
= 0; elt
< exp
-> nelts
; elt
++)
556 fprintf_filtered (stream
, "\t%5d ", elt
);
557 switch (exp
-> elts
[elt
].opcode
)
559 default: opcode_name
= "<unknown>"; break;
560 case OP_NULL
: opcode_name
= "OP_NULL"; break;
561 case BINOP_ADD
: opcode_name
= "BINOP_ADD"; break;
562 case BINOP_SUB
: opcode_name
= "BINOP_SUB"; break;
563 case BINOP_MUL
: opcode_name
= "BINOP_MUL"; break;
564 case BINOP_DIV
: opcode_name
= "BINOP_DIV"; break;
565 case BINOP_REM
: opcode_name
= "BINOP_REM"; break;
566 case BINOP_MOD
: opcode_name
= "BINOP_MOD"; break;
567 case BINOP_LSH
: opcode_name
= "BINOP_LSH"; break;
568 case BINOP_RSH
: opcode_name
= "BINOP_RSH"; break;
569 case BINOP_LOGICAL_AND
: opcode_name
= "BINOP_LOGICAL_AND"; break;
570 case BINOP_LOGICAL_OR
: opcode_name
= "BINOP_LOGICAL_OR"; break;
571 case BINOP_BITWISE_AND
: opcode_name
= "BINOP_BITWISE_AND"; break;
572 case BINOP_BITWISE_IOR
: opcode_name
= "BINOP_BITWISE_IOR"; break;
573 case BINOP_BITWISE_XOR
: opcode_name
= "BINOP_BITWISE_XOR"; break;
574 case BINOP_EQUAL
: opcode_name
= "BINOP_EQUAL"; break;
575 case BINOP_NOTEQUAL
: opcode_name
= "BINOP_NOTEQUAL"; break;
576 case BINOP_LESS
: opcode_name
= "BINOP_LESS"; break;
577 case BINOP_GTR
: opcode_name
= "BINOP_GTR"; break;
578 case BINOP_LEQ
: opcode_name
= "BINOP_LEQ"; break;
579 case BINOP_GEQ
: opcode_name
= "BINOP_GEQ"; break;
580 case BINOP_REPEAT
: opcode_name
= "BINOP_REPEAT"; break;
581 case BINOP_ASSIGN
: opcode_name
= "BINOP_ASSIGN"; break;
582 case BINOP_COMMA
: opcode_name
= "BINOP_COMMA"; break;
583 case BINOP_SUBSCRIPT
: opcode_name
= "BINOP_SUBSCRIPT"; break;
584 case MULTI_SUBSCRIPT
: opcode_name
= "MULTI_SUBSCRIPT"; break;
585 case BINOP_EXP
: opcode_name
= "BINOP_EXP"; break;
586 case BINOP_MIN
: opcode_name
= "BINOP_MIN"; break;
587 case BINOP_MAX
: opcode_name
= "BINOP_MAX"; break;
588 case BINOP_SCOPE
: opcode_name
= "BINOP_SCOPE"; break;
589 case STRUCTOP_MEMBER
: opcode_name
= "STRUCTOP_MEMBER"; break;
590 case STRUCTOP_MPTR
: opcode_name
= "STRUCTOP_MPTR"; break;
591 case BINOP_INTDIV
: opcode_name
= "BINOP_INTDIV"; break;
592 case BINOP_ASSIGN_MODIFY
: opcode_name
= "BINOP_ASSIGN_MODIFY"; break;
593 case BINOP_VAL
: opcode_name
= "BINOP_VAL"; break;
594 case BINOP_INCL
: opcode_name
= "BINOP_INCL"; break;
595 case BINOP_EXCL
: opcode_name
= "BINOP_EXCL"; break;
596 case BINOP_CONCAT
: opcode_name
= "BINOP_CONCAT"; break;
597 case BINOP_END
: opcode_name
= "BINOP_END"; break;
598 case TERNOP_COND
: opcode_name
= "TERNOP_COND"; break;
599 case OP_LONG
: opcode_name
= "OP_LONG"; break;
600 case OP_DOUBLE
: opcode_name
= "OP_DOUBLE"; break;
601 case OP_VAR_VALUE
: opcode_name
= "OP_VAR_VALUE"; break;
602 case OP_LAST
: opcode_name
= "OP_LAST"; break;
603 case OP_REGISTER
: opcode_name
= "OP_REGISTER"; break;
604 case OP_INTERNALVAR
: opcode_name
= "OP_INTERNALVAR"; break;
605 case OP_FUNCALL
: opcode_name
= "OP_FUNCALL"; break;
606 case OP_STRING
: opcode_name
= "OP_STRING"; break;
607 case OP_BITSTRING
: opcode_name
= "OP_BITSTRING"; break;
608 case OP_ARRAY
: opcode_name
= "OP_ARRAY"; break;
609 case UNOP_CAST
: opcode_name
= "UNOP_CAST"; break;
610 case UNOP_MEMVAL
: opcode_name
= "UNOP_MEMVAL"; break;
611 case UNOP_NEG
: opcode_name
= "UNOP_NEG"; break;
612 case UNOP_LOGICAL_NOT
: opcode_name
= "UNOP_LOGICAL_NOT"; break;
613 case UNOP_COMPLEMENT
: opcode_name
= "UNOP_COMPLEMENT"; break;
614 case UNOP_IND
: opcode_name
= "UNOP_IND"; break;
615 case UNOP_ADDR
: opcode_name
= "UNOP_ADDR"; break;
616 case UNOP_PREINCREMENT
: opcode_name
= "UNOP_PREINCREMENT"; break;
617 case UNOP_POSTINCREMENT
: opcode_name
= "UNOP_POSTINCREMENT"; break;
618 case UNOP_PREDECREMENT
: opcode_name
= "UNOP_PREDECREMENT"; break;
619 case UNOP_POSTDECREMENT
: opcode_name
= "UNOP_POSTDECREMENT"; break;
620 case UNOP_SIZEOF
: opcode_name
= "UNOP_SIZEOF"; break;
621 case UNOP_PLUS
: opcode_name
= "UNOP_PLUS"; break;
622 case UNOP_CAP
: opcode_name
= "UNOP_CAP"; break;
623 case UNOP_CHR
: opcode_name
= "UNOP_CHR"; break;
624 case UNOP_ORD
: opcode_name
= "UNOP_ORD"; break;
625 case UNOP_ABS
: opcode_name
= "UNOP_ABS"; break;
626 case UNOP_FLOAT
: opcode_name
= "UNOP_FLOAT"; break;
627 case UNOP_HIGH
: opcode_name
= "UNOP_HIGH"; break;
628 case UNOP_MAX
: opcode_name
= "UNOP_MAX"; break;
629 case UNOP_MIN
: opcode_name
= "UNOP_MIN"; break;
630 case UNOP_ODD
: opcode_name
= "UNOP_ODD"; break;
631 case UNOP_TRUNC
: opcode_name
= "UNOP_TRUNC"; break;
632 case OP_BOOL
: opcode_name
= "OP_BOOL"; break;
633 case OP_M2_STRING
: opcode_name
= "OP_M2_STRING"; break;
634 case STRUCTOP_STRUCT
: opcode_name
= "STRUCTOP_STRUCT"; break;
635 case STRUCTOP_PTR
: opcode_name
= "STRUCTOP_PTR"; break;
636 case OP_THIS
: opcode_name
= "OP_THIS"; break;
637 case OP_SCOPE
: opcode_name
= "OP_SCOPE"; break;
638 case OP_TYPE
: opcode_name
= "OP_TYPE"; break;
639 case OP_LABELED
: opcode_name
= "OP_LABELED"; break;
641 fprintf_filtered (stream
, "%20s ", opcode_name
);
642 fprintf_filtered (stream
,
643 #if defined (PRINTF_HAS_LONG_LONG)
648 exp
-> elts
[elt
].longconst
);
650 for (eltscan
= (char *) &exp
->elts
[elt
],
651 eltsize
= sizeof (union exp_element
) ;
655 fprintf_filtered (stream
, "%c",
656 isprint (*eltscan
) ? (*eltscan
& 0xFF) : '.');
658 fprintf_filtered (stream
, "\n");
662 #endif /* DEBUG_EXPRESSIONS */
This page took 0.041935 seconds and 4 git commands to generate.