Skip to content

Instantly share code, notes, and snippets.

/-

Created August 12, 2015 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/306f16a358527b267a1e to your computer and use it in GitHub Desktop.
Save anonymous/306f16a358527b267a1e to your computer and use it in GitHub Desktop.
$ gdb bash
Reading symbols from bash...done.
(gdb) run
Starting program: /home/izabera/bashes/bash/bash
$ arg=-3; echo ${!arg}
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff765032a in strlen () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff765032a in strlen () from /usr/lib/libc.so.6
#1 0x0000000000459388 in get_dollar_var_value (ind=-3) at subst.c:3004
#2 0x000000000045eb7d in parameter_brace_expand_word (name=0x8ee790 "-3", var_is_special=0, quoted=0,
pflags=0, indp=0x0) at subst.c:6137
#3 0x000000000045f2c8 in parameter_brace_expand_indir (name=0x8f0a31 "arg", var_is_special=0, quoted=0,
quoted_dollar_atp=0x7fffffffe368, contains_dollar_at=0x7fffffffe360) at subst.c:6314
#4 0x00000000004632a4 in parameter_brace_expand (string=0x8f09d0 "${!arg}", indexp=0x7fffffffe22c, quoted=0,
pflags=0, quoted_dollar_atp=0x7fffffffe368, contains_dollar_at=0x7fffffffe360) at subst.c:7827
#5 0x000000000046431d in param_expand (string=0x8f09d0 "${!arg}", sindex=0x7fffffffe36c, quoted=0,
expanded_something=0x7fffffffe504, contains_dollar_at=0x7fffffffe360, quoted_dollar_at_p=0x7fffffffe368,
had_quoted_null_p=0x7fffffffe364, pflags=0) at subst.c:8349
#6 0x0000000000465560 in expand_word_internal (word=0x8ee710, quoted=0, isexp=0,
contains_dollar_at=0x7fffffffe500, expanded_something=0x7fffffffe504) at subst.c:8901
#7 0x0000000000467e35 in shell_expand_word_list (tlist=0x913be0, eflags=31) at subst.c:10135
#8 0x0000000000468124 in expand_word_list_internal (list=0x9136f0, eflags=31) at subst.c:10258
#9 0x0000000000467442 in expand_words (list=0x9136f0) at subst.c:9799
#10 0x000000000043c27d in execute_simple_command (simple_command=0x8f0970, pipe_in=-1, pipe_out=-1, async=0,
fds_to_close=0x8f0510) at execute_cmd.c:4071
#11 0x00000000004367f1 in execute_command_internal (command=0x913dc0, asynchronous=0, pipe_in=-1,
pipe_out=-1, fds_to_close=0x8f0510) at execute_cmd.c:813
#12 0x0000000000439649 in execute_connection (command=0x914360, asynchronous=0, pipe_in=-1, pipe_out=-1,
fds_to_close=0x8f0510) at execute_cmd.c:2559
#13 0x0000000000436b98 in execute_command_internal (command=0x914360, asynchronous=0, pipe_in=-1,
pipe_out=-1, fds_to_close=0x8f0510) at execute_cmd.c:980
#14 0x0000000000435dd3 in execute_command (command=0x914360) at execute_cmd.c:416
#15 0x0000000000421a04 in reader_loop () at eval.c:163
#16 0x000000000041f856 in main (argc=1, argv=0x7fffffffe9b8, env=0x7fffffffe9c8) at shell.c:760
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment