[pushed] gdb: fix include for gdb_signal in target/waitstatus.h

Message ID 20240419200856.2291305-1-simon.marchi@polymtl.ca
State New
Headers
Series [pushed] gdb: fix include for gdb_signal in target/waitstatus.h |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged

Commit Message

Simon Marchi April 19, 2024, 8:08 p.m. UTC
  clangd tells me that the gdb_signals.h include in target/waitstatus.h is
unused.  This include was probably to give access to `enum gdb_signal`,
but this is in fact defined in gdb/signals.h.  Change the include to
gdb/signals.h.  Include gdbsupport/gdb_signals.h in some files that were
relying on the transitive include.

Change-Id: I6f4361b3d801394bf29abe8c1393aff110aa0ad6
---
 gdb/nat/fork-inferior.c | 1 +
 gdb/target/waitstatus.c | 1 +
 gdb/target/waitstatus.h | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)


base-commit: ebb8507cee4edcb6b355a04159a4d4822f756e1c
  

Comments

Tom Tromey April 19, 2024, 8:21 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
Simon> index dce1a7f3175e..7d5ad3f97769 100644
Simon> --- a/gdb/target/waitstatus.h
Simon> +++ b/gdb/target/waitstatus.h
Simon> @@ -21,7 +21,7 @@
Simon>  #define TARGET_WAITSTATUS_H
 
Simon>  #include "diagnostics.h"
Simon> -#include "gdbsupport/gdb_signals.h"
Simon> +#include "gdb/signals.h"
 
I think target/ files should not depend on files from gdb, because
gdb/target (and gdb/nat) are also used by gdbserver.

IMO that's a confusing situation and we should probably move those
subdirs to gdbsupport (but not build them there) to make the setup more
clear.  If that's possible.

Tom
  
Simon Marchi April 23, 2024, 3:18 a.m. UTC | #2
On 2024-04-19 16:21, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
> 
> Simon> diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
> Simon> index dce1a7f3175e..7d5ad3f97769 100644
> Simon> --- a/gdb/target/waitstatus.h
> Simon> +++ b/gdb/target/waitstatus.h
> Simon> @@ -21,7 +21,7 @@
> Simon>  #define TARGET_WAITSTATUS_H
>  
> Simon>  #include "diagnostics.h"
> Simon> -#include "gdbsupport/gdb_signals.h"
> Simon> +#include "gdb/signals.h"
>  
> I think target/ files should not depend on files from gdb, because
> gdb/target (and gdb/nat) are also used by gdbserver.

This is include/gdb/signals.h, not a header from the gdb directory.

> IMO that's a confusing situation and we should probably move those
> subdirs to gdbsupport (but not build them there) to make the setup more
> clear.  If that's possible.

Agreed, I don't really like the current situation.

Simon
  
Tom Tromey April 23, 2024, 3:30 a.m. UTC | #3
Simon> +#include "gdb/signals.h"
>> 
>> I think target/ files should not depend on files from gdb, because
>> gdb/target (and gdb/nat) are also used by gdbserver.

Simon> This is include/gdb/signals.h, not a header from the gdb directory.

Thanks, that makes sense.

>> IMO that's a confusing situation and we should probably move those
>> subdirs to gdbsupport (but not build them there) to make the setup more
>> clear.  If that's possible.

Simon> Agreed, I don't really like the current situation.

If we moved to the only-gdbserver model we wouldn't have this problem :)

But moving just the files to gdbsupport is easier and might help.
Though it probably still won't help me remember the top-level include
directory.

Tom
  

Patch

diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
index a5900fe4ee8f..4378177bc8c4 100644
--- a/gdb/nat/fork-inferior.c
+++ b/gdb/nat/fork-inferior.c
@@ -26,6 +26,7 @@ 
 #include "gdbsupport/pathstuff.h"
 #include "gdbsupport/signals-state-save-restore.h"
 #include "gdbsupport/gdb_tilde_expand.h"
+#include "gdbsupport/gdb_signals.h"
 #include <vector>
 
 extern char **environ;
diff --git a/gdb/target/waitstatus.c b/gdb/target/waitstatus.c
index 30c0621326fd..9e9b5633b12d 100644
--- a/gdb/target/waitstatus.c
+++ b/gdb/target/waitstatus.c
@@ -18,6 +18,7 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "waitstatus.h"
+#include "gdbsupport/gdb_signals.h"
 
 /* See waitstatus.h.  */
 
diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
index dce1a7f3175e..7d5ad3f97769 100644
--- a/gdb/target/waitstatus.h
+++ b/gdb/target/waitstatus.h
@@ -21,7 +21,7 @@ 
 #define TARGET_WAITSTATUS_H
 
 #include "diagnostics.h"
-#include "gdbsupport/gdb_signals.h"
+#include "gdb/signals.h"
 
 /* Stuff for target_wait.  */