* Just-in-time debugging
@ 2002-06-07 17:24 Robin Rowe
2002-06-08 10:26 ` Christopher Faylor
0 siblings, 1 reply; 14+ messages in thread
From: Robin Rowe @ 2002-06-07 17:24 UTC (permalink / raw)
To: gdb
Hi. Can I configure gdb so that it will launch automatically in response to
a core dump?
Thanks,
Robin
---------------------------------------------------------------------------
www.OpenSourceProgrammers.org
www.LinuxMovies.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-07 17:24 Just-in-time debugging Robin Rowe
@ 2002-06-08 10:26 ` Christopher Faylor
2002-06-08 22:48 ` Eli Zaretskii
2002-06-08 23:17 ` Just-in-time debugging on Linux Robin Rowe
0 siblings, 2 replies; 14+ messages in thread
From: Christopher Faylor @ 2002-06-08 10:26 UTC (permalink / raw)
To: gdb; +Cc: rower
On Fri, Jun 07, 2002 at 05:24:29PM -0700, Robin Rowe wrote:
>Hi. Can I configure gdb so that it will launch automatically in response to
>a core dump?
On what system? On windows you'd do:
set cygwin=error_start=x:/path/to/gdb.exe
I don't know if it's possible to do on unix or not.
cgf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-08 10:26 ` Christopher Faylor
@ 2002-06-08 22:48 ` Eli Zaretskii
2002-06-09 9:30 ` Christopher Faylor
2002-06-08 23:17 ` Just-in-time debugging on Linux Robin Rowe
1 sibling, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2002-06-08 22:48 UTC (permalink / raw)
To: Christopher Faylor; +Cc: gdb
On Sat, 8 Jun 2002, Christopher Faylor wrote:
> On windows you'd do:
>
> set cygwin=error_start=x:/path/to/gdb.exe
Shouldn't this be in the manual?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-08 22:48 ` Eli Zaretskii
@ 2002-06-09 9:30 ` Christopher Faylor
2002-06-09 10:12 ` Eli Zaretskii
0 siblings, 1 reply; 14+ messages in thread
From: Christopher Faylor @ 2002-06-09 9:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Sun, Jun 09, 2002 at 08:46:15AM +0300, Eli Zaretskii wrote:
>
>On Sat, 8 Jun 2002, Christopher Faylor wrote:
>
>> On windows you'd do:
>>
>> set cygwin=error_start=x:/path/to/gdb.exe
>
>Shouldn't this be in the manual?
Does the gdb manual document quirks of individual "operating systems"?
cgf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-09 9:30 ` Christopher Faylor
@ 2002-06-09 10:12 ` Eli Zaretskii
2002-06-09 18:47 ` Christopher Faylor
0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2002-06-09 10:12 UTC (permalink / raw)
To: cgf; +Cc: gdb
> Date: Sun, 9 Jun 2002 12:31:00 -0400
> From: Christopher Faylor <cgf@redhat.com>
> >>
> >> set cygwin=error_start=x:/path/to/gdb.exe
> >
> >Shouldn't this be in the manual?
>
> Does the gdb manual document quirks of individual "operating systems"?
Yes. See the chapter "Configurations" which describes, under
"Native", commands specific to the DJGPP and other ports.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-09 10:12 ` Eli Zaretskii
@ 2002-06-09 18:47 ` Christopher Faylor
2002-06-09 21:46 ` Eli Zaretskii
0 siblings, 1 reply; 14+ messages in thread
From: Christopher Faylor @ 2002-06-09 18:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Sun, Jun 09, 2002 at 08:10:57PM +0300, Eli Zaretskii wrote:
>> Date: Sun, 9 Jun 2002 12:31:00 -0400
>> From: Christopher Faylor <cgf@redhat.com>
>> >>
>> >> set cygwin=error_start=x:/path/to/gdb.exe
>> >
>> >Shouldn't this be in the manual?
>>
>> Does the gdb manual document quirks of individual "operating systems"?
>
>Yes. See the chapter "Configurations" which describes, under
>"Native", commands specific to the DJGPP and other ports.
These all seem to be GDB commands. The command that I gave above is for
the windows command shell. It instructs cygwin to invoke a program when
a fatal signal is encountered.
Unless we want to start documenting things like "How to use ulimit" in
the gdb manual, I don't think it is necessarily appropriate for us
to mention the setting of environment variables for cygwin.
cgf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-09 18:47 ` Christopher Faylor
@ 2002-06-09 21:46 ` Eli Zaretskii
2002-06-10 8:17 ` Andrew Cagney
0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2002-06-09 21:46 UTC (permalink / raw)
To: Christopher Faylor; +Cc: gdb
On Sun, 9 Jun 2002, Christopher Faylor wrote:
> Unless we want to start documenting things like "How to use ulimit" in
> the gdb manual, I don't think it is necessarily appropriate for us
> to mention the setting of environment variables for cygwin.
The variable is related to GDB, so it sounds appropriate.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-09 21:46 ` Eli Zaretskii
@ 2002-06-10 8:17 ` Andrew Cagney
2002-06-10 8:38 ` Christopher Faylor
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Cagney @ 2002-06-10 8:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Christopher Faylor, gdb
> On Sun, 9 Jun 2002, Christopher Faylor wrote:
>
>
>> Unless we want to start documenting things like "How to use ulimit" in
>> the gdb manual, I don't think it is necessarily appropriate for us
>> to mention the setting of environment variables for cygwin.
>
>
> The variable is related to GDB, so it sounds appropriate.
Yes. While not the internal user interface, it definitly very useful
and makes someone using GDB's life easier.
Similar to this is knowing how to use GDB to create a stack backtrace.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-10 8:17 ` Andrew Cagney
@ 2002-06-10 8:38 ` Christopher Faylor
2002-06-10 12:10 ` Eli Zaretskii
0 siblings, 1 reply; 14+ messages in thread
From: Christopher Faylor @ 2002-06-10 8:38 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Eli Zaretskii, gdb
On Mon, Jun 10, 2002 at 11:17:07AM -0400, Andrew Cagney wrote:
>>On Sun, 9 Jun 2002, Christopher Faylor wrote:
>>>Unless we want to start documenting things like "How to use ulimit" in
>>>the gdb manual, I don't think it is necessarily appropriate for us
>>>to mention the setting of environment variables for cygwin.
>>
>>The variable is related to GDB, so it sounds appropriate.
>
>Yes. While not the internal user interface, it definitly very useful
>and makes someone using GDB's life easier.
>
>Similar to this is knowing how to use GDB to create a stack backtrace.
As I'd mentioned, I think a better example is the unix ulimit command.
A grep of 'ulimit' does not unearth anything in the gdb documentation
directory. Certainly, if a user wants to create a core file (and why
would you create a core file except for debugging?) they'd need to know
about this.
If you want to start populating the gdb documentation with OS-specific
hints, then I think you should start with linux.
In the meantime, I'm not going to be providing documentation for this.
I don't want to have to worry about modifying the information in two
places when/if we change the CYGWIN environment variable.
cgf
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging
2002-06-10 8:38 ` Christopher Faylor
@ 2002-06-10 12:10 ` Eli Zaretskii
0 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2002-06-10 12:10 UTC (permalink / raw)
To: cgf; +Cc: ac131313, gdb
> Date: Mon, 10 Jun 2002 11:38:37 -0400
> From: Christopher Faylor <cgf@redhat.com>
>
> In the meantime, I'm not going to be providing documentation for this.
> I don't want to have to worry about modifying the information in two
> places when/if we change the CYGWIN environment variable.
How about a pointer to the other place where this is mentioned in the
Cygwin docs?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging on Linux
2002-06-08 10:26 ` Christopher Faylor
2002-06-08 22:48 ` Eli Zaretskii
@ 2002-06-08 23:17 ` Robin Rowe
1 sibling, 0 replies; 14+ messages in thread
From: Robin Rowe @ 2002-06-08 23:17 UTC (permalink / raw)
To: gdb
Christopher,
> On windows you'd do:
>
> set cygwin=error_start=x:/path/to/gdb.exe
Thanks lots, but I meant Linux. Does anyone know the trick to launch gdb
automatically there?
Robin
---------------------------------------------------------------------------
www.OpenSourceProgrammers.org
www.LinuxMovies.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* # Re: Just-in-time debugging on Linux
@ 2002-06-09 1:30 Michael Veksler
2002-06-09 1:57 ` Robin Rowe
0 siblings, 1 reply; 14+ messages in thread
From: Michael Veksler @ 2002-06-09 1:30 UTC (permalink / raw)
To: Robin Rowe; +Cc: gdb
/References/: <007a01c20e82$daf93e20$0301a8c0@rowboat
<http://sources.redhat.com/ml/gdb/2002-06/msg00063.html>>
<20020608172614.GA16912@redhat.com
<http://sources.redhat.com/ml/gdb/2002-06/msg00064.html>>
> Christopher,
>
> > On windows you'd do:
> >
> > set cygwin=error_start=x:/path/to/gdb.exe
>
> Thanks lots, but I meant Linux. Does anyone know the trick to launch gdb
> automatically there?
>
> Robin
Try the following code:
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdio.h>
static char* exec_name="";
static void crash_handler(int sig)
{
int status=0;
int pid;
char * gdb_array[]={"gdb", exec_name, "PID", NULL};
char pid_str[40];
sprintf(pid_str, "%d%c", getpid(), '\0');
gdb_array[2]= pid_str;
pid= fork();
if (pid < 0) /* error */
abort();
else if (pid) /* parent */
{
sleep(60); /* Give GDB time to attach */
_exit(1); /* you can skip this line by telling gdb to "return" */
}
else /* child */
execvp("gdb", gdb_array);
}
void register_gdb()
{
signal(SIGQUIT, crash_handler); /* Normally got from Ctrl-\ */
signal(SIGILL, crash_handler);
signal(SIGTRAP, crash_handler);
signal(SIGABRT, crash_handler);
signal(SIGFPE, crash_handler);
signal(SIGBUS, crash_handler);
signal(SIGSEGV, crash_handler); /* This is the most common crash */
signal(SIGSYS, crash_handler);
}
void crash_segv()
{
int *p=0;
*p=1;
}
int main(int argc, char *argv[])
{
exec_name=argv[0];
register_gdb();
crash_segv();
return 0;
}
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: Just-in-time debugging on Linux
2002-06-09 1:30 # " Michael Veksler
@ 2002-06-09 1:57 ` Robin Rowe
2002-06-09 2:36 ` phi
0 siblings, 1 reply; 14+ messages in thread
From: Robin Rowe @ 2002-06-09 1:57 UTC (permalink / raw)
To: gdb
Michael,
> signal(SIGSEGV, crash_handler); /* This is the most common crash */
This is an interesting approach, but I want to trap unmodified programs.
Thanks,
Robin
---------------------------------------------------------------------------
www.OpenSourceProgrammers.org
www.LinuxMovies.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging on Linux
2002-06-09 1:57 ` Robin Rowe
@ 2002-06-09 2:36 ` phi
2002-06-10 9:25 ` Tom Tromey
0 siblings, 1 reply; 14+ messages in thread
From: phi @ 2002-06-09 2:36 UTC (permalink / raw)
To: Robin Rowe; +Cc: gdb
Robin Rowe wrote:
>
> Michael,
>
> > signal(SIGSEGV, crash_handler); /* This is the most common crash */
>
> This is an interesting approach, but I want to trap unmodified programs.
>
Then wrap them up in a script
rename prog xyz into xyz.ori this doesn't modify the prog?
then implement the script xyz that does
xyz::
#! your shell
gdb xyz.ori $@
and have you gdbinit (or other ways) to catch the signal you want.
At xyz invocation we start gdb wich start xyz.ori wich will catch the signal
and let you see.
==================
If you really don't want to rename xyz.ori then have the script xyz earlier in
your PATH and make the script invoke the xyz from its original path
Phi
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Just-in-time debugging on Linux
2002-06-09 2:36 ` phi
@ 2002-06-10 9:25 ` Tom Tromey
0 siblings, 0 replies; 14+ messages in thread
From: Tom Tromey @ 2002-06-10 9:25 UTC (permalink / raw)
To: phi; +Cc: Robin Rowe, gdb
>>>>> "phi" == phi <phi@hpfrcu81.france.hp.com> writes:
phi> Then wrap them up in a script
phi> rename prog xyz into xyz.ori this doesn't modify the prog?
phi> then implement the script xyz that does
phi> xyz::
phi> #! your shell
phi> gdb xyz.ori $@
This doesn't really work. One problem is that the inferior won't
start running automatically. The other problem is that I/O
redirections get hosed (I think).
I do think this would be a useful feature for gdb. I've wanted it for
a number of years now, but haven't had the time to implement it.
Incidentally your script is missing a `--args'.
Tom
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2002-06-10 19:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-07 17:24 Just-in-time debugging Robin Rowe
2002-06-08 10:26 ` Christopher Faylor
2002-06-08 22:48 ` Eli Zaretskii
2002-06-09 9:30 ` Christopher Faylor
2002-06-09 10:12 ` Eli Zaretskii
2002-06-09 18:47 ` Christopher Faylor
2002-06-09 21:46 ` Eli Zaretskii
2002-06-10 8:17 ` Andrew Cagney
2002-06-10 8:38 ` Christopher Faylor
2002-06-10 12:10 ` Eli Zaretskii
2002-06-08 23:17 ` Just-in-time debugging on Linux Robin Rowe
2002-06-09 1:30 # " Michael Veksler
2002-06-09 1:57 ` Robin Rowe
2002-06-09 2:36 ` phi
2002-06-10 9:25 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox