* [PATCH/RFC] Add back the 'info proc mappings' command.
@ 2001-12-21 15:00 Michael Snyder
2001-12-23 4:13 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Michael Snyder @ 2001-12-21 15:00 UTC (permalink / raw)
To: gdb-patches
This adds back a sub-command ('mappings') of the "info proc"
command, which was lost a couple years ago when procfs.c was
rewritten. There are a bunch of other sub-commands that could
also be added back in -- I just happened to need this one.
I'll wait a week for objections before I check it in.
2001-12-21 Michael Snyder <msnyder@redhat.com>
* procfs.c (info_proc_cmd): Add the 'mappings' sub-command that
was dropped a few years ago, when procfs.c was rewritten.
(info_proc_mappings): New function, implent 'info proc mappings'.
(mappingflags): New function.
(_initialize_procfs): Document new option to 'info proc' command.
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.32
diff -c -3 -p -r1.32 procfs.c
*** procfs.c 2001/07/07 21:55:28 1.32
--- procfs.c 2001/12/21 22:57:30
*************** proc_set_watchpoint (procinfo *pi, CORE_
*** 2879,2889 ****
* or zero.
*/
- /* FIXME: it's probably a waste to cache this FD.
- It doesn't get called that often... and if I open it
- every time, I don't need to lseek it. */
int
! proc_iterate_over_mappings (int (*func) (int, CORE_ADDR))
{
struct prmap *map;
procinfo *pi;
--- 2879,2886 ----
* or zero.
*/
int
! proc_iterate_over_mappings (int (*func) (int, CORE_ADDR)
{
struct prmap *map;
procinfo *pi;
*************** procfs_find_LDT_entry (ptid_t ptid)
*** 5310,5327 ****
}
#endif /* TM_I386SOL2_H */
static void
info_proc_cmd (char *args, int from_tty)
{
struct cleanup *old_chain;
! procinfo *process = NULL;
! procinfo *thread = NULL;
! char **argv = NULL;
! char *tmp = NULL;
! int pid = 0;
! int tid = 0;
old_chain = make_cleanup (null_cleanup, 0);
if (args)
--- 5307,5448 ----
}
#endif /* TM_I386SOL2_H */
+ /*
+ * Function: mappingflags
+ *
+ * Returns an ascii representation of a memory mapping's flags.
+ */
+
+ static char *
+ mappingflags (flags)
+ long flags;
+ {
+ static char asciiflags[8];
+
+ strcpy (asciiflags, "-------");
+ #if defined (MA_PHYS)
+ if (flags & MA_PHYS)
+ asciiflags[0] = 'd';
+ #endif
+ if (flags & MA_STACK)
+ asciiflags[1] = 's';
+ if (flags & MA_BREAK)
+ asciiflags[2] = 'b';
+ if (flags & MA_SHARED)
+ asciiflags[3] = 's';
+ if (flags & MA_READ)
+ asciiflags[4] = 'r';
+ if (flags & MA_WRITE)
+ asciiflags[5] = 'w';
+ if (flags & MA_EXEC)
+ asciiflags[6] = 'x';
+ return (asciiflags);
+ }
+
+ /*
+ * Function: info_proc_mappings
+ *
+ * Implement the "info proc mappings" subcommand.
+ */
+
+ static void
+ info_proc_mappings (procinfo *pi, int summary)
+ {
+ char *header_fmt_string, *data_fmt_string;
+ char pathname[MAX_PROC_NAME_SIZE];
+ struct prmap *prmaps;
+ struct prmap *prmap;
+ int map_fd;
+ int nmap;
+ #ifdef NEW_PROC_API
+ struct stat sbuf;
+ #endif
+
+ if (TARGET_PTR_BIT == 32)
+ {
+ header_fmt_string = "\t%10s %10s %10s %10s %7s\n";
+ data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
+ }
+ else
+ {
+ header_fmt_string = " %18s %18s %10s %10s %7s\n";
+ data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
+ }
+
+ if (summary)
+ return; /* No output for summary mode. */
+
+ /* Get the number of mappings, allocate space,
+ and read the mappings into prmaps. */
+ #ifdef NEW_PROC_API
+ /* Open map fd. */
+ sprintf (pathname, "/proc/%d/map", pi->pid);
+ if ((map_fd = open (pathname, O_RDONLY)) < 0)
+ return; /* Can't open map file. */
+ /* Make sure it gets closed again. */
+ make_cleanup_close (map_fd);
+
+ /* Use stat to determine the file size, and compute
+ the number of prmap_t objects it contains. */
+ if (fstat (map_fd, &sbuf) != 0)
+ return; /* Can't stat file. */
+
+ nmap = sbuf.st_size / sizeof (prmap_t);
+ prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps));
+ if (read (map_fd, (char *) prmaps, nmap * sizeof (*prmaps))
+ != (nmap * sizeof (*prmaps)))
+ return; /* Can't read file. */
+ #else
+ /* Use ioctl command PIOCNMAP to get number of mappings. */
+ if (ioctl (pi->ctl_fd, PIOCNMAP, &nmap) != 0)
+ return; /* Can't get number of mappings. */
+ prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps));
+ if (ioctl (pi->ctl_fd, PIOCMAP, prmaps) != 0)
+ return; /* Can't read mappings. */
+ #endif
+
+ printf_filtered ("Mapped address spaces:\n\n");
+ printf_filtered (header_fmt_string,
+ "Start Addr",
+ " End Addr",
+ " Size",
+ " Offset",
+ "Flags");
+
+ for (prmap = prmaps; nmap > 0; prmap++, nmap--)
+ {
+ printf_filtered (data_fmt_string,
+ (unsigned long) prmap->pr_vaddr,
+ (unsigned long) prmap->pr_vaddr
+ + prmap->pr_size - 1,
+ prmap->pr_size,
+ #ifdef PCAGENT /* Gross hack: only defined on Solaris 2.6+ */
+ (unsigned int) prmap->pr_offset,
+ #else
+ prmap->pr_off,
+ #endif
+ mappingflags (prmap->pr_mflags));
+ }
+ printf_filtered ("\n");
+ }
+ /*
+ * Function: info_proc_cmd
+ *
+ * Implement the "info proc" command.
+ */
static void
info_proc_cmd (char *args, int from_tty)
{
struct cleanup *old_chain;
! procinfo *process = NULL;
! procinfo *thread = NULL;
! char **argv = NULL;
! char *tmp = NULL;
! int pid = 0;
! int tid = 0;
! int mappings = 0;
old_chain = make_cleanup (null_cleanup, 0);
if (args)
*************** info_proc_cmd (char *args, int from_tty)
*** 5343,5348 ****
--- 5464,5473 ----
{
tid = strtoul (argv[0] + 1, NULL, 10);
}
+ else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
+ {
+ mappings = 1;
+ }
else
{
/* [...] */
*************** info_proc_cmd (char *args, int from_tty)
*** 5389,5394 ****
--- 5514,5524 ----
proc_prettyprint_why (proc_why (thread), proc_what (thread), 1);
}
+ if (mappings)
+ {
+ info_proc_mappings (process, 0);
+ }
+
do_cleanups (old_chain);
}
*************** _initialize_procfs (void)
*** 5466,5473 ****
init_procfs_ops ();
add_target (&procfs_ops);
add_info ("proc", info_proc_cmd,
! "Show /proc process information about any running process.\
! Default is the process being debugged.");
add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
"Give a trace of entries into the syscall.");
add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd,
--- 5596,5604 ----
init_procfs_ops ();
add_target (&procfs_ops);
add_info ("proc", info_proc_cmd,
! "Show /proc process information about any running process.\n\
! Specify process id, or use the program being debugged by default.\n\
! Specify keyword 'mappings' for detailed info on memory mappings.");
add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
"Give a trace of entries into the syscall.");
add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd,
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-21 15:00 [PATCH/RFC] Add back the 'info proc mappings' command Michael Snyder
@ 2001-12-23 4:13 ` Eli Zaretskii
2001-12-26 11:22 ` Michael Snyder
2001-12-23 13:12 ` Daniel Jacobowitz
2001-12-28 11:48 ` Michael Snyder
2 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2001-12-23 4:13 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
To: msnyder@cygnus.com
> From: Michael Snyder <msnyder@cygnus.com>
> Date: Fri, 21 Dec 2001 14:59:53 -0800 (PST)
>
> This adds back a sub-command ('mappings') of the "info proc"
> command, which was lost a couple years ago when procfs.c was
> rewritten.
Thanks!
Please consider writing this command's description for the manual.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-21 15:00 [PATCH/RFC] Add back the 'info proc mappings' command Michael Snyder
2001-12-23 4:13 ` Eli Zaretskii
@ 2001-12-23 13:12 ` Daniel Jacobowitz
2001-12-28 11:48 ` Michael Snyder
2 siblings, 0 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2001-12-23 13:12 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
On Fri, Dec 21, 2001 at 02:59:53PM -0800, Michael Snyder wrote:
>
> This adds back a sub-command ('mappings') of the "info proc"
> command, which was lost a couple years ago when procfs.c was
> rewritten. There are a bunch of other sub-commands that could
> also be added back in -- I just happened to need this one.
>
> I'll wait a week for objections before I check it in.
>
> 2001-12-21 Michael Snyder <msnyder@redhat.com>
>
> * procfs.c (info_proc_cmd): Add the 'mappings' sub-command that
> was dropped a few years ago, when procfs.c was rewritten.
> (info_proc_mappings): New function, implent 'info proc mappings'.
> (mappingflags): New function.
> (_initialize_procfs): Document new option to 'info proc' command.
>
> Index: procfs.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/procfs.c,v
> retrieving revision 1.32
> diff -c -3 -p -r1.32 procfs.c
> *** procfs.c 2001/07/07 21:55:28 1.32
> --- procfs.c 2001/12/21 22:57:30
> *************** proc_set_watchpoint (procinfo *pi, CORE_
> *** 2879,2889 ****
> * or zero.
> */
>
> - /* FIXME: it's probably a waste to cache this FD.
> - It doesn't get called that often... and if I open it
> - every time, I don't need to lseek it. */
> int
> ! proc_iterate_over_mappings (int (*func) (int, CORE_ADDR))
> {
> struct prmap *map;
> procinfo *pi;
> --- 2879,2886 ----
> * or zero.
> */
>
> int
> ! proc_iterate_over_mappings (int (*func) (int, CORE_ADDR)
> {
> struct prmap *map;
> procinfo *pi;
That's a typo, I think - you deleted a parenthesis. Did this compile?
Looks fine to me otherwise, FWIW.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-23 4:13 ` Eli Zaretskii
@ 2001-12-26 11:22 ` Michael Snyder
2001-12-26 11:27 ` Michael Snyder
2001-12-26 12:29 ` Eli Zaretskii
0 siblings, 2 replies; 12+ messages in thread
From: Michael Snyder @ 2001-12-26 11:22 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
Eli Zaretskii wrote:
>
> To: msnyder@cygnus.com
> > From: Michael Snyder <msnyder@cygnus.com>
> > Date: Fri, 21 Dec 2001 14:59:53 -0800 (PST)
> >
> > This adds back a sub-command ('mappings') of the "info proc"
> > command, which was lost a couple years ago when procfs.c was
> > rewritten.
>
> Thanks!
>
> Please consider writing this command's description for the manual.
It's already there. In fact, the manual currently includes docs
for several "info proc" options that no longer exist. Until someone
finds the time to re-implement them, I suggest that these items
be commented out or removed.
I don't know how to comment out a section of a texinfo file.
Do you?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-26 11:22 ` Michael Snyder
@ 2001-12-26 11:27 ` Michael Snyder
2001-12-26 11:34 ` Michael Snyder
2001-12-26 12:29 ` Eli Zaretskii
1 sibling, 1 reply; 12+ messages in thread
From: Michael Snyder @ 2001-12-26 11:27 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 897 bytes --]
Michael Snyder wrote:
>
> Eli Zaretskii wrote:
> >
> > To: msnyder@cygnus.com
> > > From: Michael Snyder <msnyder@cygnus.com>
> > > Date: Fri, 21 Dec 2001 14:59:53 -0800 (PST)
> > >
> > > This adds back a sub-command ('mappings') of the "info proc"
> > > command, which was lost a couple years ago when procfs.c was
> > > rewritten.
> >
> > Thanks!
> >
> > Please consider writing this command's description for the manual.
>
> It's already there. In fact, the manual currently includes docs
> for several "info proc" options that no longer exist. Until someone
> finds the time to re-implement them, I suggest that these items
> be commented out or removed.
>
> I don't know how to comment out a section of a texinfo file.
> Do you?
Hmmm, here's an attempt. If you know a nicer way to comment out
a section, or if you'd prefer just to remove them until they're
needed, please let me know.
[-- Attachment #2: infoproc.patch --]
[-- Type: text/plain, Size: 3767 bytes --]
2001-12-26 Michael Snyder <msnyder@redhat.com>
* gdb.texinfo (info proc): Remove documentation for 'info proc'
sub-options that are currently not implemented.
Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.59
diff -c -3 -p -r1.59 gdb.texinfo
*** gdb.texinfo 2001/11/30 23:03:09 1.59
--- gdb.texinfo 2001/12/26 19:25:05
*************** use by @value{GDBN}, and the files from
*** 9347,9352 ****
--- 9347,9376 ----
command @code{help target} lists all possible targets rather than
current ones.
+ @kindex maint info sections
+ @item maint info sections
+ Another command that can give you extra information about program sections
+ is @code{maint info sections}. In addition to the section information
+ displayed by @code{info files}, this command displays the flags and file
+ offset of each section in the executable and core dump files. In addition,
+ @code{maint info sections} provides the following command options (which
+ may be arbitrarily combined):
+
+ @table @code
+ @kindex maint info sections ALLOBJ
+ @item ALLOBJ
+ Display sections for all loaded object files, including shared libraries.
+ @kindex maint info sections @samp{<section name(s)>}
+ @item @samp{<section name(s)>}
+ Display info only for section(s) matching the listed name(s).
+ @kindex maint info sections @samp{<section flag(s)>}
+ @item @samp{<section flag(s)>}
+ Display info only for sections for which @samp{<section flag(s)>} are true.
+ The section flags that @value{GDBN} currently knows about are @code{ALLOC,
+ LOAD, RELOC, READONLY, CODE, DATA, ROM, CONSTRUCTOR, HAS_CONTENTS,
+ NEVER_LOAD, COFF_SHARED_LIBRARY,} and @code{IS_COMMON}.
+ @end table
+
@end table
All file-specifying commands allow both absolute and relative file names
*************** Summarize available information about th
*** 11259,11283 ****
@item info proc mappings
Report on the address ranges accessible in the program, with information
on whether your program may read, write, or execute each range.
!
! @kindex info proc times
! @item info proc times
! Starting time, user CPU time, and system CPU time for your program and
! its children.
!
! @kindex info proc id
! @item info proc id
! Report on the process IDs related to your program: its own process ID,
! the ID of its parent, the process group ID, and the session ID.
!
! @kindex info proc status
! @item info proc status
! General information on the state of the process. If the process is
! stopped, this report includes the reason for stopping, and any signal
! received.
!
! @item info proc all
! Show all the above information about the process.
@end table
@node DJGPP Native
--- 11283,11307 ----
@item info proc mappings
Report on the address ranges accessible in the program, with information
on whether your program may read, write, or execute each range.
! @comment
! @comment @kindex info proc times
! @comment @item info proc times
! @comment Starting time, user CPU time, and system CPU time for your program
! @comment and its children.
! @comment
! @comment @kindex info proc id
! @comment @item info proc id
! @comment Report on the process IDs related to your program: its own process ID,
! @comment the ID of its parent, the process group ID, and the session ID.
! @comment
! @comment @kindex info proc status
! @comment @item info proc status
! @comment General information on the state of the process. If the process is
! @comment stopped, this report includes the reason for stopping, and any signal
! @comment received.
! @comment
! @comment @item info proc all
! @comment Show all the above information about the process.
@end table
@node DJGPP Native
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-26 11:27 ` Michael Snyder
@ 2001-12-26 11:34 ` Michael Snyder
0 siblings, 0 replies; 12+ messages in thread
From: Michael Snyder @ 2001-12-26 11:34 UTC (permalink / raw)
To: Eli Zaretskii, gdb-patches
Michael Snyder wrote:
>
> Michael Snyder wrote:
> >
> > Eli Zaretskii wrote:
> > >
> > > To: msnyder@cygnus.com
> > > > From: Michael Snyder <msnyder@cygnus.com>
> > > > Date: Fri, 21 Dec 2001 14:59:53 -0800 (PST)
> > > >
> > > > This adds back a sub-command ('mappings') of the "info proc"
> > > > command, which was lost a couple years ago when procfs.c was
> > > > rewritten.
> > >
> > > Thanks!
> > >
> > > Please consider writing this command's description for the manual.
> >
> > It's already there. In fact, the manual currently includes docs
> > for several "info proc" options that no longer exist. Until someone
> > finds the time to re-implement them, I suggest that these items
> > be commented out or removed.
> >
> > I don't know how to comment out a section of a texinfo file.
> > Do you?
>
> Hmmm, here's an attempt. If you know a nicer way to comment out
> a section, or if you'd prefer just to remove them until they're
> needed, please let me know.
Oops, there's extra diffs in there. Please disregard the bits that
refer to "maint info sections".
> ------------------------------------------------------------------------
> 2001-12-26 Michael Snyder <msnyder@redhat.com>
>
> * gdb.texinfo (info proc): Remove documentation for 'info proc'
> sub-options that are currently not implemented.
>
> Index: gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.59
> diff -c -3 -p -r1.59 gdb.texinfo
> *** gdb.texinfo 2001/11/30 23:03:09 1.59
> --- gdb.texinfo 2001/12/26 19:25:05
> *************** use by @value{GDBN}, and the files from
> *** 9347,9352 ****
> --- 9347,9376 ----
> command @code{help target} lists all possible targets rather than
> current ones.
>
> + @kindex maint info sections
> + @item maint info sections
> + Another command that can give you extra information about program sections
> + is @code{maint info sections}. In addition to the section information
> + displayed by @code{info files}, this command displays the flags and file
> + offset of each section in the executable and core dump files. In addition,
> + @code{maint info sections} provides the following command options (which
> + may be arbitrarily combined):
> +
> + @table @code
> + @kindex maint info sections ALLOBJ
> + @item ALLOBJ
> + Display sections for all loaded object files, including shared libraries.
> + @kindex maint info sections @samp{<section name(s)>}
> + @item @samp{<section name(s)>}
> + Display info only for section(s) matching the listed name(s).
> + @kindex maint info sections @samp{<section flag(s)>}
> + @item @samp{<section flag(s)>}
> + Display info only for sections for which @samp{<section flag(s)>} are true.
> + The section flags that @value{GDBN} currently knows about are @code{ALLOC,
> + LOAD, RELOC, READONLY, CODE, DATA, ROM, CONSTRUCTOR, HAS_CONTENTS,
> + NEVER_LOAD, COFF_SHARED_LIBRARY,} and @code{IS_COMMON}.
> + @end table
> +
> @end table
>
> All file-specifying commands allow both absolute and relative file names
> *************** Summarize available information about th
> *** 11259,11283 ****
> @item info proc mappings
> Report on the address ranges accessible in the program, with information
> on whether your program may read, write, or execute each range.
> !
> ! @kindex info proc times
> ! @item info proc times
> ! Starting time, user CPU time, and system CPU time for your program and
> ! its children.
> !
> ! @kindex info proc id
> ! @item info proc id
> ! Report on the process IDs related to your program: its own process ID,
> ! the ID of its parent, the process group ID, and the session ID.
> !
> ! @kindex info proc status
> ! @item info proc status
> ! General information on the state of the process. If the process is
> ! stopped, this report includes the reason for stopping, and any signal
> ! received.
> !
> ! @item info proc all
> ! Show all the above information about the process.
> @end table
>
> @node DJGPP Native
> --- 11283,11307 ----
> @item info proc mappings
> Report on the address ranges accessible in the program, with information
> on whether your program may read, write, or execute each range.
> ! @comment
> ! @comment @kindex info proc times
> ! @comment @item info proc times
> ! @comment Starting time, user CPU time, and system CPU time for your program
> ! @comment and its children.
> ! @comment
> ! @comment @kindex info proc id
> ! @comment @item info proc id
> ! @comment Report on the process IDs related to your program: its own process ID,
> ! @comment the ID of its parent, the process group ID, and the session ID.
> ! @comment
> ! @comment @kindex info proc status
> ! @comment @item info proc status
> ! @comment General information on the state of the process. If the process is
> ! @comment stopped, this report includes the reason for stopping, and any signal
> ! @comment received.
> ! @comment
> ! @comment @item info proc all
> ! @comment Show all the above information about the process.
> @end table
>
> @node DJGPP Native
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-26 11:22 ` Michael Snyder
2001-12-26 11:27 ` Michael Snyder
@ 2001-12-26 12:29 ` Eli Zaretskii
2001-12-26 14:28 ` Michael Snyder
1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2001-12-26 12:29 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches
> Date: Wed, 26 Dec 2001 11:18:08 -0800
> From: Michael Snyder <msnyder@cygnus.com>
>
> I don't know how to comment out a section of a texinfo file.
Put "@ignore..@end ignore" around the part you want to comment out.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-26 12:29 ` Eli Zaretskii
@ 2001-12-26 14:28 ` Michael Snyder
2001-12-27 0:49 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Michael Snyder @ 2001-12-26 14:28 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
Eli Zaretskii wrote:
>
> > Date: Wed, 26 Dec 2001 11:18:08 -0800
> > From: Michael Snyder <msnyder@cygnus.com>
> >
> > I don't know how to comment out a section of a texinfo file.
>
> Put "@ignore..@end ignore" around the part you want to comment out.
Ah, OK -- how's this?
[-- Attachment #2: infoproc.patch --]
[-- Type: text/plain, Size: 1322 bytes --]
Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.59
diff -c -3 -p -r1.59 gdb.texinfo
*** gdb.texinfo 2001/11/30 23:03:09 1.59
--- gdb.texinfo 2001/12/26 20:51:35
2001-12-26 Michael Snyder <msnyder@redhat.com>
* gdb.texinfo (info proc): Remove documentation for 'info proc'
sub-options that are currently not implemented.
*************** Summarize available information about th
*** 11259,11265 ****
@item info proc mappings
Report on the address ranges accessible in the program, with information
on whether your program may read, write, or execute each range.
!
@kindex info proc times
@item info proc times
Starting time, user CPU time, and system CPU time for your program and
--- 11283,11289 ----
@item info proc mappings
Report on the address ranges accessible in the program, with information
on whether your program may read, write, or execute each range.
! @ignore
@kindex info proc times
@item info proc times
Starting time, user CPU time, and system CPU time for your program and
*************** received.
*** 11278,11283 ****
--- 11302,11308 ----
@item info proc all
Show all the above information about the process.
+ @end ignore
@end table
@node DJGPP Native
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-26 14:28 ` Michael Snyder
@ 2001-12-27 0:49 ` Eli Zaretskii
2001-12-27 10:43 ` Michael Snyder
2001-12-29 11:17 ` Andrew Cagney
0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2001-12-27 0:49 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
On Wed, 26 Dec 2001, Michael Snyder wrote:
> > > I don't know how to comment out a section of a texinfo file.
> >
> > Put "@ignore..@end ignore" around the part you want to comment out.
>
> Ah, OK -- how's this?
Perfect! Please commit this. Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-27 0:49 ` Eli Zaretskii
@ 2001-12-27 10:43 ` Michael Snyder
2001-12-29 11:17 ` Andrew Cagney
1 sibling, 0 replies; 12+ messages in thread
From: Michael Snyder @ 2001-12-27 10:43 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
Eli Zaretskii wrote:
>
> On Wed, 26 Dec 2001, Michael Snyder wrote:
>
> > > > I don't know how to comment out a section of a texinfo file.
> > >
> > > Put "@ignore..@end ignore" around the part you want to comment out.
> >
> > Ah, OK -- how's this?
>
> Perfect! Please commit this. Thanks.
Committed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-21 15:00 [PATCH/RFC] Add back the 'info proc mappings' command Michael Snyder
2001-12-23 4:13 ` Eli Zaretskii
2001-12-23 13:12 ` Daniel Jacobowitz
@ 2001-12-28 11:48 ` Michael Snyder
2 siblings, 0 replies; 12+ messages in thread
From: Michael Snyder @ 2001-12-28 11:48 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
Michael Snyder wrote:
>
> This adds back a sub-command ('mappings') of the "info proc"
> command, which was lost a couple years ago when procfs.c was
> rewritten. There are a bunch of other sub-commands that could
> also be added back in -- I just happened to need this one.
>
> I'll wait a week for objections before I check it in.
Committed.
> 2001-12-21 Michael Snyder <msnyder@redhat.com>
>
> * procfs.c (info_proc_cmd): Add the 'mappings' sub-command that
> was dropped a few years ago, when procfs.c was rewritten.
> (info_proc_mappings): New function, implent 'info proc mappings'.
> (mappingflags): New function.
> (_initialize_procfs): Document new option to 'info proc' command.
>
> Index: procfs.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/procfs.c,v
> retrieving revision 1.32
> diff -c -3 -p -r1.32 procfs.c
> *** procfs.c 2001/07/07 21:55:28 1.32
> --- procfs.c 2001/12/21 22:57:30
> *************** proc_set_watchpoint (procinfo *pi, CORE_
> *** 2879,2889 ****
> * or zero.
> */
>
> - /* FIXME: it's probably a waste to cache this FD.
> - It doesn't get called that often... and if I open it
> - every time, I don't need to lseek it. */
> int
> ! proc_iterate_over_mappings (int (*func) (int, CORE_ADDR))
> {
> struct prmap *map;
> procinfo *pi;
> --- 2879,2886 ----
> * or zero.
> */
>
> int
> ! proc_iterate_over_mappings (int (*func) (int, CORE_ADDR)
> {
> struct prmap *map;
> procinfo *pi;
> *************** procfs_find_LDT_entry (ptid_t ptid)
> *** 5310,5327 ****
> }
> #endif /* TM_I386SOL2_H */
>
>
>
> static void
> info_proc_cmd (char *args, int from_tty)
> {
> struct cleanup *old_chain;
> ! procinfo *process = NULL;
> ! procinfo *thread = NULL;
> ! char **argv = NULL;
> ! char *tmp = NULL;
> ! int pid = 0;
> ! int tid = 0;
>
> old_chain = make_cleanup (null_cleanup, 0);
> if (args)
> --- 5307,5448 ----
> }
> #endif /* TM_I386SOL2_H */
>
> + /*
> + * Function: mappingflags
> + *
> + * Returns an ascii representation of a memory mapping's flags.
> + */
> +
> + static char *
> + mappingflags (flags)
> + long flags;
> + {
> + static char asciiflags[8];
> +
> + strcpy (asciiflags, "-------");
> + #if defined (MA_PHYS)
> + if (flags & MA_PHYS)
> + asciiflags[0] = 'd';
> + #endif
> + if (flags & MA_STACK)
> + asciiflags[1] = 's';
> + if (flags & MA_BREAK)
> + asciiflags[2] = 'b';
> + if (flags & MA_SHARED)
> + asciiflags[3] = 's';
> + if (flags & MA_READ)
> + asciiflags[4] = 'r';
> + if (flags & MA_WRITE)
> + asciiflags[5] = 'w';
> + if (flags & MA_EXEC)
> + asciiflags[6] = 'x';
> + return (asciiflags);
> + }
> +
> + /*
> + * Function: info_proc_mappings
> + *
> + * Implement the "info proc mappings" subcommand.
> + */
> +
> + static void
> + info_proc_mappings (procinfo *pi, int summary)
> + {
> + char *header_fmt_string, *data_fmt_string;
> + char pathname[MAX_PROC_NAME_SIZE];
> + struct prmap *prmaps;
> + struct prmap *prmap;
> + int map_fd;
> + int nmap;
> + #ifdef NEW_PROC_API
> + struct stat sbuf;
> + #endif
> +
> + if (TARGET_PTR_BIT == 32)
> + {
> + header_fmt_string = "\t%10s %10s %10s %10s %7s\n";
> + data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
> + }
> + else
> + {
> + header_fmt_string = " %18s %18s %10s %10s %7s\n";
> + data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
> + }
> +
> + if (summary)
> + return; /* No output for summary mode. */
> +
> + /* Get the number of mappings, allocate space,
> + and read the mappings into prmaps. */
> + #ifdef NEW_PROC_API
> + /* Open map fd. */
> + sprintf (pathname, "/proc/%d/map", pi->pid);
> + if ((map_fd = open (pathname, O_RDONLY)) < 0)
> + return; /* Can't open map file. */
> + /* Make sure it gets closed again. */
> + make_cleanup_close (map_fd);
> +
> + /* Use stat to determine the file size, and compute
> + the number of prmap_t objects it contains. */
> + if (fstat (map_fd, &sbuf) != 0)
> + return; /* Can't stat file. */
> +
> + nmap = sbuf.st_size / sizeof (prmap_t);
> + prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps));
> + if (read (map_fd, (char *) prmaps, nmap * sizeof (*prmaps))
> + != (nmap * sizeof (*prmaps)))
> + return; /* Can't read file. */
> + #else
> + /* Use ioctl command PIOCNMAP to get number of mappings. */
> + if (ioctl (pi->ctl_fd, PIOCNMAP, &nmap) != 0)
> + return; /* Can't get number of mappings. */
> + prmaps = (struct prmap *) alloca ((nmap + 1) * sizeof (*prmaps));
> + if (ioctl (pi->ctl_fd, PIOCMAP, prmaps) != 0)
> + return; /* Can't read mappings. */
> + #endif
> +
> + printf_filtered ("Mapped address spaces:\n\n");
> + printf_filtered (header_fmt_string,
> + "Start Addr",
> + " End Addr",
> + " Size",
> + " Offset",
> + "Flags");
> +
> + for (prmap = prmaps; nmap > 0; prmap++, nmap--)
> + {
> + printf_filtered (data_fmt_string,
> + (unsigned long) prmap->pr_vaddr,
> + (unsigned long) prmap->pr_vaddr
> + + prmap->pr_size - 1,
> + prmap->pr_size,
> + #ifdef PCAGENT /* Gross hack: only defined on Solaris 2.6+ */
> + (unsigned int) prmap->pr_offset,
> + #else
> + prmap->pr_off,
> + #endif
> + mappingflags (prmap->pr_mflags));
> + }
> + printf_filtered ("\n");
> + }
>
> + /*
> + * Function: info_proc_cmd
> + *
> + * Implement the "info proc" command.
> + */
>
> static void
> info_proc_cmd (char *args, int from_tty)
> {
> struct cleanup *old_chain;
> ! procinfo *process = NULL;
> ! procinfo *thread = NULL;
> ! char **argv = NULL;
> ! char *tmp = NULL;
> ! int pid = 0;
> ! int tid = 0;
> ! int mappings = 0;
>
> old_chain = make_cleanup (null_cleanup, 0);
> if (args)
> *************** info_proc_cmd (char *args, int from_tty)
> *** 5343,5348 ****
> --- 5464,5473 ----
> {
> tid = strtoul (argv[0] + 1, NULL, 10);
> }
> + else if (strncmp (argv[0], "mappings", strlen (argv[0])) == 0)
> + {
> + mappings = 1;
> + }
> else
> {
> /* [...] */
> *************** info_proc_cmd (char *args, int from_tty)
> *** 5389,5394 ****
> --- 5514,5524 ----
> proc_prettyprint_why (proc_why (thread), proc_what (thread), 1);
> }
>
> + if (mappings)
> + {
> + info_proc_mappings (process, 0);
> + }
> +
> do_cleanups (old_chain);
> }
>
> *************** _initialize_procfs (void)
> *** 5466,5473 ****
> init_procfs_ops ();
> add_target (&procfs_ops);
> add_info ("proc", info_proc_cmd,
> ! "Show /proc process information about any running process.\
> ! Default is the process being debugged.");
> add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
> "Give a trace of entries into the syscall.");
> add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd,
> --- 5596,5604 ----
> init_procfs_ops ();
> add_target (&procfs_ops);
> add_info ("proc", info_proc_cmd,
> ! "Show /proc process information about any running process.\n\
> ! Specify process id, or use the program being debugged by default.\n\
> ! Specify keyword 'mappings' for detailed info on memory mappings.");
> add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
> "Give a trace of entries into the syscall.");
> add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd,
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH/RFC] Add back the 'info proc mappings' command.
2001-12-27 0:49 ` Eli Zaretskii
2001-12-27 10:43 ` Michael Snyder
@ 2001-12-29 11:17 ` Andrew Cagney
1 sibling, 0 replies; 12+ messages in thread
From: Andrew Cagney @ 2001-12-29 11:17 UTC (permalink / raw)
To: Eli Zaretskii, Michael Snyder; +Cc: gdb-patches
> On Wed, 26 Dec 2001, Michael Snyder wrote:
>
>
>> > > I don't know how to comment out a section of a texinfo file.
>
>> >
>> > Put "@ignore..@end ignore" around the part you want to comment out.
>
>>
>> Ah, OK -- how's this?
>
>
> Perfect! Please commit this. Thanks.
As an aside, if these commands really were lost, should a few bug
reports be filed indicating that.
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2001-12-29 19:17 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-21 15:00 [PATCH/RFC] Add back the 'info proc mappings' command Michael Snyder
2001-12-23 4:13 ` Eli Zaretskii
2001-12-26 11:22 ` Michael Snyder
2001-12-26 11:27 ` Michael Snyder
2001-12-26 11:34 ` Michael Snyder
2001-12-26 12:29 ` Eli Zaretskii
2001-12-26 14:28 ` Michael Snyder
2001-12-27 0:49 ` Eli Zaretskii
2001-12-27 10:43 ` Michael Snyder
2001-12-29 11:17 ` Andrew Cagney
2001-12-23 13:12 ` Daniel Jacobowitz
2001-12-28 11:48 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox