MSYS2-packages icon indicating copy to clipboard operation
MSYS2-packages copied to clipboard

Update gdbinit

Open jinger7281 opened this issue 1 year ago • 4 comments

fix wrong path of libstdcxx python script If the version number of gcc was updated, but this script was not update the variable of %GCC_NAME% which will lead an error of missing libstdcxx module This update use python script to search the real path of the gcc folder and insert it into the sys.path variable

jinger7281 avatar Jul 04 '24 07:07 jinger7281

Sounds good. One thing I noticed is that have multiple dirs left because of python cache files (we should try fix this with the next gcc update).

$ echo /usr/share/gcc*
/usr/share/gcc-11.3.0 /usr/share/gcc-13.2.0 /usr/share/gcc-13.3.0

A hacky workaround is to sort the dirs, which is a good idea anyway since listdir order isn't stable.

What about:

import sys
import glob
python_dirs = sorted(glob.glob("/usr/share/gcc*/python"), reverse=True)
sys.path.insert(0, (python_dirs or [sys.path[0])[0])

lazka avatar Jul 04 '24 22:07 lazka

Or we add a big warning to the gcc build file that gdb needs to be rebuilt on version changes.

lazka avatar Jul 04 '24 22:07 lazka

I've created https://github.com/msys2/MSYS2-packages/pull/4748 as an alternative

lazka avatar Jul 04 '24 22:07 lazka

@lazka

Sounds good. One thing I noticed is that have multiple dirs left because of python cache files (we should try fix this with the next gcc update).

$ echo /usr/share/gcc*
/usr/share/gcc-11.3.0 /usr/share/gcc-13.2.0 /usr/share/gcc-13.3.0

A hacky workaround is to sort the dirs, which is a good idea anyway since listdir order isn't stable.

What about:

import sys
import glob
python_dirs = sorted(glob.glob("/usr/share/gcc*/python"), reverse=True)
sys.path.insert(0, (python_dirs or [sys.path[0])[0])

This may be a good idea. Some newbies like me are always confused about the prompt, and don't know how to deal with this, we added this method to provide a way for newbies to easily use it.

> import sys
> import glob
> python_dirs = sorted(glob.glob("/usr/share/gcc*/python"), reverse=True)
> sys.path.insert(0, (python_dirs or sys.path)[0])

jinger7281 avatar Jul 05 '24 00:07 jinger7281