From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21123 invoked by alias); 11 Jan 2012 00:31:15 -0000 Received: (qmail 20968 invoked by uid 22791); 11 Jan 2012 00:31:12 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_DB X-Spam-Check-By: sourceware.org Received: from mail-tul01m020-f169.google.com (HELO mail-tul01m020-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 00:30:51 +0000 Received: by obcwo8 with SMTP id wo8so250101obc.0 for ; Tue, 10 Jan 2012 16:30:50 -0800 (PST) Received: by 10.50.214.42 with SMTP id nx10mr4774746igc.0.1326241850615; Tue, 10 Jan 2012 16:30:50 -0800 (PST) Received: from [192.168.1.103] ([218.109.112.240]) by mx.google.com with ESMTPS id l35sm268722977ibj.0.2012.01.10.16.30.48 (version=SSLv3 cipher=OTHER); Tue, 10 Jan 2012 16:30:49 -0800 (PST) Message-ID: <4F0CD948.8080909@gmail.com> Date: Wed, 11 Jan 2012 00:37:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: Building GDB 7.3.92 with MinGW References: <83hb03e9sx.fsf@gnu.org> <838vlfe0k9.fsf@gnu.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00332.txt.bz2 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. 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. asmwarrior ollydbg from codeblocks' forum