This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Tue, Jan 10, 2012 at 4:35 PM, asmwarrior<asmwarrior@gmail.com> wrote:The script code is embedded in c source code in "python.c", in function: voidfinish_python_initialization (void)On 2012-1-11 5:23, Doug Evans wrote:For one, remembering to pass -data-directory is a pain.
This parameter does not work correctly under MinGW in the case that I would like gdb to automatically run the python script when it startup.When you say "run the python script", *which* python script are you referring to?
Normally, my gdb is put in MinGW/bin, and the gdb's own python script is under: MinGW\share\gdb\python\gdb\*.py
I need to hard-code the code in gdb/main.c to set the data-directory value. (Because gdb is build from MSYS+MinGW, but it run normally on Windows shell without MSYS)
Here are some hard-code modify to the main.c file, if you do not change this, there is no way to load gdb's own python scripts.
diff --git a/gdb/main.c b/gdb/main.c index 8b45c25..46b11a8 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -42,6 +42,10 @@ #include "python/python.h" #include "objfiles.h" +#ifdef _WIN32 +extern int get_app_fullpath(char *location, int length); +#endif + /* The selected interpreter. This will be used as a set command variable, so it should always be malloc'ed - since do_setshow_command will free it. */ @@ -355,8 +359,27 @@ captured_main (void *data) debug_file_directory = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE); + +#ifdef _WIN32 + { + char location[500]; + int len= get_app_fullpath(location, sizeof (location)); + if (len == 0 || len> 500 - 1) + gdb_datadir = relocate_gdb_directory (GDB_DATADIR,GDB_DATADIR_RELOCATABLE); + else + { + char *p_slash =strrchr(location,'\\'); + *p_slash = '\000'; + p_slash =strrchr(location,'\\'); /* remove the bin folder*/ + *p_slash = '\000'; + strcat(location,"\\share\\gdb"); + gdb_datadir = xstrdup (location); + } + } +#else gdb_datadir = relocate_gdb_directory (GDB_DATADIR, - GDB_DATADIR_RELOCATABLE); + GDB_DATADIR_RELOCATABLE); +#endif #ifdef WITH_PYTHON_PATH {
If I remember correctly, I have post it some months ago.*If* there is a bug here, and it's not pilot error, it feels like perhaps the bug is in relocate_gdb_directory. [Why don't all calls to relocate_gdb_directory require similar treatment? Thus this feels like the wrong way to go.]
Maybe if you provide a sample session (and complete session please, no editing to trim it down), that will help.
I have just look at my notes half years ago(no time to write a complete session right now), the issue is: In the file:
D["DEBUGDIR"]=" \"/mingw/lib/debug\"" D["DEBUGDIR_RELOCATABLE"]=" 1" D["GDB_DATADIR"]=" \"/mingw/share/gdb\""
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf))) /* Don't use *_filtered or warning() (which relies on current_target) until after initialize_all_files(). */ fprintf_unfiltered (gdb_stderr, _("%s: warning: error finding " "working directory: %s\n"), argv[0], safe_strerror (errno));
/* Set the sysroot path. */ gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_RELOCATABLE);
debug_file_directory = relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
gdb_datadir = relocate_gdb_directory (GDB_DATADIR, GDB_DATADIR_RELOCATABLE);
asmwarrior ollydbg from codeblocks' forum
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |