lebr0nli / GEP

GEP (GDB Enhanced Prompt) - a GDB plug-in to enhance your GDB with fzf history search, fish-like autosuggestions, tab auto-completion with fzf, and more!
MIT License
93 stars 7 forks source link

Error when starting gdb #3

Closed diohabara closed 2 years ago

diohabara commented 2 years ago

When I installed as instructed in README,

$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/lebr0nli/GEP/main/install.sh)"

I've got this error when starting GDB.

File "~/GEP/.gdbinit-gep.py", line 77
    fzf_cmd = [f"awk '!seen[$0]++' {shlex.quote(HISTORY_FILENAME)}"]
                                                                  ^
SyntaxError: invalid syntax
lebr0nli commented 2 years ago

Hi, could you provide the Python version of your GDB? (You can pi sys.version inside GDB)

And it is probably because f-strings is a Python 3.6+ syntax, and you are using maybe Python 3.5 or something.

diohabara commented 2 years ago

@lebr0nli You're right. Then version of Python(usr/bin/python) was 3.5.2. Is it possible to use python3 rather than python to avoid this error? This is because python command is often for prebuilt one and what I install is python3.

lebr0nli commented 2 years ago

Is it possible to use python3 rather than python to avoid this error? This is because python command is often for prebuilt one and what I install is python3.

@diohabara, I'm afraid we can't. The only solution is compiling the GDB manually with --with-python=/the/path/to/your/python3 IIRC.

But actually, we can fix this problem by using %-formatting for better compatibility for the lower version.

But yeah, Python 3.5 is really old, should we change the code just for that?

What's the advantage or disadvantage if we changed the code?

I didn't have this kind of experience, so feel free to share your ideas with me :)

lebr0nli commented 2 years ago

@diohabara

Anyway, I use %-formatting eventually, so the issue should be fixed now.

Let me know if it doesn't work for you.

qiuwei commented 1 year ago

@diohabara

Anyway, I use %-formatting eventually, so the issue should be fixed now.

Let me know if it doesn't work for you.

Seems there are bugs introduced.

https://github.com/lebr0nli/GEP/pull/4

lebr0nli commented 1 year ago

@qiuwei, I merged that PR now Thanks for pointing it out!