]> Git Repo - binutils.git/blob - gdb/testsuite/gdb.trace/unavailable.exp
* gdb.trace/actions.exp: Use standard_testfile.
[binutils.git] / gdb / testsuite / gdb.trace / unavailable.exp
1 # Copyright 1998, 2005, 2007-2012 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 load_lib "trace-support.exp"
17
18 standard_testfile unavailable.cc
19 set executable $testfile
20
21 if {[prepare_for_testing $testfile.exp $testfile $srcfile \
22          {debug nowarnings c++}]} {
23     return -1
24 }
25
26 set ws "\[\r\n\t \]+"
27 set cr "\[\r\n\]+"
28
29 if [is_amd64_regs_target] {
30     set fpreg "rbp"
31     set spreg "rsp"
32     set pcreg "rip"
33 } elseif [is_x86_like_target] {
34     set fpreg "ebp"
35     set spreg "esp"
36     set pcreg "eip"
37 } else {
38     set fpreg "fp"
39     set spreg "sp"
40     set pcreg "pc"
41 }
42
43 #
44 # Utility procs
45 #
46
47 proc test_register { reg } {
48     global gdb_prompt
49     global hex
50     global cr
51
52     gdb_test_multiple "print /x $reg" "collected $reg" {
53         -re "\\$\[0-9\]+ = \[x0\]+$cr$gdb_prompt $" {
54             fail "collected $reg (zero)"
55         }
56         -re "\\$\[0-9\]+ = $hex$cr$gdb_prompt $" {
57             pass "collected $reg"
58         }
59         -re "\[Ee\]rror.*$gdb_prompt $" {
60             fail "collected $reg (error)"
61         }
62     }
63 }
64
65 proc test_register_unavailable { reg } {
66     gdb_test "print /x $reg" \
67         "<unavailable>" \
68         "correctly report $reg as unavailable"
69 }
70
71 proc prepare_for_trace_test {} {
72     global executable
73
74     clean_restart $executable
75
76     runto_main
77
78     gdb_test "break begin" ".*" ""
79     gdb_test "break end" ".*" ""
80 }
81
82 proc run_trace_experiment { test_func } {
83     global gdb_prompt
84
85     gdb_test "continue" \
86         ".*Breakpoint \[0-9\]+, begin .*" \
87         "advance to begin"
88
89     gdb_test_no_output "tstart" "start trace experiment"
90
91     gdb_test "continue" \
92             "Continuing.*Breakpoint \[0-9\]+, end.*" \
93             "run trace experiment"
94     gdb_test "tstop" \
95             "\[\r\n\]+" \
96             "stop trace experiment"
97     gdb_test "tfind start" \
98             "#0  $test_func .*" \
99             "tfind test frame"
100 }
101
102 # Test that "display VAR" works as expected, assuming VAR is wholly
103 # unavailable.
104
105 proc test_maybe_regvar_display { var } {
106     global gdb_prompt
107
108     # Evaluating VAR's location description may throw an internal
109     # "unavailable" exception, if for example, the value of a register
110     # necessary for computing VAR's location is unavailable.  Such an
111     # exception is caught, and should not cause automatic disablement
112     # of the current display being printed.  (GDB used to disable the
113     # current display whenever any exception was thrown.)
114     set test "display $var"
115     gdb_test_multiple "$test" "$test" {
116         -re "Disabling display ? to avoid infinite recursion.*$gdb_prompt $" {
117             fail "$test"
118         }
119         -re "display ${var}\r\n1: ${var} = <unavailable>\r\n$gdb_prompt $" {
120             pass "$test"
121         }
122     }
123     gdb_test "info display" ".*1:\[ \t\]+y\[ \t\]+${var}" "display ${var} is enabled"
124
125     gdb_test "undisp" \
126         "" \
127         "delete $var display" \
128         ".*Delete all auto-display expressions.*y or n. $" \
129         "y"
130 }
131
132 #
133 # Test procs
134 #
135
136 proc gdb_collect_args_test {} { with_test_prefix "unavailable arguments" {
137     global cr
138     global gdb_prompt
139
140     prepare_for_trace_test
141
142     gdb_test "trace args_test_func" \
143         "Tracepoint \[0-9\]+ at .*" \
144         "set tracepoint"
145
146     # Begin the test.
147     run_trace_experiment args_test_func
148
149     # Test printing the variables, and also their addresses.  We
150     # haven't collected any stack, so there's no way GDB can figure
151     # out the latter.
152
153     gdb_test "print argc" " = <unavailable>"
154     gdb_test "print &argc" \
155         "Can't take address of \"argc\" which isn't an lvalue\."
156
157     gdb_test "print argi" " = <unavailable>"
158     gdb_test "print &argi" \
159         "Can't take address of \"argi\" which isn't an lvalue\."
160
161     gdb_test "print argf" " = <unavailable>"
162     gdb_test "print &argf" \
163         "Can't take address of \"argf\" which isn't an lvalue\."
164
165     gdb_test "print argd" " = <unavailable>"
166     gdb_test "print &argd" \
167         "Can't take address of \"argd\" which isn't an lvalue\."
168
169     # struct arg as one of several args (near end of list)
170
171     gdb_test "print argstruct" \
172         " = \{memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>\}"
173
174     gdb_test "print argstruct.memberc" " = <unavailable>"
175     gdb_test "print argstruct.memberi" " = <unavailable>"
176     gdb_test "print argstruct.memberf" " = <unavailable>"
177     gdb_test "print argstruct.memberd" " = <unavailable>"
178
179     gdb_test "print argarray" " = \\(int \\*\\) <unavailable>"
180
181     gdb_test "print &argarray" \
182         "Can't take address of \"argarray\" which isn't an lvalue\."
183
184     gdb_test "print argarray\[0\]" "value is not available"
185
186     # Test "info args"
187     set r ""
188     set r "${r}argc = <unavailable>${cr}"
189     set r "${r}argi = <unavailable>${cr}"
190     set r "${r}argf = <unavailable>${cr}"
191     set r "${r}argd = <unavailable>${cr}"
192     set r "${r}argstruct = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}${cr}"
193     set r "${r}argarray = <unavailable>${cr}"
194     gdb_test "info args" "$r" "info args"
195
196     test_maybe_regvar_display "argc"
197
198     gdb_test "tfind none" \
199         "#0  end .*" \
200         "cease trace debugging"
201 }}
202
203 proc gdb_collect_locals_test { func msg } { with_test_prefix "unavailable locals: $msg" {
204     global cr
205     global gdb_prompt
206
207     prepare_for_trace_test
208
209     set testline [gdb_get_line_number "set $func tracepoint here"]
210
211     gdb_test "trace $testline" \
212             "Tracepoint \[0-9\]+ at .*" \
213             "set tracepoint"
214
215     # Begin the test.
216     run_trace_experiment $func
217
218     gdb_test "print locc" " = <unavailable>"
219     gdb_test "print loci" " = <unavailable>"
220     gdb_test "print locf" " = <unavailable>"
221     gdb_test "print locd" " = <unavailable>"
222
223     gdb_test "print locst.memberc" " = <unavailable>"
224     gdb_test "print locst.memberi" " = <unavailable>"
225     gdb_test "print locst.memberf" " = <unavailable>"
226     gdb_test "print locst.memberd" " = <unavailable>"
227
228     gdb_test "print locar\[0\]" " = <unavailable>"
229     gdb_test "print locar\[1\]" " = <unavailable>"
230     gdb_test "print locar\[2\]" " = <unavailable>"
231     gdb_test "print locar\[3\]" " = <unavailable>"
232
233     # Test "info locals"
234     set r ""
235     set r "${r}locf = <unavailable>${cr}"
236     set r "${r}locd = <unavailable>${cr}"
237     set r "${r}locst = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}${cr}"
238     set r "${r}locar = {<unavailable>, <unavailable>, <unavailable>, <unavailable>}${cr}"
239     set r "${r}i = <unavailable>${cr}"
240     if { $func == "local_test_func" } {
241         set r "${r}locdefst = {<No data fields>}${cr}"
242     }
243     set r "${r}locc = <unavailable>${cr}"
244     set r "${r}loci = <unavailable>${cr}"
245     gdb_test "info locals" "$r" "info locals"
246
247     test_maybe_regvar_display "loci"
248
249     gdb_test "tfind none" \
250         "#0  end .*" \
251         "cease trace debugging"
252 }}
253
254 proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable registers" {
255     global gdb_prompt
256     global spreg
257     global pcreg
258
259     prepare_for_trace_test
260
261     # We'll simply re-use the globals_test_function for this test
262     gdb_test "trace globals_test_func" \
263             "Tracepoint \[0-9\]+ at .*" \
264             "set tracepoint"
265
266     # Collect nothing.
267
268     # Begin the test.
269     run_trace_experiment globals_test_func
270
271     # On some archs, the $sp/$pc are a real raw registers.  On others,
272     # like x86, they're user registers.  Test both variants.
273     test_register_unavailable "\$$spreg"
274     test_register_unavailable "\$sp"
275
276     # Test reading uncollected pseudo-registers.  The set of which
277     # depends on target.
278     if [is_amd64_regs_target] {
279         # Check the raw register first.
280         test_register_unavailable "\$rax"
281         test_register_unavailable "\$eax"
282         test_register_unavailable "\$ax"
283     } elseif [is_x86_like_target] {
284         # Check the raw register first.
285         test_register_unavailable "\$eax"
286         test_register_unavailable "\$ax"
287     }
288
289     # GDBserver always provides the PC value of regular tracepoint
290     # hits, since it's the same as the tracepoint's address.
291     test_register "\$$pcreg"
292     test_register "\$pc"
293
294     gdb_test "info registers" \
295         "\\*value not available\\*.*\\*value not available\\*" \
296         "info registers, multiple registers not available"
297
298     gdb_test "info registers \$$spreg" \
299         "\\*value not available\\*" \
300         "info registers \$$spreg reports not available"
301
302     gdb_test "tfind none" "#0  end .*" "cease trace debugging"
303 }}
304
305 proc gdb_unavailable_floats { } {
306     global gdb_prompt
307
308     with_test_prefix "unavailable floats" {
309         prepare_for_trace_test
310
311         # We'll simply re-use the globals_test_function for this test
312         gdb_test "trace globals_test_func" \
313             "Tracepoint \[0-9\]+ at .*" \
314             "set tracepoint"
315
316         # Collect nothing.
317
318         # Begin the test.
319         run_trace_experiment globals_test_func
320
321         # Necessarily target specific.
322         if {[istarget "x86_64-*-*"] || [istarget i?86-*]} {
323             send_gdb "info float\n"
324             gdb_expect_list "info float" ".*$gdb_prompt $" {
325                 "Status Word:         <unavailable>"
326                 "Control Word:        <unavailable>"
327                 "Tag Word:            <unavailable>"
328                 "Instruction Pointer: <unavailable>:<unavailable>"
329                 "Operand Pointer:     <unavailable>:<unavailable>"
330                 "Opcode:              <unavailable>"
331             }
332         }
333
334         gdb_test "tfind none" "#0  end .*" "cease trace debugging"
335     }
336 }
337
338 proc gdb_collect_globals_test { } { with_test_prefix "collect globals" {
339     global ws
340     global cr
341     global gdb_prompt
342     global hex
343
344     prepare_for_trace_test
345
346     set testline [gdb_get_line_number "set globals_test_func tracepoint here"]
347
348     gdb_test "trace $testline" \
349             "Tracepoint \[0-9\]+ at .*" \
350             "set tracepoint"
351
352     # We collect the initial sizeof(pointer) bytes of derived_partial
353     # in an attempt of collecting the vptr.  Not portable, but should
354     # work everywhere we need to care.
355     gdb_trace_setactions "define actions" \
356         "" \
357         "collect struct_b.struct_a.array\[2\]" "^$" \
358         "collect struct_b.struct_a.array\[100\]" "^$" \
359         \
360         "collect a" "^$" \
361         "collect c" "^$" \
362         \
363         "collect tarray\[0\].a" "^$" \
364         "collect tarray\[1\].a" "^$" \
365         "collect tarray\[3\].a" "^$" \
366         "collect tarray\[3\].b" "^$" \
367         "collect tarray\[4\].b" "^$" \
368         "collect tarray\[5\].b" "^$" \
369         \
370         "collect g_string_p" "^$" \
371         "collect g_string_partial\[1\]" "^$" \
372         "collect g_string_partial\[2\]" "^$" \
373         \
374         "collect g_structref_p" "^$" \
375         \
376         "collect *((char *)&derived_partial)@sizeof\(void *\)" "^$" \
377         "collect derived_whole" "^$" \
378         \
379         "collect virtual_partial.z" "^$"
380
381     # Begin the test.
382     run_trace_experiment globals_test_func
383
384     gdb_test "print globalc" " = <unavailable>"
385     gdb_test "print globali" " = <unavailable>"
386     gdb_test "print globalf" " = <unavailable>"
387     gdb_test "print globald" " = <unavailable>"
388
389     gdb_test "print globalstruct.memberc" " = <unavailable>"
390     gdb_test "print globalstruct.memberi" " = <unavailable>"
391     gdb_test "print globalstruct.memberf" " = <unavailable>"
392     gdb_test "print globalstruct.memberd" " = <unavailable>"
393
394     gdb_test "print globalstruct" \
395             " = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}"
396
397     gdb_test "print globalp == &globalstruct" \
398             "value is not available" \
399             "can't compare using non collected global pointer"
400
401     gdb_test "print globalarr\[1\]" " = <unavailable>"
402     gdb_test "print globalarr\[2\]" " = <unavailable>"
403     gdb_test "print globalarr\[3\]" " = <unavailable>"
404
405     gdb_test "print struct_b" \
406         " = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>}"
407
408     gdb_test "print /x struct_b" \
409         " = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>}"
410
411     gdb_test "print /x struct_b.struct_a" \
412         " = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}"
413
414     gdb_test "print /x struct_b.struct_a.array" \
415         " = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}"
416
417     gdb_test "print /x struct_b.struct_a.array\[0\]" " = <unavailable>"
418
419     gdb_test "print /x struct_b.struct_a.array\[2\]" " = 0xaaaaaaaa"
420
421     # Check the target doesn't overcollect.  GDB used to merge memory
422     # ranges to collect if they were close enough (collecting the hole
423     # as well), but does not do that anymore.  It's plausible that a
424     # target may do this on its end, but as of this writing, no known
425     # target does it.
426     gdb_test "print {a, b, c}" \
427         " = \\{1, <unavailable>, 3\\}" \
428         "No overcollect of almost but not quite adjacent memory ranges"
429
430     # Check <unavailable> isn't confused with 0 in array element repetitions
431
432     gdb_test_no_output "set print repeat 1"
433
434     gdb_test "print /x tarray" \
435         " = \{\{a = 0x0, b = <unavailable>\} <repeats 2 times>, \{a = <unavailable>, b = <unavailable>\}, \{a = 0x0, b = 0x0\}, \{a = <unavailable>, b = 0x0\} <repeats 2 times>, \{a = <unavailable>, b = <unavailable>\} <repeats 2 times>\}" \
436         "<unavailable> is not the same as 0 in array element repetitions"
437
438     gdb_test_no_output "set print repeat 10"
439
440     # Check that value repeat handles unavailable-ness.
441     gdb_test "print *tarray@3" " = \\{\\{a = 0, b = <unavailable>\\}, \\{a = 0, b = <unavailable>\\}, \\{a = <unavailable>, b = <unavailable>\\}\\}"
442
443     # Static fields
444
445     gdb_test "print struct_b.static_struct_a" \
446         " = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}"
447
448     # Bitfields
449
450     gdb_test "print struct_b.struct_a.bitfield" " = <unavailable>"
451
452     # References
453
454     gdb_test "print g_int" " = <unavailable>"
455
456     gdb_test "print g_ref" \
457         "\\(int &\\) @$hex: <unavailable>" \
458         "global reference shows address but not value"
459
460     gdb_test "print *&g_ref" \
461         "\\$\[0-9\]+ = <unavailable>$cr" \
462         "referenced integer was not collected (taking address of reference)"
463
464     gdb_test "print *g_structref_p" \
465         " = {d = <unavailable>, ref = <unavailable>}"
466
467     # Strings
468
469     # Const string is always available, even when not collected.
470     gdb_test "print g_const_string" \
471         " = \"hello world\"$cr" \
472         "non collected const string is still printable"
473
474     gdb_test "print g_string_p" \
475         " = $hex <g_const_string> \"hello world\"" \
476         "printing constant string through collected pointer"
477
478     gdb_test "print g_string_unavail" \
479         " = \{<unavailable> <repeats 12 times>\}" \
480         "printing non collected string"
481
482     # Incomplete strings print as an array.
483     gdb_test "print g_string_partial" \
484         "\\$\[0-9\]+ = \{<unavailable>, 101 'e', 108 'l', <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>\}" \
485         "printing partially collected string"
486
487     # It is important for this test that the last examined value is
488     # <unavailable>, to exercise the case of the $__ convenience
489     # variable being set to <unavailable> without error.
490     set msg "examining partially collected object"
491     gdb_test_multiple "x /10x &struct_b" "$msg" {
492         -re "$hex <struct_b>:${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>$cr$hex <struct_b\\+16>:${ws}<unavailable>${ws}<unavailable>${ws}0xaaaaaaaa${ws}<unavailable>$cr$hex <struct_b\\+32>:${ws}<unavailable>${ws}<unavailable>$cr$gdb_prompt $" {
493             pass "$msg"
494         }
495         -re "value is not available" {
496             fail "$msg"
497         }
498     }
499
500     gdb_test "p \$__" " = <unavailable>" "last examined value was <unavailable>"
501
502     # This tests that building the array does not require accessing
503     # g_int's contents.
504     gdb_test "print { 1, g_int, 3 }" \
505         " = \\{1, <unavailable>, 3\\}" \
506         "build array from unavailable value"
507
508     # Note, depends on previous test.
509     gdb_test "print \$\[1\]" \
510         " = <unavailable>" \
511         "subscript a non-memory rvalue array, accessing an unvailable element"
512
513     # Access a field of a non-lazy value, making sure the
514     # unavailable-ness is propagated.  History values are easy
515     # non-lazy values, so use those.  The first test just sets up for
516     # the second.
517     gdb_test "print g_smallstruct" " = \\{member = <unavailable>\\}"
518     gdb_test "print \$.member" " = <unavailable>"
519
520     # Cast to baseclass, checking the unavailable-ness is propagated.
521     gdb_test "print (small_struct) g_smallstruct_b" " = \\{member = <unavailable>\\}"
522
523     # Same cast, but starting from a non-lazy, value.
524     gdb_test "print g_smallstruct_b" " = \\{<small_struct> = \\{member = <unavailable>\\}, <No data fields>\\}"
525     gdb_test "print (small_struct) \$" " = \\{member = <unavailable>\\}"
526
527     gdb_test_no_output "set print object on"
528
529     with_test_prefix "print object on" {
530         # With print object on, printing a pointer may need to fetch
531         # the pointed-to object, to check its run-time type.  Make
532         # sure that fails gracefully and transparently when the
533         # pointer itself is unavailable.
534         gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
535
536         # no vtable pointer available
537         gdb_test "print derived_unavail" \
538             " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}"
539
540         # vtable pointer available, but nothing else
541         gdb_test "print derived_partial" \
542             " = \\(Derived\\) {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
543
544         # whole object available
545         gdb_test "print derived_whole" \
546             " = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
547     }
548
549     gdb_test_no_output "set print object off"
550
551     with_test_prefix "print object off" {
552         gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
553
554         # no vtable pointer available
555         gdb_test "print derived_unavail" \
556             " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}"
557
558         # vtable pointer available, but nothing else
559         gdb_test "print derived_partial" \
560             " = {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
561
562         # whole object available
563         gdb_test "print derived_whole" \
564             " = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
565     }
566
567     # An instance of a virtual class where we collected everything but
568     # the vptr.
569     gdb_test "print virtual_partial" \
570         " = {_vptr.Virtual = <unavailable>, z = 0}"
571
572     gdb_test "tfind none" \
573         "#0  end .*" \
574         "cease trace debugging"
575 }}
576
577 proc gdb_trace_collection_test {} {
578     gdb_collect_globals_test
579     gdb_unavailable_registers_test
580     gdb_unavailable_floats
581
582     gdb_collect_args_test
583     gdb_collect_locals_test local_test_func "auto locals"
584     gdb_collect_locals_test reglocal_test_func "register locals"
585     gdb_collect_locals_test statlocal_test_func "static locals"
586 }
587
588 runto_main
589
590 if { ![gdb_target_supports_trace] } then {
591     unsupported "Current target does not support trace"
592     return 1;
593 }
594
595 # Body of test encased in a proc so we can return prematurely.
596 gdb_trace_collection_test
597
598 # Finished!
599 gdb_test "tfind none" ".*" ""
This page took 0.060181 seconds and 4 git commands to generate.