@xunxun, here is the log of gdb (without the hack of gdb's share path), it shows both worked and un-worked condition.
E:\test\unix_gdb\install\mingw\bin>gdb --data-directory=e:/test/unix_gdb/install
/mingw/share/gdb
GNU gdb (GDB) 7.3.50.20110808-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) info pretty-printer
(gdb) q
E:\test\unix_gdb\install\mingw\bin>gdb
GNU gdb (GDB) 7.3.50.20110808-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) info pretty-printer
Undefined info command: "pretty-printer". Try "help info".
(gdb)
the gdb's shared folder is used when it's python module is initialized. but the python module is running
before you "set-directory" command.
so the only way to set the data-directory is setting that path as gdb parameters, like "gdb --data-directory=XXX"
the other way such as “set data-directory XXX” can
not work.