* [RFA] dwarf2cfi cleanup + new file
@ 2002-05-17 6:14 Michal Ludvig
2002-05-17 7:37 ` Elena Zannoni
0 siblings, 1 reply; 4+ messages in thread
From: Michal Ludvig @ 2002-05-17 6:14 UTC (permalink / raw)
To: Elena Zannoni; +Cc: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
Hi,
I have created new header file dwarf2read.h and put all extern
declarations from dwarf2read.c there. This eliminates the need of having
them in dwarf2cfi.c, so I deleted them from there as well.
OK to commit?
2002-05-17 Michal Ludvig <mludvig@suse.cz>
* dwarf2read.h: New file
* dwarf2read.c: Included dwarf2read.h
* dwarf2cfi.c: Ditto, removed extern declarations.
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* +420 2 9654 5373 * http://www.suse.cz
[-- Attachment #2: dwarf2read.h --]
[-- Type: text/plain, Size: 1364 bytes --]
/* Declarations of symbols exported from dwarf2read.c.
Copyright 2001, 2002
Free Software Foundation, Inc.
Contributed by Michal Ludvig, SuSE Labs.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef DWARF2READ_H
#define DWARF2READ_H
#include "bfd.h"
#include "objfiles.h"
extern file_ptr dwarf_frame_offset;
extern unsigned int dwarf_frame_size;
extern file_ptr dwarf_eh_frame_offset;
extern unsigned int dwarf_eh_frame_size;
void dwarf2_build_psymtabs (struct objfile *objfile, int mainline);
int dwarf2_has_info (bfd *abfd);
char * dwarf2_read_section (struct objfile *objfile, file_ptr offset,
unsigned int size);
#endif /* DWARF2READ_H */
[-- Attachment #3: dw2-clean.diff --]
[-- Type: text/plain, Size: 1727 bytes --]
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.49
diff -c -3 -p -r1.49 dwarf2read.c
*** dwarf2read.c 28 Feb 2002 11:21:16 -0000 1.49
--- dwarf2read.c 17 May 2002 13:09:18 -0000
***************
*** 37,42 ****
--- 37,43 ----
#include "demangle.h"
#include "expression.h"
#include "filenames.h" /* for DOSish file names */
+ #include "dwarf2read.h"
#include "language.h"
#include "complaints.h"
Index: dwarf2cfi.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
retrieving revision 1.1.2.2
diff -c -3 -p -r1.1.2.2 dwarf2cfi.c
*** dwarf2cfi.c 14 May 2002 09:50:39 -0000 1.1.2.2
--- dwarf2cfi.c 17 May 2002 13:09:18 -0000
***************
*** 28,33 ****
--- 28,34 ----
#include "elf/dwarf2.h"
#include "inferior.h"
#include "regcache.h"
+ #include "dwarf2read.h"
#include "dwarf2cfi.h"
/* Common Information Entry - holds information that is shared among many
*************** static struct fde_array fde_chunks;
*** 184,199 ****
/* Obstack for allocating temporary storage used during unwind operations. */
static struct obstack unwind_tmp_obstack;
- extern file_ptr dwarf_frame_offset;
- extern unsigned int dwarf_frame_size;
- extern file_ptr dwarf_eh_frame_offset;
- extern unsigned int dwarf_eh_frame_size;
-
static char *dwarf_frame_buffer;
- \f
-
- extern char *dwarf2_read_section (struct objfile *objfile, file_ptr offset,
- unsigned int size);
static struct fde_unit *fde_unit_alloc (void);
static struct cie_unit *cie_unit_alloc (void);
--- 185,191 ----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] dwarf2cfi cleanup + new file
2002-05-17 6:14 [RFA] dwarf2cfi cleanup + new file Michal Ludvig
@ 2002-05-17 7:37 ` Elena Zannoni
2002-05-17 10:51 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Elena Zannoni @ 2002-05-17 7:37 UTC (permalink / raw)
To: Michal Ludvig; +Cc: Elena Zannoni, GDB Patches
Michal Ludvig writes:
> Hi,
> I have created new header file dwarf2read.h and put all extern
> declarations from dwarf2read.c there. This eliminates the need of having
> them in dwarf2cfi.c, so I deleted them from there as well.
>
> OK to commit?
Almost. If we decide to introduce a dwarf2read.h file (I think this
is a good idea) then we should also eliminate the extern's that are in
symfile.h. I.e.:
/* From dwarf2read.c */
extern int dwarf2_has_info (bfd * abfd);
extern void dwarf2_build_psymtabs (struct objfile *, int);
extern void dwarf2_build_frame_info (struct objfile *);
The dwarf2_build_frame_info should definitely go in dwarf2cfi.h, since
it's coming from dwarf2cfi.c, not dwarf2read.c. Then we should add
the appropriate #include's to all the files that need these functions
(not too many, luckily) and update the makefile dependencies.
As far as dwarf2read.h, below:
#include "bfd.h"
#include "objfiles.h"
Gdb is trying to get away from nested includes. These should go in the
files that include dwarf2read.h.
Thanks
Elena
>
> 2002-05-17 Michal Ludvig <mludvig@suse.cz>
> * dwarf2read.h: New file
> * dwarf2read.c: Included dwarf2read.h
> * dwarf2cfi.c: Ditto, removed extern declarations.
>
> Michal Ludvig
> --
> * SuSE CR, s.r.o * mludvig@suse.cz
> * +420 2 9654 5373 * http://www.suse.cz
> /* Declarations of symbols exported from dwarf2read.c.
> Copyright 2001, 2002
> Free Software Foundation, Inc.
> Contributed by Michal Ludvig, SuSE Labs.
>
> This file is part of GDB.
>
> This program is free software; you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 2 of the License, or
> (at your option) any later version.
>
> This program is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License
> along with this program; if not, write to the Free Software
> Foundation, Inc., 59 Temple Place - Suite 330,
> Boston, MA 02111-1307, USA. */
>
>
> #ifndef DWARF2READ_H
> #define DWARF2READ_H
>
> #include "bfd.h"
> #include "objfiles.h"
>
> extern file_ptr dwarf_frame_offset;
> extern unsigned int dwarf_frame_size;
> extern file_ptr dwarf_eh_frame_offset;
> extern unsigned int dwarf_eh_frame_size;
>
> void dwarf2_build_psymtabs (struct objfile *objfile, int mainline);
> int dwarf2_has_info (bfd *abfd);
> char * dwarf2_read_section (struct objfile *objfile, file_ptr offset,
> unsigned int size);
>
> #endif /* DWARF2READ_H */
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.49
> diff -c -3 -p -r1.49 dwarf2read.c
> *** dwarf2read.c 28 Feb 2002 11:21:16 -0000 1.49
> --- dwarf2read.c 17 May 2002 13:09:18 -0000
> ***************
> *** 37,42 ****
> --- 37,43 ----
> #include "demangle.h"
> #include "expression.h"
> #include "filenames.h" /* for DOSish file names */
> + #include "dwarf2read.h"
>
> #include "language.h"
> #include "complaints.h"
> Index: dwarf2cfi.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
> retrieving revision 1.1.2.2
> diff -c -3 -p -r1.1.2.2 dwarf2cfi.c
> *** dwarf2cfi.c 14 May 2002 09:50:39 -0000 1.1.2.2
> --- dwarf2cfi.c 17 May 2002 13:09:18 -0000
> ***************
> *** 28,33 ****
> --- 28,34 ----
> #include "elf/dwarf2.h"
> #include "inferior.h"
> #include "regcache.h"
> + #include "dwarf2read.h"
> #include "dwarf2cfi.h"
>
> /* Common Information Entry - holds information that is shared among many
> *************** static struct fde_array fde_chunks;
> *** 184,199 ****
> /* Obstack for allocating temporary storage used during unwind operations. */
> static struct obstack unwind_tmp_obstack;
>
> - extern file_ptr dwarf_frame_offset;
> - extern unsigned int dwarf_frame_size;
> - extern file_ptr dwarf_eh_frame_offset;
> - extern unsigned int dwarf_eh_frame_size;
> -
> static char *dwarf_frame_buffer;
> - \f
> -
> - extern char *dwarf2_read_section (struct objfile *objfile, file_ptr offset,
> - unsigned int size);
>
> static struct fde_unit *fde_unit_alloc (void);
> static struct cie_unit *cie_unit_alloc (void);
> --- 185,191 ----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] dwarf2cfi cleanup + new file
2002-05-17 7:37 ` Elena Zannoni
@ 2002-05-17 10:51 ` Andrew Cagney
2002-05-17 13:36 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-05-17 10:51 UTC (permalink / raw)
To: Elena Zannoni, Michal Ludvig; +Cc: gdb-patches
> Almost. If we decide to introduce a dwarf2read.h file (I think this
> is a good idea) then we should also eliminate the extern's that are in
> symfile.h. I.e.:
>
> /* From dwarf2read.c */
> extern int dwarf2_has_info (bfd * abfd);
> extern void dwarf2_build_psymtabs (struct objfile *, int);
> extern void dwarf2_build_frame_info (struct objfile *);
>
> The dwarf2_build_frame_info should definitely go in dwarf2cfi.h, since
> it's coming from dwarf2cfi.c, not dwarf2read.c. Then we should add
> the appropriate #include's to all the files that need these functions
> (not too many, luckily) and update the makefile dependencies.
>
> As far as dwarf2read.h, below:
>
> #include "bfd.h"
Already included by "defs.h".
> #include "objfiles.h"
>
> Gdb is trying to get away from nested includes. These should go in the
> files that include dwarf2read.h.
Yes, see:
http://sources.redhat.com/gdb/onlinedocs/gdbint_13.html#SEC111
There can be cases where one header includes another - for a typedef or
enum. This fortunatly isn't one of them:
"bfd.h" is already included by "defs.h".
"objfile.h" can be replaced by ``struct objfile;''.
And I've no idea where file_ptr is comming from. Nope, found it - "bfd.h".
Good move. Don't forget the makefile :-)
enjoy,
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-05-17 20:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-17 6:14 [RFA] dwarf2cfi cleanup + new file Michal Ludvig
2002-05-17 7:37 ` Elena Zannoni
2002-05-17 10:51 ` Andrew Cagney
2002-05-17 13:36 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox