]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/py-inferior.exp
ltmain.sh: allow more flags at link-time
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-inferior.exp
1 # Copyright (C) 2009-2024 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 # This file is part of the GDB testsuite. It tests the mechanism
17 # exposing inferiors to Python.
18
19 load_lib gdb-python.exp
20
21 require allow_python_tests
22
23 standard_testfile
24
25 if { [gdb_compile_pthreads ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
26 return -1
27 }
28
29 # Start with a fresh gdb.
30 save_vars { env(ASAN_OPTIONS) } {
31 # The call to gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)
32 # triggers address sanitizer. Suppress the error, leaving us with just
33 # this warning:
34 # WARNING: AddressSanitizer failed to allocate 0xffffffffffffffff bytes
35 set_sanitizer ASAN_OPTIONS allocator_may_return_null 1
36
37 clean_restart ${testfile}
38 }
39
40 switch [get_endianness] {
41 little { set python_pack_char "<" }
42 big { set python_pack_char ">" }
43 }
44
45 gdb_test \
46 "python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)" \
47 [multi_line \
48 [string_to_regexp "Python Exception <class 'MemoryError'>: "] \
49 [string_to_regexp "Error occurred in Python."]]
50
51 # Test memory read operations without execution.
52
53 gdb_py_test_silent_cmd "python addr = gdb.lookup_global_symbol ('int8_global').value().address" \
54 "get global variable address" 0
55 gdb_test "python \
56 int8_global_mv = gdb.selected_inferior().read_memory (addr, 1); \
57 print(int.from_bytes(int8_global_mv\[0\], byteorder='little'))" \
58 "\r\n42" \
59 "read memory without execution"
60
61 # The following tests require execution.
62
63 if {![runto_main]} {
64 return 0
65 }
66
67 # The most recently added inferior.
68 set most_recent_inf 1
69
70 # A helper function that adds a new inferior. It returns the expected
71 # number of the new inferior. ARG is a string to pass to
72 # add-inferior.
73 proc add_inferior {{arg ""}} {
74 global most_recent_inf
75 incr most_recent_inf
76 gdb_test "add-inferior $arg" "Added inferior $most_recent_inf.*" \
77 "add inferior $most_recent_inf"
78 return $most_recent_inf
79 }
80
81 # Test basic gdb.Inferior attributes and methods.
82
83 gdb_py_test_silent_cmd "python inferiors = gdb.inferiors ()" "get inferiors list" 1
84 gdb_test "python print (inferiors)" \
85 "\\(<gdb.Inferior num=1, pid=$decimal>,\\)" "verify inferiors list"
86 gdb_py_test_silent_cmd "python i0 = inferiors\[0\]" "get first inferior" 0
87
88 gdb_test "python print ('result = %s' % (i0 == inferiors\[0\]))" " = True" "test equality comparison (true)"
89 gdb_test "python print ('result = %s' % i0.num)" " = \[0-9\]+" "test Inferior.num"
90 gdb_test "python print ('result = %s' % i0.connection_num)" " = \[0-9\]+" "test Inferior.connection_num"
91 gdb_test "python print ('result = %s' % (i0.connection_num == i0.connection.num))" " = True" \
92 "Inferior.connection_num equals Inferior.connection.num"
93 gdb_test "python print ('result = %s' % i0.pid)" " = \[0-9\]+" "test Inferior.pid"
94 gdb_test "python print ('result = %s' % i0.was_attached)" " = False" "test Inferior.was_attached"
95 gdb_test "python print (i0.threads ())" \
96 "\\(<gdb.InferiorThread id=${decimal}\\.${decimal} target-id=\"\[^\r\n\]*\">,\\)" \
97 "test Inferior.threads"
98
99 gdb_test "python print (i0.progspace)" "<gdb.Progspace object at $hex>"
100 gdb_test "python print (i0.progspace == gdb.progspaces()\[0\])" "True"
101
102 # Add a user defined attribute to the inferior, and check the
103 # attribute can be read back.
104 gdb_test_no_output "python i0._user_attr = 123" \
105 "add a user defined attribute to the inferior object"
106 gdb_test "python print(i0._user_attr)" \
107 "123" "read back user defined attribute from i0"
108 gdb_test "python print(gdb.inferiors()\[0\]._user_attr)" \
109 "123" "read back user defined attribute from gdb.inferiors"
110
111 # Record the main thread, and check its __repr__ while we're at it.
112 gdb_test_no_output "python main_thread = gdb.inferiors()\[0\].threads()\[0\]"
113 gdb_test "python print(main_thread)" \
114 "<gdb.InferiorThread id=${decimal}\\.${decimal} target-id=\"\[^\r\n\]*\">" \
115
116 # Test the number of inferior threads.
117
118 gdb_breakpoint check_threads
119 gdb_continue_to_breakpoint "cont to check_threads" ".*pthread_barrier_wait.*"
120 gdb_test "python print (len (i0.threads ()))" "\r\n9" "test Inferior.threads 2"
121
122 # Grab a worker thread from the thread list. A worker thread is the
123 # first thread that is not the main thread. The worker thread object
124 # will become invalid when the corresponding thread exits.
125 gdb_test_no_output "python worker_thread = next(filter(lambda thr : thr != main_thread, i0.threads()))"
126 gdb_test "python print(worker_thread)" \
127 "<gdb.InferiorThread id=${decimal}\\.${decimal} target-id=\"\[^\r\n\]*\">" \
128 "test repr of a valid thread"
129
130 # Add a user defined attribute to the worker thread, check the
131 # attribute can be read back, and check the attribute is not present
132 # on the main thread.
133 gdb_test_no_output "python worker_thread._user_attribute = 123" \
134 "add user defined attribute to InferiorThread object"
135 gdb_test "python print(worker_thread._user_attribute)" "123" \
136 "read back user defined attribute"
137 gdb_test "python print(main_thread._user_attribute)" \
138 [multi_line \
139 "AttributeError.*: 'gdb\\.InferiorThread' object has no attribute '_user_attribute'" \
140 "Error occurred in Python.*"] \
141 "attempt to read non-existent user defined attribute"
142
143 # Proceed to the next test.
144
145 gdb_breakpoint [gdb_get_line_number "Break here."]
146 gdb_continue_to_breakpoint "cont to Break here." ".*Break here\..*"
147
148 # Check the repr() for an invalid gdb.InferiorThread object.
149 gdb_test "python print(worker_thread)" "<gdb.InferiorThread \\(invalid\\)>" \
150 "test repr of an invalid thread"
151
152 # Check the user defined attribute is still present on the invalid thread object.
153 gdb_test "python print(worker_thread._user_attribute)" "123" \
154 "check user defined attribute on an invalid InferiorThread object"
155
156 # Test memory read and write operations.
157
158 gdb_py_test_silent_cmd "python addr = gdb.selected_frame ().read_var ('str')" \
159 "read str address" 0
160 gdb_test "python astr = gdb.inferiors()\[0\].read_memory (addr, 5); print(astr)" \
161 "<memory at $hex>" \
162 "read str contents"
163 gdb_test "python print(astr\[0\])" "b'h'"
164 gdb_py_test_silent_cmd "python a = bytes('a', 'ascii')" "" 0
165 gdb_py_test_silent_cmd "python astr\[1\] = a" "change str" 0
166 gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, astr)" \
167 "write str" 1
168 gdb_test "print str" " = \"hallo, testsuite\"" \
169 "ensure str was changed in the inferior"
170
171 # Add a new inferior here, so we can test that operations work on the
172 # correct inferior.
173 set num [add_inferior]
174
175 # Confirm the new inferior doesn't have the user defined attribute,
176 # but that the first inferior does still have the attribute.
177 gdb_test "python print(gdb.inferiors()\[1\]._user_attr)" \
178 [multi_line \
179 "AttributeError.*: 'gdb\\.Inferior' object has no attribute '_user_attr'" \
180 "Error occurred in Python.*"] \
181 "check new inferior doesn't have user defined attribute"
182 gdb_test "python print(gdb.inferiors()\[0\]._user_attr)" \
183 "123" "read back user defined attribute again"
184
185 # Test memory search.
186
187 set hex_number {0x[0-9a-fA-F][0-9a-fA-F]*}
188 set dec_number {[0-9]+}
189 set history_prefix {[$][0-9]* = }
190 set newline {[\r\n]+}
191 set pattern_not_found "${newline}.None"
192 set one_pattern_found "${newline}.${dec_number}"
193
194 # Test string pattern.
195
196 with_test_prefix "string" {
197 gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161"
198 gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')"
199 gdb_test_no_output "py start_addr = search_buf.address"
200 gdb_test_no_output "py length = search_buf.type.sizeof"
201
202 # Switch to the new inferior before testing.
203 gdb_test "inferior $num" "Switching to inferior $num.*" \
204 "switch to inferior $num"
205
206 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, 'aaa'))" \
207 "${one_pattern_found}" "find string pattern"
208
209 # Test not finding pattern because search range too small, with
210 # potential find at the edge of the range.
211 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 10+3, 'aaaa'))" \
212 "${pattern_not_found}" "pattern not found at end of range"
213
214 # Increase the search range by 1 and we should find the pattern.
215 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 10+3+1, 'aaa'))" \
216 "${one_pattern_found}" "pattern found at end of range"
217 }
218
219 # While still in the new inferior, test reading and writing memory
220 # again.
221 gdb_test "python astr = gdb.inferiors()\[0\].read_memory (addr, 5); print(astr)" \
222 "<memory at $hex>" \
223 "read str while other inferior selected"
224 gdb_test "python print(astr\[1\])" "b'a'" \
225 "print a character from the string"
226 gdb_py_test_silent_cmd "python astr\[1\] = b'X'" "change str again" 0
227 gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, astr)" \
228 "write str while other inferior selected" 1
229
230 gdb_test "inferior 1" "Switching to inferior 1.*" "switch back to inferior 1"
231
232 gdb_test "print str" " = \"hXllo, testsuite\"" \
233 "ensure str was changed while other inferior selected"
234
235 gdb_test_no_output "remove-inferiors $num" "remove-inferiors $num"
236
237 # Import struct to pack the following patterns.
238 gdb_test_no_output "py from struct import *"
239
240 # Test 16-bit pattern.
241
242 with_test_prefix "16-bit" {
243 gdb_test_no_output "set int16_search_buf\[10\] = 0x1234"
244 gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')"
245 gdb_test_no_output "py start_addr = search_buf.address"
246 gdb_test_no_output "py length = search_buf.type.sizeof"
247 gdb_test_no_output "py pattern = pack('${python_pack_char}H',0x1234)"
248 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
249 "${one_pattern_found}" "find 16-bit pattern, with value pattern"
250 }
251
252 # Test 32-bit pattern.
253
254 with_test_prefix "32-bit" {
255 gdb_test_no_output "set int32_search_buf\[10\] = 0x12345678"
256 gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')"
257 gdb_test_no_output "py start_addr = search_buf.address"
258 gdb_test_no_output "py length = search_buf.type.sizeof"
259 gdb_test_no_output "py pattern = pack('${python_pack_char}I',0x12345678)"
260 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
261 "${one_pattern_found}" "find 32-bit pattern, with python pattern"
262 }
263
264 # Test 64-bit pattern.
265
266 with_test_prefix "64-bit" {
267 gdb_test_no_output "set int64_search_buf\[10\] = 0xfedcba9876543210LL"
268 gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')"
269 gdb_test_no_output "py start_addr = search_buf.address"
270 gdb_test_no_output "py length = search_buf.type.sizeof"
271 gdb_test_no_output "py pattern = pack('${python_pack_char}Q', 0xfedcba9876543210)"
272 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
273 "${one_pattern_found}" "find 64-bit pattern, with value pattern"
274 }
275
276 # Test mixed-sized patterns.
277
278 with_test_prefix "mixed-sized" {
279 gdb_test_no_output "set *(int8_t*) &search_buf\[10\] = 0x62"
280 gdb_test_no_output "set *(int16_t*) &search_buf\[11\] = 0x6363"
281 gdb_test_no_output "set *(int32_t*) &search_buf\[13\] = 0x64646464"
282 gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('search_buf')"
283 gdb_test_no_output "py start_addr = search_buf\[0\].address"
284 gdb_test_no_output "py pattern1 = pack('B', 0x62)"
285 gdb_test_no_output "py pattern2 = pack('${python_pack_char}H', 0x6363)"
286 gdb_test_no_output "py pattern3 = pack('${python_pack_char}I', 0x64646464)"
287
288 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern1))" \
289 "${one_pattern_found}" "find mixed-sized pattern 1"
290 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern2))" \
291 "${one_pattern_found}" "find mixed-sized pattern 2"
292 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern3))" \
293 "${one_pattern_found}" "find mixed-sized pattern 3"
294 }
295
296 # Test search spanning a large range, in the particular case of native
297 # targets, test the search spanning multiple chunks.
298 # Remote targets may implement the search differently.
299
300 set CHUNK_SIZE 16000
301 with_test_prefix "large range" {
302 gdb_test_no_output "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678"
303 gdb_test_no_output "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678"
304 gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')"
305 gdb_test_no_output "py end_addr = start_addr + gdb.selected_frame ().read_var ('search_buf_size')"
306 gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0x12345678)"
307
308 gdb_test_no_output "py first = gdb.inferiors()\[0\].search_memory (start_addr,end_addr - start_addr, pattern)"
309 gdb_test "py print (first)" "${one_pattern_found}" "search spanning large range 1st result"
310 gdb_test_no_output "py start_addr = first + 1"
311 gdb_test_no_output "py second = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)"
312 gdb_test "py print (second)" "${one_pattern_found}" "search spanning large range 2nd result"
313 gdb_test_no_output "py start_addr = second + 1"
314 gdb_test_no_output "py third = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)"
315 gdb_test "py print (third)" "${pattern_not_found}" "search spanning large range 3rd result"
316 }
317
318 # For native targets, test a pattern straddling a chunk boundary.
319
320 if [isnative] {
321 with_test_prefix "straddling" {
322 gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531"
323 gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0xfdb97531)"
324 gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')"
325 gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern))" \
326 "${one_pattern_found}" "find pattern straddling chunk boundary"
327 }
328 }
329
330 # Test Inferior is_valid.
331
332 with_test_prefix "is_valid" {
333 gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get initial list" 1
334 gdb_test "python print (len(inf_list))" "1" "get inferior list length 1"
335 gdb_test "python print (inf_list\[0\].is_valid())" "True" \
336 "check inferior validity 1"
337
338 # The "dummy" line below used to cause a gdb crash.
339 gdb_test_multiline "install new inferior event handler" \
340 "python" "" \
341 "my_inferior_count = 1" "" \
342 "def new_inf_handler(evt):" "" \
343 " global my_inferior_count" "" \
344 " if evt.inferior is not None:" "" \
345 " my_inferior_count = my_inferior_count + 1" "" \
346 " dummy = gdb.Value(True)" "" \
347 "gdb.events.new_inferior.connect(new_inf_handler)" "" \
348 "end" ""
349 gdb_test_multiline "install inferior deleted event handler" \
350 "python" "" \
351 "def del_inf_handler(evt):" "" \
352 " global my_inferior_count" "" \
353 " if evt.inferior is not None:" "" \
354 " my_inferior_count = my_inferior_count - 1" "" \
355 "gdb.events.inferior_deleted.connect(del_inf_handler)" "" \
356 "end" ""
357
358 set num [add_inferior]
359 gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get new list" 1
360 gdb_test "python print (len(inf_list))" "2" "get inferior list length 2"
361 gdb_test "python print (inf_list\[0\].is_valid())" "True" \
362 "check inferior validity 2"
363
364 gdb_test "python print (my_inferior_count)" "2" \
365 "test new-inferior event handler"
366
367 gdb_test "python print (inf_list\[1\].is_valid())" "True" \
368 "check inferior validity 3"
369
370 gdb_test_no_output "remove-inferiors $num"
371 gdb_test "python print (inf_list\[0\].is_valid())" "True" \
372 "check inferior validity 4"
373
374 gdb_test "python print (inf_list\[1\].is_valid())" "False" \
375 "check inferior validity 5"
376
377 gdb_test "python print (my_inferior_count)" "1" \
378 "test inferior-deleted event handler"
379
380 # Test that other properties and methods handle the removed inferior
381 # correctly.
382 gdb_test "python print (inf_list\[1\].num)" \
383 "RuntimeError.*: Inferior no longer exists.*"
384 gdb_test "python print (inf_list\[1\].connection_num)" \
385 "RuntimeError.*: Inferior no longer exists.*"
386 gdb_test "python print (inf_list\[1\].connection)" \
387 "RuntimeError.*: Inferior no longer exists.*"
388 gdb_test "python print (inf_list\[1\].pid)" \
389 "RuntimeError.*: Inferior no longer exists.*"
390 gdb_test "python print (inf_list\[1\].was_attached)" \
391 "RuntimeError.*: Inferior no longer exists.*"
392 gdb_test "python print (inf_list\[1\].progspace)" \
393 "RuntimeError.*: Inferior no longer exists.*"
394 gdb_test "python print (inf_list\[1\].threads ())" \
395 "RuntimeError.*: Inferior no longer exists.*"
396 gdb_test "python print (inf_list\[1\].thread_from_thread_handle (1))" \
397 "RuntimeError.*: Inferior no longer exists.*"
398 }
399
400 # Test gdb.selected_inferior()
401 with_test_prefix "selected_inferior" {
402 gdb_test "inferior 1" ".*" "switch to first inferior"
403 gdb_test "py print (gdb.selected_inferior().num)" "1" "first inferior selected"
404 gdb_test "py print (gdb.selected_inferior().connection_num)" "1" \
405 "first inferior's connection number"
406 gdb_test "py print (gdb.selected_inferior().connection.num)" "1" \
407 "first inferior's connection number, though connection object"
408 # Figure out if inf 1 has a native target.
409 set inf_1_is_native [gdb_protocol_is_native]
410
411 set num [add_inferior "-no-connection"]
412 gdb_test "inferior $num" ".*" "switch to inferior $num"
413 gdb_test "py print (gdb.selected_inferior().num)" "$num" \
414 "inferior $num selected"
415 gdb_test "py print (gdb.selected_inferior().connection_num)" "None" \
416 "inferior $num's None connection number"
417 gdb_test "py print (gdb.selected_inferior().connection)" "None" \
418 "inferior $num's None connection"
419 gdb_test "target native" "Done. Use the \"run\" command to start a process." \
420 "target for inferior $num"
421
422 # If inf 1 has a native target, inf 3's target is shared with 1's.
423 # Otherwise, it must have created a new target with a new number.
424 if {$inf_1_is_native} {
425 set expected_connection_num 1
426 } else {
427 set expected_connection_num 2
428 }
429 gdb_test "py print (gdb.selected_inferior().connection_num)" \
430 "$expected_connection_num" \
431 "inferior $num's native connection number"
432 gdb_test "py print (gdb.selected_inferior().connection.num)" \
433 "$expected_connection_num" \
434 "inferior $num's native connection number, though connection object"
435
436 # Test printing of gdb.TargetConnection object.
437 gdb_test "py print (gdb.selected_inferior().connection)" \
438 "<gdb.TargetConnection num=${expected_connection_num}, what=\"\[^\"\]+\">" \
439 "print a connection object"
440
441 gdb_test "inferior 1" ".*" "switch back to first inferior"
442 gdb_test_no_output "remove-inferiors $num"
443 }
444
445 # Test repr()/str()
446 with_test_prefix "__repr__" {
447 set num [add_inferior]
448 gdb_py_test_silent_cmd "python infs = gdb.inferiors()" "get inferior list" 1
449 gdb_test "python print (infs\[0\])" "<gdb.Inferior num=1, pid=$decimal>"
450 gdb_test "python print (infs)" \
451 "\\\(<gdb.Inferior num=1, pid=$decimal>, <gdb.Inferior num=$num, pid=$decimal>\\\)" \
452 "print all inferiors 1"
453 gdb_test_no_output "remove-inferiors $num"
454 gdb_test "python print (infs)" \
455 "\\\(<gdb.Inferior num=1, pid=$decimal>, <gdb.Inferior \\\(invalid\\\)>\\\)" \
456 "print all inferiors 2"
457 }
458
459 # Test architecture.
460 with_test_prefix "architecture" {
461 gdb_test "inferior 1" ".*" "switch to first inferior"
462 gdb_test "python print(gdb.selected_frame().architecture() is gdb.selected_inferior().architecture())" \
463 "True" \
464 "inferior architecture matches frame architecture"
465 }
466
467 gdb_test "python print(gdb.selected_inferior().main_name)" \
468 "main" \
469 "print main name"
470
471 gdb_test_no_output "set args x y z"
472 gdb_test "python print(gdb.selected_inferior().arguments)" \
473 "x y z" \
474 "print arguments"
475
476 gdb_test_no_output "python gdb.selected_inferior().arguments = 'a b c'" \
477 "set arguments from string"
478 gdb_test "show args" \
479 [string_to_regexp "Argument list to give program being debugged when it is started is \"a b c\"."] \
480 "show args from string"
481
482 gdb_test_no_output "python gdb.selected_inferior().arguments = \['a', 'b c'\]" \
483 "set arguments from list"
484 gdb_test "show args" \
485 [string_to_regexp "Argument list to give program being debugged when it is started is \"a b\\ c\"."] \
486 "show args from list"
487
488 gdb_test_no_output "python gdb.selected_inferior().clear_env()" \
489 "clear environment"
490 gdb_test_no_output "show environment"
491
492 gdb_test_no_output "python gdb.selected_inferior().set_env('DEI', 'value')" \
493 "set environment variable"
494 gdb_test "show environment" \
495 "DEI=value" \
496 "examine environment variable"
497
498 gdb_test_no_output "python gdb.selected_inferior().unset_env('DEI')" \
499 "unset environment variable"
500 gdb_test_no_output "show environment" \
501 "environment is empty again"