Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 267291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:31:36+00:00 2026-05-11T23:31:36+00:00

I am working on a piece of code which uses regular expressions in c.

  • 0

I am working on a piece of code which uses regular expressions in c.

All of the regex stuff is using the standard regex c library.

On line 246 of regexec.c, the line is

__libc_lock_lock(dfa->lock);

My program is segfaulting here and I cannot figure out why. I was trying to find where __libc_lock_lock was defined and it turns out it is a macro in bits/libc-lock.h. However, the macro isnt actually defined to be anything, just defined.

Two questions:

1) Where is the code that is run when __libc_lock_lock is called (I know it must be
replaced with something but I dont know where that would be.

2) if dfa is a re_dfa_t object which is casted from a c string which is the buffer member of the regex_t object type, it will not have any member lock. Is this what is supposed to happen.

It really seams like there is some kind of magic going on here with this __libc_lock_lock

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:31:37+00:00Added an answer on May 11, 2026 at 11:31 pm

    If the segfault is in libc then you can be 99.9% sure of the following:

    1. You are doing something wrong with the API
    2. You have at some previous point clobbered or corrupted memory used by libc, and this is a delayed effect. (Thanks Tyler!)
    3. You are doing something that is pushing the API’s capability
    4. You are a developer testing the current trunk with new changes in the API implementation

    I suspect that the first is the cause. Posting your API usage and your library version might help. The Regexp API in libc is pretty stable.

    Look up debugging with gdb to find a stack trace of the execution path leading to the segfault, and install the glibc-devel packages for the symbols. If the segfault is in (or out) of libc … then you have done something bad (not initialized an opaque pointer for example)

    [aiden@devbox ~]$ gdb ./myProgram
    (gdb) r
    ... Loads of stuff, segfault info ..
    (gdb) bt
    

    Will print the stack and function-names that led to the segault. Compile your source with the ‘-g’ debug flag to keep important debugging information.

    Get an authoritative source for API usage/examples!

    Good Luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a piece of library code around IDisposable . The managed path
I'm working a piece of code to turn phone numbers into links for mobile
I'm currently working in a piece of code where both logic and data access
I have this piece of code (summarized)... AnsiString working(AnsiString format,...) { va_list argptr; AnsiString
I'm trying to get this piece of code working a little better. I suspect
I have a piece of code below which I am trying to use to
I am working with this piece of code, where I am trying to iterate
I have this piece of code that is working but is kind of cumbersome.
I'm working on a spec for a piece of software for my company and
I'm working the the image upload piece of the FCKEditor and I've got the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.