Debugging with Gdb, breakpoints not working

I’m trying to get gdb to break on a particular function in a very simple C program. It allows me to place breakpoints, but it’s never hitting them. I can’t figure out why.

#include <stdio.h>

void hello()

int main(void)

Here is my nix-shell file:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  hardeningDisable = [ "all" ];
  NIX_CFLAGS_COMPILE = [ "-ggdb" ];
  dontStrip = true;
  enableDebugging = true;
  packages = with pkgs; [

When I compile and debug my program, it never breaks at the proper function.

$ gcc main.c -ggdb -o main
$ file main
main: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/, for GNU/Linux 2.6.32, with debug_info, not stripped

$ gdb main
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from main...
(gdb) b hello
Breakpoint 1 at 0x401126: file main.c, line 5.
(gdb) r
Starting program: <my-path>/main
[Detaching after fork from child process 37388]
[Inferior 1 (process 37384) exited normally]

I’m not sure why it isn’t breaking properly. Can anyone explain?
For the record I’m running the 22.05 channel.

I figured it out …

I was using an oh-my-zsh plugin that let me use zsh inside my nix-shell.
For some reason this was forking off a subprocess that actually ran my code.
I don’t know why, but disabling the plugin made everything work.