* hppa.c: add symbol_leading_char entry in transfer vec
[deliverable/binutils-gdb.git] / bfd / hppa.c
1 /* bfd back-end for HP PA-RISC SOM objects.
2 Copyright (C) 1990-1991 Free Software Foundation, Inc.
3
4 Contributed by the Center for Software Science at the
5 University of Utah (pa-gdb-bugs@cs.utah.edu).
6
7 This file is part of BFD, the Binary File Descriptor library.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
22
23 #ifdef hp9000s800
24
25 #include <sysdep.h>
26 #include "bfd.h"
27 #include "libbfd.h"
28 #include "libhppa.h"
29
30 /* #include "aout/hppa.h" */
31
32 #include <stdio.h>
33 #include <sys/types.h>
34 #include <sys/param.h>
35 #include <sys/dir.h>
36 #include <signal.h>
37 #include <machine/reg.h>
38 #ifndef hpux
39 #include <aout/hppa.h>
40 #include <machine/pcb.h>
41 #include <sys/time.h>
42 #include <hpux/hpux.h>
43 #define USRSTACK 0x68FF3000
44 #else
45 #include <sys/user.h> /* After a.out.h */
46 #endif
47 #include <sys/file.h>
48 #include <errno.h>
49
50 struct container {
51 struct header f;
52 struct som_exec_auxhdr e;
53 };
54
55 #undef USIZE
56 #undef UPAGES
57
58 #define USIZE 3
59 #define UPAGES 7
60
61 void
62 fill_spaces(abfd, file_hdr, dbx_subspace, dbx_strings_subspace)
63 bfd *abfd;
64 struct header *file_hdr;
65 struct subspace_dictionary_record *dbx_subspace, *dbx_strings_subspace;
66 {
67 char *space_strings = (char *) alloca (file_hdr->space_strings_size);
68 int i;
69 /* for millicode games. */
70 struct space_dictionary_record space;
71 struct subspace_dictionary_record subspace;
72 int index;
73 /* indices of subspace entries for $TEXT$ and $GDB_DEBUG$ */
74 int text_index = 0, gdb_debug_index = 0;
75
76 /* initialize in case we don't find any dbx symbols. */
77 dbx_subspace->subspace_length = dbx_strings_subspace->subspace_length = 0;
78 bfd_seek (abfd, file_hdr->space_strings_location, SEEK_SET);
79 if (bfd_read ((PTR) space_strings, 1, file_hdr->space_strings_size, abfd)
80 != file_hdr->space_strings_size)
81 {
82 bfd_error = wrong_format; /* space strings table corrupted. */
83 return;
84 }
85 bfd_seek (abfd, file_hdr->space_location, SEEK_SET);
86 for (i = 0; i < file_hdr->space_total; i++)
87 {
88 bfd_read ((PTR) &space, 1, sizeof(space), abfd);
89 index = (file_hdr->subspace_location +
90 (space.subspace_index * sizeof(subspace)));
91 if (!strcmp (space_strings + space.name.n_strx, "$TEXT$"))
92 text_index = index;
93 else if (!strcmp (space_strings + space.name.n_strx, "$GDB_DEBUG$"))
94 gdb_debug_index = index;
95 }
96 /* search out the beginning and end if millicode */
97 bfd_seek (abfd, text_index, SEEK_SET);
98 for (;;)
99 {
100 bfd_read ((PTR) &subspace, 1, sizeof(subspace), abfd);
101 if (!strcmp (space_strings + subspace.name.n_strx, "$MILLICODE$"))
102 {
103 millicode_start = subspace.subspace_start;
104 millicode_end = (millicode_start + subspace.subspace_length);
105 break;
106 }
107 }
108 /* read symbols subspace and strings subspace in possibly arbitrary
109 order. */
110 bfd_seek (abfd, gdb_debug_index, SEEK_SET);
111 bfd_read ((PTR) &subspace, 1, sizeof(struct subspace_dictionary_record),
112 abfd);
113 if (!strcmp (space_strings + subspace.name.n_strx, "$GDB_STRINGS$"))
114 {
115 *dbx_strings_subspace = subspace;
116 bfd_read ((PTR) dbx_subspace, 1,
117 sizeof(struct subspace_dictionary_record), abfd);
118 }
119 else
120 {
121 *dbx_subspace = subspace;
122 bfd_read ((PTR) dbx_strings_subspace, 1,
123 sizeof(struct subspace_dictionary_record), abfd);
124 }
125 }
126
127 bfd_target *
128 DEFUN(hppa_object_setup,(abfd, file_hdrp, aux_hdrp, dbx_subspace,
129 dbx_strings_subspace),
130 bfd *abfd AND
131 struct header *file_hdrp AND
132 struct som_exec_auxhdr *aux_hdrp AND
133 struct subspace_dictionary_record *dbx_subspace AND
134 struct subspace_dictionary_record *dbx_strings_subspace)
135 {
136 struct container *rawptr;
137 struct header *f;
138 struct hppa_data_struct *rawptr1;
139
140 rawptr = (struct container *) bfd_zalloc (abfd, sizeof (struct container));
141 if (rawptr == NULL) {
142 bfd_error = no_memory;
143 return 0;
144 }
145
146 rawptr1 = (struct hppa_data_struct *) bfd_zalloc (abfd, sizeof (struct hppa_data_struct));
147 if (rawptr1 == NULL) {
148 bfd_error = no_memory;
149 return 0;
150 }
151
152 abfd->tdata.hppa_data = rawptr1;
153 obj_file_hdr (abfd) = &rawptr->f;
154 obj_aux_hdr (abfd) = &rawptr->e;
155 *obj_file_hdr (abfd) = *file_hdrp;
156 *obj_aux_hdr (abfd) = *aux_hdrp;
157
158 /* Set the file flags */
159 abfd->flags = NO_FLAGS;
160 if (file_hdrp->entry_offset)
161 abfd->flags |= HAS_RELOC;
162 if (file_hdrp->symbol_total)
163 abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
164
165 bfd_get_start_address (abfd) = aux_hdrp->exec_entry;
166
167 obj_hp_symbol_entry_size (abfd) = sizeof(struct symbol_dictionary_record);
168 obj_dbx_symbol_entry_size (abfd) = 12;
169
170 obj_pa_symbols (abfd) = (hppa_symbol_type *)NULL;
171 obj_hp_sym_count (abfd) = file_hdrp->symbol_total;
172 obj_dbx_sym_count (abfd) = dbx_subspace->subspace_length /
173 obj_dbx_symbol_entry_size (abfd);
174 bfd_get_symcount (abfd) = obj_hp_sym_count (abfd) + obj_dbx_sym_count (abfd);
175
176 bfd_default_set_arch_mach(abfd, bfd_arch_hppa, 0);
177
178 /* create the sections. This is raunchy, but bfd_close wants to reclaim
179 them */
180 obj_textsec (abfd) = (asection *)NULL;
181 obj_datasec (abfd) = (asection *)NULL;
182 obj_bsssec (abfd) = (asection *)NULL;
183 (void)bfd_make_section(abfd, ".text");
184 (void)bfd_make_section(abfd, ".data");
185 (void)bfd_make_section(abfd, ".bss");
186
187 abfd->sections = obj_textsec (abfd);
188 obj_textsec (abfd)->next = obj_datasec (abfd);
189 obj_datasec (abfd)->next = obj_bsssec (abfd);
190
191 obj_datasec (abfd)->_raw_size = aux_hdrp->exec_dsize;
192 obj_bsssec (abfd)->_raw_size = aux_hdrp->exec_bsize;
193 obj_textsec (abfd)->_raw_size = aux_hdrp->exec_tsize;
194
195 obj_textsec (abfd)->flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS);
196 obj_datasec (abfd)->flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS);
197 obj_bsssec (abfd)->flags = SEC_ALLOC;
198
199 /* The virtual memory addresses of the sections */
200 obj_datasec (abfd)->vma = aux_hdrp->exec_dmem;
201 obj_bsssec (abfd)->vma = aux_hdrp->exec_bfill;
202 obj_textsec (abfd)->vma = aux_hdrp->exec_tmem;
203
204 /* The file offsets of the sections */
205 obj_textsec (abfd)->filepos = aux_hdrp->exec_tfile;
206 obj_datasec (abfd)->filepos = aux_hdrp->exec_dfile;
207
208 /* The file offsets of the relocation info */
209 obj_textsec (abfd)->rel_filepos = 0;
210 obj_datasec (abfd)->rel_filepos = 0;
211
212 /* The file offsets of the string table and symbol table. */
213 obj_hp_sym_filepos (abfd) = file_hdrp->symbol_location;
214 obj_hp_str_filepos (abfd) = file_hdrp->symbol_strings_location;
215 obj_dbx_sym_filepos (abfd) = dbx_subspace->file_loc_init_value;
216 obj_dbx_str_filepos (abfd) = dbx_strings_subspace->file_loc_init_value;
217 obj_hp_stringtab_size (abfd) = file_hdrp->symbol_strings_size;
218 obj_dbx_stringtab_size (abfd) = dbx_strings_subspace->subspace_length;
219
220 return abfd->xvec;
221 }
222
223 bfd_target *
224 DEFUN(hppa_object_p,(abfd),
225 bfd *abfd)
226 {
227 struct header file_hdr;
228 struct som_exec_auxhdr aux_hdr;
229 struct subspace_dictionary_record dbx_subspace;
230 struct subspace_dictionary_record dbx_strings_subspace;
231
232 if (bfd_read ((PTR) &file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE)
233 {
234 bfd_error = wrong_format;
235 return 0;
236 }
237 if (bfd_read ((PTR) &aux_hdr, 1, AUX_HDR_SIZE, abfd) != AUX_HDR_SIZE)
238 {
239 bfd_error = wrong_format;
240 return 0;
241 }
242
243 fill_spaces(abfd, &file_hdr, &dbx_subspace, &dbx_strings_subspace);
244
245 return hppa_object_setup(abfd, &file_hdr, &aux_hdr, &dbx_subspace, &dbx_strings_subspace);
246 }
247
248
249 static boolean
250 DEFUN(hppa_mkobject,(abfd),
251 bfd *abfd)
252 {
253 fprintf (stderr, "hppa_mkobject unimplemented\n");
254 fflush (stderr);
255 abort ();
256 return (false);
257 }
258
259 boolean
260 DEFUN(hppa_write_object_contents,(abfd),
261 bfd *abfd)
262 {
263 fprintf (stderr, "hppa_write_object_contents unimplemented\n");
264 fflush (stderr);
265 abort ();
266 return (false);
267 }
268
269
270
271 unsigned int
272 DEFUN(hppa_get_symtab_upper_bound,(abfd),
273 bfd *abfd)
274 {
275 fprintf (stderr, "hppa_get_symtab_upper_bound unimplemented\n");
276 fflush (stderr);
277 abort ();
278 return (0);
279 }
280
281 unsigned int
282 DEFUN(hppa_get_reloc_upper_bound,(abfd, asect),
283 bfd *abfd AND
284 sec_ptr asect)
285 {
286 fprintf (stderr, "hppa_get_reloc_upper_bound unimplemented\n");
287 fflush (stderr);
288 abort ();
289 return (0);
290 }
291
292 unsigned int
293 DEFUN(hppa_canonicalize_reloc,(abfd, section, relptr, symbols),
294 bfd *abfd AND
295 sec_ptr section AND
296 arelent **relptr AND
297 asymbol **symbols)
298 {
299 fprintf (stderr, "hppa_canonicalize_reloc unimplemented\n");
300 fflush (stderr);
301 abort ();
302 }
303
304 extern bfd_target hppa_vec;
305 unsigned int
306 DEFUN(hppa_get_symtab,(abfd, location),
307 bfd *abfd AND
308 asymbol **location)
309 {
310 fprintf (stderr, "hppa_get_symtab unimplemented\n");
311 fflush (stderr);
312 abort ();
313 return (0);
314 }
315
316 asymbol *
317 DEFUN(hppa_make_empty_symbol,(abfd),
318 bfd *abfd)
319 {
320 hppa_symbol_type *new =
321 (hppa_symbol_type *)bfd_zalloc (abfd, sizeof (hppa_symbol_type));
322 new->symbol.the_bfd = abfd;
323
324 return &new->symbol;
325 }
326
327
328 void
329 DEFUN(hppa_print_symbol,(ignore_abfd, afile, symbol, how),
330 bfd *ignore_abfd AND
331 PTR afile AND
332 asymbol *symbol AND
333 bfd_print_symbol_type how)
334 {
335 fprintf (stderr, "hppa_print_symbol unimplemented\n");
336 fflush (stderr);
337 abort ();
338 }
339
340
341
342 boolean
343 DEFUN(hppa_new_section_hook,(abfd, newsect),
344 bfd *abfd AND
345 asection *newsect)
346 {
347 /* align to double at least */
348 newsect->alignment_power = 3;
349
350 if (bfd_get_format (abfd) == bfd_object) {
351 if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) {
352 obj_textsec(abfd)= newsect;
353 return true;
354 }
355
356 if (obj_datasec(abfd) == NULL && !strcmp(newsect->name, ".data")) {
357 obj_datasec(abfd) = newsect;
358 return true;
359 }
360
361 if (obj_bsssec(abfd) == NULL && !strcmp(newsect->name, ".bss")) {
362 obj_bsssec(abfd) = newsect;
363 return true;
364 }
365 }
366
367 /* We allow more than three sections internally */
368 return true;
369 }
370
371
372
373
374 boolean
375 DEFUN(hppa_set_section_contents,(abfd, section, location, offset, count),
376 bfd *abfd AND
377 sec_ptr section AND
378 PTR location AND
379 file_ptr offset AND
380 bfd_size_type count)
381 {
382 fprintf (stderr, "hppa_set_section_contents unimplimented\n");
383 fflush (stderr);
384 abort();
385 return false;
386 }
387
388
389 boolean
390 DEFUN(hppa_set_arch_mach,(abfd, arch, machine),
391 bfd *abfd AND
392 enum bfd_architecture arch AND
393 unsigned long machine)
394 {
395 fprintf (stderr, "hppa_set_arch_mach unimplemented\n");
396 fflush (stderr);
397 /* Allow any architecture to be supported by the hppa backend */
398 return bfd_default_set_arch_mach(abfd, arch, machine);
399 }
400
401
402 static boolean
403 DEFUN (hppa_find_nearest_line,(abfd,
404 section,
405 symbols,
406 offset,
407 filename_ptr,
408 functionname_ptr,
409 line_ptr),
410 bfd *abfd AND
411 asection *section AND
412 asymbol **symbols AND
413 bfd_vma offset AND
414 CONST char **filename_ptr AND
415 CONST char **functionname_ptr AND
416 unsigned int *line_ptr)
417 {
418 fprintf (stderr, "hppa_find_nearest_line unimplemented\n");
419 fflush (stderr);
420 abort ();
421 return (false);
422 }
423
424 static int
425 DEFUN (hppa_sizeof_headers, (abfd, reloc),
426 bfd *abfd AND
427 boolean reloc)
428 {
429 fprintf (stderr, "hppa_sizeof_headers unimplemented\n");
430 fflush (stderr);
431 abort ();
432 return (0);
433 }
434
435 #ifdef hpux
436 #define hppa_core_file_p _bfd_dummy_target
437 #else
438 bfd_target *
439 hppa_core_file_p (abfd)
440 bfd *abfd;
441 {
442 int val;
443 struct hpuxuser u;
444 unsigned int reg_offset, fp_reg_offset;
445 /* This struct is just for allocating two things with one zalloc, so
446 they will be freed together, without violating alignment constraints. */
447 struct core_user {
448 struct hppa_core_struct coredata;
449 struct hpuxuser u;
450 } *rawptr;
451
452 val = bfd_read ((void *)&u, 1, sizeof u, abfd);
453 if (val != sizeof u)
454 return 0; /* Too small to be a core file */
455
456 /* Sanity check perhaps??? */
457 if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */
458 return 0;
459 if (u.u_ssize > 0x1000000)
460 return 0;
461 /* Check that the size claimed is no greater than the file size. FIXME. */
462
463 /* OK, we believe you. You're a core file (sure, sure). */
464
465 /* Allocate both the upage and the struct core_data at once, so
466 a single free() will free them both. */
467 rawptr = (struct core_user *)bfd_zalloc (abfd, sizeof (struct core_user));
468 if (rawptr == NULL) {
469 bfd_error = no_memory;
470 return 0;
471 }
472
473 abfd->tdata.hppa_core_data = &rawptr->coredata;
474 core_upage (abfd) = &rawptr->u;
475 *core_upage (abfd) = u; /* Save that upage! */
476
477 /* Create the sections. This is raunchy, but bfd_close wants to free
478 them separately. */
479 core_stacksec (abfd) = (asection *) zalloc (sizeof (asection));
480 if (core_stacksec (abfd) == NULL) {
481 loser:
482 bfd_error = no_memory;
483 free ((void *)rawptr);
484 return 0;
485 }
486 core_datasec (abfd) = (asection *) zalloc (sizeof (asection));
487 if (core_datasec (abfd) == NULL) {
488 loser1:
489 free ((void *)core_stacksec (abfd));
490 goto loser;
491 }
492 core_regsec (abfd) = (asection *) zalloc (sizeof (asection));
493 if (core_regsec (abfd) == NULL) {
494 loser2:
495 free ((void *)core_datasec (abfd));
496 goto loser1;
497 }
498
499
500 core_stacksec (abfd)->name = ".stack";
501 core_datasec (abfd)->name = ".data";
502 core_regsec (abfd)->name = ".reg";
503
504 core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
505 core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
506 core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
507
508 core_datasec (abfd)->_raw_size = NBPG * u.u_dsize;
509 core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize;
510 core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */
511
512 core_datasec (abfd)->vma = u.hpuxu_exdata.somexec.a_Dmem;
513 core_stacksec (abfd)->vma = USRSTACK; /* from sys/param */
514 /* This is tricky. As the "register section", we give them the entire
515 upage and stack. u.u_ar0 points to where "register 0" is stored.
516 There are two tricks with this, though. One is that the rest of the
517 registers might be at positive or negative (or both) displacements
518 from *u_ar0. The other is that u_ar0 is sometimes an absolute address
519 in kernel memory, and on other systems it is an offset from the beginning
520 of the `struct user'.
521
522 As a practical matter, we don't know where the registers actually are,
523 so we have to pass the whole area to GDB. We encode the value of u_ar0
524 by setting the .regs section up so that its virtual memory address
525 0 is at the place pointed to by u_ar0 (by setting the vma of the start
526 of the section to -u_ar0). GDB uses this info to locate the regs,
527 using minor trickery to get around the offset-or-absolute-addr problem. */
528 core_regsec (abfd)->vma = 0 - NBPG * USIZE; /* -u_ar0 */
529
530 core_datasec (abfd)->filepos = NBPG * UPAGES;
531 core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize;
532 core_regsec (abfd)->filepos = 0; /* Register segment is the upage */
533
534 /* Align to word at least */
535 core_stacksec (abfd)->alignment_power = 2;
536 core_datasec (abfd)->alignment_power = 2;
537 core_regsec (abfd)->alignment_power = 2;
538
539 abfd->sections = core_stacksec (abfd);
540 core_stacksec (abfd)->next = core_datasec (abfd);
541 core_datasec (abfd)->next = core_regsec (abfd);
542 abfd->section_count = 3;
543
544 return abfd->xvec;
545 }
546 #endif
547
548 #ifdef hpux
549 #define hppa_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
550 #else
551 char *
552 hppa_core_file_failing_command (abfd)
553 bfd *abfd;
554 {
555 #ifndef NO_CORE_COMMAND
556 if (*core_upage (abfd)->u_comm)
557 return core_upage (abfd)->u_comm;
558 else
559 #endif
560 return 0;
561 }
562 #endif
563
564 /* ARGSUSED */
565 int
566 hppa_core_file_failing_signal (ignore_abfd)
567 bfd *ignore_abfd;
568 {
569 return -1; /* FIXME, where is it? */
570 }
571
572 /* ARGSUSED */
573 boolean
574 hppa_core_file_matches_executable_p (core_bfd, exec_bfd)
575 bfd *core_bfd, *exec_bfd;
576 {
577 return true; /* FIXME, We have no way of telling at this point */
578 }
579
580 #define hppa_bfd_debug_info_start bfd_void
581 #define hppa_bfd_debug_info_end bfd_void
582 #define hppa_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
583
584
585
586 #define hppa_openr_next_archived_file bfd_generic_openr_next_archived_file
587 #define hppa_generic_stat_arch_elt bfd_generic_stat_arch_elt
588 #define hppa_slurp_armap bfd_false
589 #define hppa_slurp_extended_name_table _bfd_slurp_extended_name_table
590 #define hppa_truncate_arname (void (*)())bfd_nullvoidptr
591 #define hppa_write_armap 0
592
593 #define hppa_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
594 #define hppa_close_and_cleanup bfd_generic_close_and_cleanup
595 #define hppa_get_section_contents bfd_generic_get_section_contents
596
597 #define hppa_bfd_get_relocated_section_contents \
598 bfd_generic_get_relocated_section_contents
599 #define hppa_bfd_relax_section bfd_generic_relax_section
600
601 /*SUPPRESS 460 */
602 bfd_target hppa_vec =
603 {
604 "hppa", /* name */
605 bfd_target_hppa_flavour,
606 true, /* target byte order */
607 true, /* target headers byte order */
608 (HAS_RELOC | EXEC_P | /* object flags */
609 HAS_LINENO | HAS_DEBUG |
610 HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
611 (SEC_CODE|SEC_DATA|SEC_ROM|SEC_HAS_CONTENTS
612 |SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
613
614 /* leading_symbol_char: is the first char of a user symbol
615 predictable, and if so what is it */
616 0,
617
618
619 ' ', /* ar_pad_char */
620 16, /* ar_max_namelen */
621 3, /* minimum alignment */
622 _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
623 _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
624
625 { _bfd_dummy_target,
626 hppa_object_p, /* bfd_check_format */
627 bfd_generic_archive_p,
628 hppa_core_file_p,
629 },
630 {
631 bfd_false,
632 hppa_mkobject,
633 _bfd_generic_mkarchive,
634 bfd_false
635 },
636 {
637 bfd_false,
638 hppa_write_object_contents,
639 _bfd_write_archive_contents,
640 bfd_false,
641 },
642 #undef hppa
643 JUMP_TABLE(hppa)
644 };
645
646 #else /* notdef hp9000s800 */
647 /* Prevent "empty translation unit" warnings from the idiots at X3J11. */
648 static char ansi_c_idiots = 69;
649 #endif /* hp9000s800 */
This page took 0.042695 seconds and 5 git commands to generate.