From: asmwarrior <asmwarrior@gmail.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Building GDB 7.3.92 with MinGW
Date: Thu, 12 Jan 2012 00:17:00 -0000 [thread overview]
Message-ID: <4F0E266C.8080208@gmail.com> (raw)
In-Reply-To: <CADPb22RhjKvJmf2xGJHNJrcnwush4goqXrC=3umkq_5t2Wky+g@mail.gmail.com>
On 2012-1-12 1:48, Doug Evans wrote:
> On Tue, Jan 10, 2012 at 4:35 PM, asmwarrior<asmwarrior@gmail.com> wrote:
>> 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?
The script code is embedded in c source code in "python.c", in function: voidfinish_python_initialization (void)
>
>> 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:
build\gdb\config.status
The value is hard-coded:
D["DEBUGDIR"]=" \"/mingw/lib/debug\""
D["DEBUGDIR_RELOCATABLE"]=" 1"
D["GDB_DATADIR"]=" \"/mingw/share/gdb\""
There are some code snippet:
gdb_program_name = xstrdup (argv[0]);
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));
current_directory = gdb_dirbuf;
/* 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);
But those values were not set correctly, so I need to hack the path under MinGW.
It is quite simple to test whether GDB set the python path correctly, just run:
python print gdb.PYTHONDIR
If it shows the correct path, then it's good.
PS: I will have a travel in two days, so further response from me will be some bit later.
asmwarrior
ollydbg from codeblocks' forum
next prev parent reply other threads:[~2012-01-12 0:12 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 18:46 Eli Zaretskii
2012-01-10 18:59 ` Doug Evans
2012-01-10 20:56 ` Eli Zaretskii
2012-01-13 11:28 ` Eli Zaretskii
2012-01-10 19:25 ` Tom Tromey
2012-01-10 20:55 ` Joseph S. Myers
2012-01-10 20:58 ` Eli Zaretskii
2012-01-10 21:00 ` Eli Zaretskii
2012-01-10 19:31 ` Alfred M. Szmidt
2012-01-10 21:01 ` Eli Zaretskii
2012-01-10 21:26 ` Doug Evans
2012-01-11 0:37 ` asmwarrior
2012-01-11 4:08 ` Eli Zaretskii
2012-01-11 4:54 ` asmwarrior
2012-01-11 17:54 ` Doug Evans
2012-01-12 0:17 ` asmwarrior [this message]
2012-01-12 6:47 ` Eli Zaretskii
2012-01-12 8:07 ` Joel Brobecker
2012-01-12 11:54 ` Eli Zaretskii
2012-01-12 12:35 ` Joel Brobecker
2012-01-12 16:59 ` Eli Zaretskii
2012-01-13 14:29 ` asmwarrior
2012-01-13 16:55 ` Eli Zaretskii
2012-01-14 13:53 ` asmwarrior
[not found] ` <4F117B33.8080906@gmail.com>
2012-01-14 18:15 ` Eli Zaretskii
2012-01-15 3:33 ` Pierre Muller
[not found] ` <18546.4176851839$1326580387@news.gmane.org>
2012-01-15 3:54 ` asmwarrior
[not found] ` <000001ccd30c$5ce854e0$16b8fea0$%muller@ics-cnrs.unistra.fr>
2012-01-15 13:35 ` Eli Zaretskii
2012-01-15 17:01 ` Joel Brobecker
2012-01-15 18:55 ` Eli Zaretskii
2012-01-15 18:01 ` Pierre Muller
[not found] ` <000301ccd3a7$3db8c460$b92a4d20$%muller@ics-cnrs.unistra.fr>
2012-01-15 18:55 ` Eli Zaretskii
2012-01-16 3:08 ` Pierre Muller
2012-01-10 21:33 ` Tom Tromey
2012-01-11 1:31 ` asmwarrior
2012-01-11 4:30 ` Eli Zaretskii
2012-01-11 4:30 ` asmwarrior
2012-01-11 3:32 ` Joel Brobecker
2012-01-13 11:06 ` Eli Zaretskii
2012-01-13 12:39 ` Joel Brobecker
2012-01-13 13:56 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F0E266C.8080208@gmail.com \
--to=asmwarrior@gmail.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox