1 /* General utility routines for GDB, the GNU debugger.
2 Copyright 1986, 1989, 1990, 1991, 1992 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. */
22 #include <sys/ioctl.h>
23 #include <sys/param.h>
35 /* Prototypes for local functions */
37 #if !defined (NO_MALLOC_CHECK)
39 malloc_botch
PARAMS ((void));
40 #endif /* NO_MALLOC_CHECK */
43 fatal_dump_core (); /* Can't prototype with <varargs.h> usage... */
46 prompt_for_continue
PARAMS ((void));
49 set_width_command
PARAMS ((char *, int, struct cmd_list_element
*));
52 vfprintf_filtered
PARAMS ((FILE *, char *, va_list));
54 /* If this definition isn't overridden by the header files, assume
55 that isatty and fileno exist on this system. */
57 #define ISATTY(FP) (isatty (fileno (FP)))
60 /* Chain of cleanup actions established with make_cleanup,
61 to be executed if an error happens. */
63 static struct cleanup
*cleanup_chain
;
65 /* Nonzero means a quit has been requested. */
69 /* Nonzero means quit immediately if Control-C is typed now,
70 rather than waiting until QUIT is executed. */
74 /* Nonzero means that encoded C++ names should be printed out in their
75 C++ form rather than raw. */
79 /* Nonzero means that encoded C++ names should be printed out in their
80 C++ form even in assembler language displays. If this is set, but
81 DEMANGLE is zero, names are printed raw, i.e. DEMANGLE controls. */
85 /* Nonzero means that strings with character values >0x7F should be printed
86 as octal escapes. Zero means just print the value (e.g. it's an
87 international character, and the terminal or window can cope.) */
89 int sevenbit_strings
= 0;
91 /* String to be printed before error messages, if any. */
93 char *error_pre_print
;
94 char *warning_pre_print
;
96 /* Add a new cleanup to the cleanup_chain,
97 and return the previous chain pointer
98 to be passed later to do_cleanups or discard_cleanups.
99 Args are FUNCTION to clean up with, and ARG to pass to it. */
102 make_cleanup (function
, arg
)
103 void (*function
) PARAMS ((PTR
));
106 register struct cleanup
*new
107 = (struct cleanup
*) xmalloc (sizeof (struct cleanup
));
108 register struct cleanup
*old_chain
= cleanup_chain
;
110 new->next
= cleanup_chain
;
111 new->function
= function
;
118 /* Discard cleanups and do the actions they describe
119 until we get back to the point OLD_CHAIN in the cleanup_chain. */
122 do_cleanups (old_chain
)
123 register struct cleanup
*old_chain
;
125 register struct cleanup
*ptr
;
126 while ((ptr
= cleanup_chain
) != old_chain
)
128 cleanup_chain
= ptr
->next
; /* Do this first incase recursion */
129 (*ptr
->function
) (ptr
->arg
);
134 /* Discard cleanups, not doing the actions they describe,
135 until we get back to the point OLD_CHAIN in the cleanup_chain. */
138 discard_cleanups (old_chain
)
139 register struct cleanup
*old_chain
;
141 register struct cleanup
*ptr
;
142 while ((ptr
= cleanup_chain
) != old_chain
)
144 cleanup_chain
= ptr
->next
;
149 /* Set the cleanup_chain to 0, and return the old cleanup chain. */
153 struct cleanup
*old_chain
= cleanup_chain
;
159 /* Restore the cleanup chain from a previously saved chain. */
161 restore_cleanups (chain
)
162 struct cleanup
*chain
;
164 cleanup_chain
= chain
;
167 /* This function is useful for cleanups.
171 old_chain = make_cleanup (free_current_contents, &foo);
173 to arrange to free the object thus allocated. */
176 free_current_contents (location
)
182 /* Provide a known function that does nothing, to use as a base for
183 for a possibly long chain of cleanups. This is useful where we
184 use the cleanup chain for handling normal cleanups as well as dealing
185 with cleanups that need to be done as a result of a call to error().
186 In such cases, we may not be certain where the first cleanup is, unless
187 we have a do-nothing one to always use as the base. */
197 /* Provide a hook for modules wishing to print their own warning messages
198 to set up the terminal state in a compatible way, without them having
199 to import all the target_<...> macros. */
204 target_terminal_ours ();
205 wrap_here(""); /* Force out any buffered output */
209 /* Print a warning message.
210 The first argument STRING is the warning message, used as a fprintf string,
211 and the remaining args are passed as arguments to it.
212 The primary difference between warnings and errors is that a warning
213 does not force the return to command level. */
224 target_terminal_ours ();
225 wrap_here(""); /* Force out any buffered output */
227 if (warning_pre_print
)
228 fprintf (stderr
, warning_pre_print
);
229 string
= va_arg (args
, char *);
230 vfprintf (stderr
, string
, args
);
231 fprintf (stderr
, "\n");
235 /* Print an error message and return to command level.
236 The first argument STRING is the error message, used as a fprintf string,
237 and the remaining args are passed as arguments to it. */
248 target_terminal_ours ();
249 wrap_here(""); /* Force out any buffered output */
252 fprintf (stderr
, error_pre_print
);
253 string
= va_arg (args
, char *);
254 vfprintf (stderr
, string
, args
);
255 fprintf (stderr
, "\n");
257 return_to_top_level ();
260 /* Print an error message and exit reporting failure.
261 This is for a error that we cannot continue from.
262 The arguments are printed a la printf.
264 This function cannot be declared volatile (NORETURN) in an
265 ANSI environment because exit() is not declared volatile. */
276 string
= va_arg (args
, char *);
277 fprintf (stderr
, "gdb: ");
278 vfprintf (stderr
, string
, args
);
279 fprintf (stderr
, "\n");
284 /* Print an error message and exit, dumping core.
285 The arguments are printed a la printf (). */
289 fatal_dump_core (va_alist
)
296 string
= va_arg (args
, char *);
297 /* "internal error" is always correct, since GDB should never dump
298 core, no matter what the input. */
299 fprintf (stderr
, "gdb internal error: ");
300 vfprintf (stderr
, string
, args
);
301 fprintf (stderr
, "\n");
304 signal (SIGQUIT
, SIG_DFL
);
305 kill (getpid (), SIGQUIT
);
306 /* We should never get here, but just in case... */
311 /* Memory management stuff (malloc friends). */
313 #if defined (NO_MALLOC_CHECK)
317 #else /* Have mcheck(). */
321 fatal_dump_core ("Memory corruption");
327 extern PTR (*__morecore
) PARAMS ((long));
329 mcheck (malloc_botch
);
332 #endif /* Have mcheck(). */
334 /* Like malloc but get error if no storage available. */
342 /* Protect against gdb wanting to allocate zero bytes. */
346 val
= (char *) malloc (size
);
348 fatal ("virtual memory exhausted.", 0);
352 /* Like realloc but get error if no storage available. */
360 ptr
? (char *) realloc (ptr
, size
) : (char*) malloc (size
);
362 fatal ("virtual memory exhausted.", 0);
366 /* Print the system error message for errno, and also mention STRING
367 as the file name for which the error was encountered.
368 Then return to command level. */
371 perror_with_name (string
)
375 extern char *sys_errlist
[];
379 if (errno
< sys_nerr
)
380 err
= sys_errlist
[errno
];
382 err
= "unknown error";
384 combined
= (char *) alloca (strlen (err
) + strlen (string
) + 3);
385 strcpy (combined
, string
);
386 strcat (combined
, ": ");
387 strcat (combined
, err
);
389 /* I understand setting these is a matter of taste. Still, some people
390 may clear errno but not know about bfd_error. Doing this here is not
392 bfd_error
= no_error
;
395 error ("%s.", combined
);
398 /* Print the system error message for ERRCODE, and also mention STRING
399 as the file name for which the error was encountered. */
402 print_sys_errmsg (string
, errcode
)
407 extern char *sys_errlist
[];
411 if (errcode
< sys_nerr
)
412 err
= sys_errlist
[errcode
];
414 err
= "unknown error";
416 combined
= (char *) alloca (strlen (err
) + strlen (string
) + 3);
417 strcpy (combined
, string
);
418 strcat (combined
, ": ");
419 strcat (combined
, err
);
421 printf ("%s.\n", combined
);
424 /* Control C eventually causes this to be called, at a convenient time. */
429 target_terminal_ours ();
430 wrap_here ((char *)0); /* Force out any pending output */
432 ioctl (fileno (stdout
), TCFLSH
, 1);
433 #else /* not HAVE_TERMIO */
434 ioctl (fileno (stdout
), TIOCFLUSH
, 0);
435 #endif /* not HAVE_TERMIO */
439 error ("Quit (expect signal %d when inferior is resumed)", SIGINT
);
440 #endif /* TIOCGPGRP */
443 /* Control C comes here */
452 /* Restore the signal handler. */
453 signal (signo
, request_quit
);
460 /* My replacement for the read system call.
461 Used like `read' but keeps going if `read' returns too soon. */
464 myread (desc
, addr
, len
)
474 val
= read (desc
, addr
, len
);
485 /* Make a copy of the string at PTR with SIZE characters
486 (and add a null character at the end in the copy).
487 Uses malloc to get the space. Returns the address of the copy. */
490 savestring (ptr
, size
)
494 register char *p
= (char *) xmalloc (size
+ 1);
495 bcopy (ptr
, p
, size
);
500 /* The "const" is so it compiles under DGUX (which prototypes strsave
501 in <string.h>. FIXME: This should be named "xstrsave", shouldn't it?
502 Doesn't real strsave return NULL if out of memory? */
507 return savestring (ptr
, strlen (ptr
));
511 print_spaces (n
, file
)
519 /* Ask user a y-or-n question and return 1 iff answer is yes.
520 Takes three args which are given to printf to print the question.
521 The first, a control string, should end in "? ".
522 It should not say how to answer, because we do that. */
534 /* Automatically answer "yes" if input is not from a terminal. */
535 if (!input_from_terminal_p ())
541 ctlstr
= va_arg (args
, char *);
542 vfprintf (stdout
, ctlstr
, args
);
544 printf ("(y or n) ");
546 answer
= fgetc (stdin
);
547 clearerr (stdin
); /* in case of C-d */
548 if (answer
== EOF
) /* C-d */
550 if (answer
!= '\n') /* Eat rest of input line, to EOF or newline */
553 ans2
= fgetc (stdin
);
556 while (ans2
!= EOF
&& ans2
!= '\n');
563 printf ("Please answer y or n.\n");
568 /* Parse a C escape sequence. STRING_PTR points to a variable
569 containing a pointer to the string to parse. That pointer
570 should point to the character after the \. That pointer
571 is updated past the characters we use. The value of the
572 escape sequence is returned.
574 A negative value means the sequence \ newline was seen,
575 which is supposed to be equivalent to nothing at all.
577 If \ is followed by a null character, we return a negative
578 value and leave the string pointer pointing at the null character.
580 If \ is followed by 000, we return 0 and leave the string pointer
581 after the zeros. A value of 0 does not mean end of string. */
584 parse_escape (string_ptr
)
587 register int c
= *(*string_ptr
)++;
591 return 007; /* Bell (alert) char */
594 case 'e': /* Escape character */
612 c
= *(*string_ptr
)++;
614 c
= parse_escape (string_ptr
);
617 return (c
& 0200) | (c
& 037);
628 register int i
= c
- '0';
629 register int count
= 0;
632 if ((c
= *(*string_ptr
)++) >= '0' && c
<= '7')
650 /* Print the character C on STREAM as part of the contents
651 of a literal string whose delimiter is QUOTER. */
654 printchar (c
, stream
, quoter
)
660 if (c
< 040 || (sevenbit_strings
&& c
>= 0177)) {
664 fputs_filtered ("\\n", stream
);
667 fputs_filtered ("\\b", stream
);
670 fputs_filtered ("\\t", stream
);
673 fputs_filtered ("\\f", stream
);
676 fputs_filtered ("\\r", stream
);
679 fputs_filtered ("\\e", stream
);
682 fputs_filtered ("\\a", stream
);
685 fprintf_filtered (stream
, "\\%.3o", (unsigned int) c
);
689 if (c
== '\\' || c
== quoter
)
690 fputs_filtered ("\\", stream
);
691 fprintf_filtered (stream
, "%c", c
);
695 /* Number of lines per page or UINT_MAX if paging is disabled. */
696 static unsigned int lines_per_page
;
697 /* Number of chars per line or UNIT_MAX is line folding is disabled. */
698 static unsigned int chars_per_line
;
699 /* Current count of lines printed on this page, chars on this line. */
700 static unsigned int lines_printed
, chars_printed
;
702 /* Buffer and start column of buffered text, for doing smarter word-
703 wrapping. When someone calls wrap_here(), we start buffering output
704 that comes through fputs_filtered(). If we see a newline, we just
705 spit it out and forget about the wrap_here(). If we see another
706 wrap_here(), we spit it out and remember the newer one. If we see
707 the end of the line, we spit out a newline, the indent, and then
710 wrap_column is the column number on the screen where wrap_buffer begins.
711 When wrap_column is zero, wrapping is not in effect.
712 wrap_buffer is malloc'd with chars_per_line+2 bytes.
713 When wrap_buffer[0] is null, the buffer is empty.
714 wrap_pointer points into it at the next character to fill.
715 wrap_indent is the string that should be used as indentation if the
718 static char *wrap_buffer
, *wrap_pointer
, *wrap_indent
;
719 static int wrap_column
;
723 set_width_command (args
, from_tty
, c
)
726 struct cmd_list_element
*c
;
730 wrap_buffer
= (char *) xmalloc (chars_per_line
+ 2);
731 wrap_buffer
[0] = '\0';
734 wrap_buffer
= (char *) xrealloc (wrap_buffer
, chars_per_line
+ 2);
735 wrap_pointer
= wrap_buffer
; /* Start it at the beginning */
739 prompt_for_continue ()
744 ignore
= gdb_readline ("---Type <return> to continue---");
747 chars_printed
= lines_printed
= 0;
749 dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
752 /* Reinitialize filter; ie. tell it to reset to original values. */
755 reinitialize_more_filter ()
761 /* Indicate that if the next sequence of characters overflows the line,
762 a newline should be inserted here rather than when it hits the end.
763 If INDENT is nonzero, it is a string to be printed to indent the
764 wrapped part on the next line. INDENT must remain accessible until
765 the next call to wrap_here() or until a newline is printed through
768 If the line is already overfull, we immediately print a newline and
769 the indentation, and disable further wrapping.
771 If we don't know the width of lines, but we know the page height,
772 we must not wrap words, but should still keep track of newlines
773 that were explicitly printed.
775 INDENT should not contain tabs, as that
776 will mess up the char count on the next line. FIXME. */
784 *wrap_pointer
= '\0';
785 fputs (wrap_buffer
, stdout
);
787 wrap_pointer
= wrap_buffer
;
788 wrap_buffer
[0] = '\0';
789 if (chars_per_line
== UINT_MAX
) /* No line overflow checking */
793 else if (chars_printed
>= chars_per_line
)
795 puts_filtered ("\n");
796 puts_filtered (indent
);
801 wrap_column
= chars_printed
;
802 wrap_indent
= indent
;
806 /* Like fputs but pause after every screenful, and can wrap at points
807 other than the final character of a line.
808 Unlike fputs, fputs_filtered does not return a value.
809 It is OK for LINEBUFFER to be NULL, in which case just don't print
812 Note that a longjmp to top level may occur in this routine
813 (since prompt_for_continue may do so) so this routine should not be
814 called when cleanups are not in place. */
817 fputs_filtered (linebuffer
, stream
)
818 const char *linebuffer
;
826 /* Don't do any filtering if it is disabled. */
828 || (lines_per_page
== UINT_MAX
&& chars_per_line
== UINT_MAX
))
830 fputs (linebuffer
, stream
);
834 /* Go through and output each character. Show line extension
835 when this is necessary; prompt user for new page when this is
838 lineptr
= linebuffer
;
841 /* Possible new page. */
842 if (lines_printed
>= lines_per_page
- 1)
843 prompt_for_continue ();
845 while (*lineptr
&& *lineptr
!= '\n')
847 /* Print a single line. */
848 if (*lineptr
== '\t')
851 *wrap_pointer
++ = '\t';
854 /* Shifting right by 3 produces the number of tab stops
855 we have already passed, and then adding one and
856 shifting left 3 advances to the next tab stop. */
857 chars_printed
= ((chars_printed
>> 3) + 1) << 3;
863 *wrap_pointer
++ = *lineptr
;
865 putc (*lineptr
, stream
);
870 if (chars_printed
>= chars_per_line
)
872 unsigned int save_chars
= chars_printed
;
876 /* If we aren't actually wrapping, don't output newline --
877 if chars_per_line is right, we probably just overflowed
878 anyway; if it's wrong, let us keep going. */
882 /* Possible new page. */
883 if (lines_printed
>= lines_per_page
- 1)
884 prompt_for_continue ();
886 /* Now output indentation and wrapped string */
890 fputs (wrap_indent
, stream
);
891 *wrap_pointer
= '\0'; /* Null-terminate saved stuff */
892 fputs (wrap_buffer
, stream
); /* and eject it */
893 /* FIXME, this strlen is what prevents wrap_indent from
894 containing tabs. However, if we recurse to print it
895 and count its chars, we risk trouble if wrap_indent is
896 longer than (the user settable) chars_per_line.
897 Note also that this can set chars_printed > chars_per_line
898 if we are printing a long string. */
899 chars_printed
= strlen (wrap_indent
)
900 + (save_chars
- wrap_column
);
901 wrap_pointer
= wrap_buffer
; /* Reset buffer */
902 wrap_buffer
[0] = '\0';
903 wrap_column
= 0; /* And disable fancy wrap */
908 if (*lineptr
== '\n')
911 wrap_here ((char *)0); /* Spit out chars, cancel further wraps */
920 /* fputs_demangled is a variant of fputs_filtered that
921 demangles g++ names.*/
924 fputs_demangled (linebuffer
, stream
, arg_mode
)
929 #define SYMBOL_MAX 1024
931 #define SYMBOL_CHAR(c) (isascii(c) \
932 && (isalnum(c) || (c) == '_' || (c) == CPLUS_MARKER))
934 char buf
[SYMBOL_MAX
+1];
935 # define SLOP 5 /* How much room to leave in buf */
938 if (linebuffer
== NULL
)
941 /* If user wants to see raw output, no problem. */
943 fputs_filtered (linebuffer
, stream
);
949 while ( *p
!= (char) 0 ) {
952 /* collect non-interesting characters into buf */
953 while ( *p
!= (char) 0 && !SYMBOL_CHAR(*p
) && i
< (int)sizeof(buf
)-SLOP
) {
958 /* output the non-interesting characters without demangling */
960 fputs_filtered(buf
, stream
);
961 i
= 0; /* reset buf */
964 /* and now the interesting characters */
965 while (i
< SYMBOL_MAX
968 && i
< (int)sizeof(buf
) - SLOP
) {
976 if ( (result
= cplus_demangle(buf
, arg_mode
)) != NULL
) {
977 fputs_filtered(result
, stream
);
981 fputs_filtered(buf
, stream
);
987 /* Print a variable number of ARGS using format FORMAT. If this
988 information is going to put the amount written (since the last call
989 to INITIALIZE_MORE_FILTER or the last page break) over the page size,
990 print out a pause message and do a gdb_readline to get the users
991 permision to continue.
993 Unlike fprintf, this function does not return a value.
995 We implement three variants, vfprintf (takes a vararg list and stream),
996 fprintf (takes a stream to write on), and printf (the usual).
998 Note that this routine has a restriction that the length of the
999 final output line must be less than 255 characters *or* it must be
1000 less than twice the size of the format string. This is a very
1001 arbitrary restriction, but it is an internal restriction, so I'll
1002 put it in. This means that the %s format specifier is almost
1003 useless; unless the caller can GUARANTEE that the string is short
1004 enough, fputs_filtered should be used instead.
1006 Note also that a longjmp to top level may occur in this routine
1007 (since prompt_for_continue may do so) so this routine should not be
1008 called when cleanups are not in place. */
1011 vfprintf_filtered (stream
, format
, args
)
1016 static char *linebuffer
= (char *) 0;
1017 static int line_size
;
1020 format_length
= strlen (format
);
1022 /* Allocated linebuffer for the first time. */
1025 linebuffer
= (char *) xmalloc (255);
1029 /* Reallocate buffer to a larger size if this is necessary. */
1030 if (format_length
* 2 > line_size
)
1032 line_size
= format_length
* 2;
1034 /* You don't have to copy. */
1036 linebuffer
= (char *) xmalloc (line_size
);
1040 /* This won't blow up if the restrictions described above are
1042 (void) vsprintf (linebuffer
, format
, args
);
1044 fputs_filtered (linebuffer
, stream
);
1049 fprintf_filtered (va_alist
)
1057 stream
= va_arg (args
, FILE *);
1058 format
= va_arg (args
, char *);
1060 /* This won't blow up if the restrictions described above are
1062 vfprintf_filtered (stream
, format
, args
);
1068 printf_filtered (va_alist
)
1075 format
= va_arg (args
, char *);
1077 vfprintf_filtered (stdout
, format
, args
);
1084 puts_filtered (string
)
1087 fputs_filtered (string
, stdout
);
1090 /* Return a pointer to N spaces and a null. The pointer is good
1091 until the next call to here. */
1097 static char *spaces
;
1098 static int max_spaces
;
1104 spaces
= (char *) malloc (n
+1);
1105 for (t
= spaces
+n
; t
!= spaces
;)
1111 return spaces
+ max_spaces
- n
;
1114 /* Print N spaces. */
1116 print_spaces_filtered (n
, stream
)
1120 fputs_filtered (n_spaces (n
), stream
);
1123 /* C++ demangler stuff. */
1125 /* Print NAME on STREAM, demangling if necessary. */
1127 fprint_symbol (stream
, name
)
1132 if ((!demangle
) || NULL
== (demangled
= cplus_demangle (name
, 1)))
1133 fputs_filtered (name
, stream
);
1136 fputs_filtered (demangled
, stream
);
1142 _initialize_utils ()
1144 struct cmd_list_element
*c
;
1146 c
= add_set_cmd ("width", class_support
, var_uinteger
,
1147 (char *)&chars_per_line
,
1148 "Set number of characters gdb thinks are in a line.",
1150 add_show_from_set (c
, &showlist
);
1151 c
->function
.sfunc
= set_width_command
;
1154 (add_set_cmd ("height", class_support
,
1155 var_uinteger
, (char *)&lines_per_page
,
1156 "Set number of lines gdb thinks are in a page.", &setlist
),
1159 /* These defaults will be used if we are unable to get the correct
1160 values from termcap. */
1161 lines_per_page
= 24;
1162 chars_per_line
= 80;
1163 /* Initialize the screen height and width from termcap. */
1165 char *termtype
= getenv ("TERM");
1167 /* Positive means success, nonpositive means failure. */
1170 /* 2048 is large enough for all known terminals, according to the
1171 GNU termcap manual. */
1172 char term_buffer
[2048];
1176 status
= tgetent (term_buffer
, termtype
);
1181 val
= tgetnum ("li");
1183 lines_per_page
= val
;
1185 /* The number of lines per page is not mentioned
1186 in the terminal description. This probably means
1187 that paging is not useful (e.g. emacs shell window),
1188 so disable paging. */
1189 lines_per_page
= UINT_MAX
;
1191 val
= tgetnum ("co");
1193 chars_per_line
= val
;
1198 /* If the output is not a terminal, don't paginate it. */
1199 if (!ISATTY (stdout
))
1200 lines_per_page
= UINT_MAX
;
1202 set_width_command ((char *)NULL
, 0, c
);
1205 (add_set_cmd ("demangle", class_support
, var_boolean
,
1207 "Set demangling of encoded C++ names when displaying symbols.",
1212 (add_set_cmd ("sevenbit-strings", class_support
, var_boolean
,
1213 (char *)&sevenbit_strings
,
1214 "Set printing of 8-bit characters in strings as \\nnn.",
1219 (add_set_cmd ("asm-demangle", class_support
, var_boolean
,
1220 (char *)&asm_demangle
,
1221 "Set demangling of C++ names in disassembly listings.",
This page took 0.053241 seconds and 4 git commands to generate.